Visibility Culling Markus Hadwiger & Andreas Varga.
-
date post
22-Dec-2015 -
Category
Documents
-
view
225 -
download
3
Transcript of Visibility Culling Markus Hadwiger & Andreas Varga.
Visibility CullingMarkus Hadwiger & Andreas Varga
Basics
• Hierarchical Subdivision– Hierarchical Bounding Boxes– Octrees– K-D Trees ( K-Dimensional Space)– BSP Trees ( Binary Space Partition )
• Potentially Visible Sets (PVS)
Hierarchical Bounding Box (HS)
• Construct a bounding box for each object• Merge nearby bounding box into bigger ones• Not very structured and systematic• Perform well for certain viewpoint• Shortcomings:
– Highly dependent on the given scene(worse: on the actual viewpoint)
– Unpredictable not very useful !
Hierarchical Bounding Box Example (HS)
WORLD
ROLLERCOASTER
CAR #2 CAR #1
GUY_BAD GUY_BAD
GUN GUY_BAD
Octrees (HS)
• Each node of and octree has form one to eight children if it is an internal node; otherwise it is a leaf node
• Culling against the viewing frustum• Shortcomings of regular subdivision
– Efficiently problem (inflexible)– Depend on the location of each polygon
• The two dimensional version of an octree is called quadtree
Octrees Example (HS)
K-D Trees2/2 (HS)
• Hierarchically subdivide n-dimensional space• A binary tree
– partitioning space into two halfspaces at each level
– two equal-sized partitions is not necessary (Octrees)
• Always done axial• A separating hyperplane can depend on actual data• Balance of binary tree
– One halfspace contains the same number of objects as the other halfspace
K-D Trees Example 1/2 (HS)
1
1
2 3
2
3
4 5 6 7
4
5
6
7
8 9 10 11 12 13
8
9
10
11
12
13
K-D Trees Example 2/2 (HS)
BSP Trees6 (HS)
• Generalization of k-D trees – Space is subdivided along arbitrarily oriented hyperlpanes
– Subdivision of space into two halfspace at each step• Produces a binary tree
• Internal node corresponds to the partitioning hyperplane
• Leaf nodes are empty halfspaces
• Exact visibility determination for arbitrary viewpoint– For entirely static polygonal scenes
• Can be precalculated once and traversal at run time witharbitrary viewpoint
BSP Trees Example 1 (HS)
1
23
45
6
1
BSP Trees Example 2 (HS)
1
23
4a5
6
4b
front1
2
BSP Trees Example 3 (HS)
1
23
4a5
6
4b
1
32
front back
BSP Trees Example 4 (HS)
1
23
4a5
6
4b
1
32
4a
front back
front
4b
back
BSP Trees Example 5 (HS)
1
32
4a 4b
6
5
1
23
4a5
6
4b
front back
front back front
front
BSP Trees Example 6 (HS)
1
23
45
6
V1
V2
1
32
4a 4b
6
5
front back
front back front
front
The painting order from V1: 3, 5, 1, 4b, 2, 6, 4aThe painting order from V2: 3, 5, 1, 4b, 2, 4a, 6
We got correct picture of who is behind whom no matter where we were looking from.
BSP Trees Example 6 (HS)
Cell-Portals
• Assume the world can be broken into cells– Simple shapes– Rooms in a building, for instance
• Define portals to be the transparent boundaries between cells– Doorways between rooms, windows, etc
• In a world like this, can determine exactly which parts of which rooms are visible– Then render visible rooms plus contents
Cell-Portals Example
A B
C D
E F
A B
C D
E F
- Node are cells, edges are portals- K-D trees and BSP trees are used to generate the cell structure and find neighbors and portals
- Portals can be one way (directed edges)- Graph is normally stored in adjacency list format
- Each cell stores the edges (portals) out of it
Cell and Portal Visibility• Keep track of which cell the viewer is in• Somehow walk the graph to enumerate all the visible
regions– Can be done as a preprocess to identify the potentially
visible set (PVS) for each cell• Cell-to-region visibility, or cell-to-object visibility
– Can be done at run-time for a more accurate visible set• Start at the known viewer location• Eye-to-region or Eye-to-cell visibility
– Trade-off is between time spent rendering more than is necessary vs. time spent computing a smaller set
• Depends on the environment, such as the size of cells, density of objects, …
Potentially Visible Sets (PVS)
• PVS: The set of cells/regions/objects/polygons that can be seen from a particular cell– Generally, choose to identify objects that can be seen– Trade-off is memory consumption vs. accurate visibility
• Computed as a pre-process– Have to have a strategy to manage dynamic objects
• Used in various ways:– As the only visibility computation - render everything in
the PVS for the viewer’s current cell– As a first step - identify regions that are of interest for
more accurate run-time algorithms
Cell-to-Cell PVS
• Cell A is in cell B’s PVS if there exist a stabbing line that originates on a portal of B and reaches a portal of A– A stabbing line is a line segment intersecting only portals– Neighbor cells are trivially in the PVS
I J
H
GA
CB E
F
D
PVS for I contains:B, C, E, F, H, J
Finding Stabbing Lines
• In 2D, have to find a line that separates the left edges of the portals from the right edges
• In 3D, more complex because portals are now a sequence of arbitrarily aligned polygons– Put rectangular bounding boxes
around each portal and stab those
L L
LLR
R
R
R
Stab Trees
• A stab tree indicates:– The PVS for a cell
– The portal sequences to get from one to the other
• Used in further visibility processing– Restricts number of
cells/portals that must be looked at
A
C
DE
A/C
C/D1
C/D2C/E
A B
C D
E F
D
F
D/F
Run-Time Visibility
• PVS approaches are entirely pre-processing– At run time, just render PVS
• Better results can be obtained with a little run-time processing– Sometimes guided by PVS
– It appears that most games don’t bother, the trade-off favors pre-processed visibility and over-rendering
• At run time the viewer’s location is known, hence Eye-to-Region visibility
Eye-to-Cell
• Recall that finding stabbing lines involved finding a line that passed through all the portals
• The viewer adds some constraints:– The stabbing line must pass through the eye– It must be inside the view frustum
• The resulting problem is still reasonably fast to solve– Results in knowledge of which cells are visible from the
eye– Use the stab tree from the PVS computation to avoid
wasting effort– Further optimization is to keep reducing the view frustum
as it passes through each portal, which leads us to…
Eye-to-Region Visibility• Define a procedure :
– Takes a view frustum and a cell• Viewer not necessarily in the cell
– Draws the contents of the cell that are in the frustum
– For each portal out of the cell, clips the frustum to that portal and recurs with the new frustum and the cell beyond the portal
• Make sure not to go to the cell you entered
• Start in the cell containing the viewer, with the full viewing frustum
• Stop when no more portals intersect the view frustum
Eye-to-Region Example
View
Eye-to-Region Example
View
Eye-to-Region Example
View
Eye-to-Region Example
View
Eye-to-Region Example
View
Eye-to-Region Example
ViewView
Eye-to-Region Example
View
Non-Invasive Interactive Visualization of Architectural
Environments
Christopher Niederauer U.C. Santa Barbara
Mike Houston Stanford University
Maneesh Agrawala Microsoft Research
Greg Humphreys University of Virginia
Problem
• Environments of video game are vast and tend to be densely occluded.
• Most 3D model viewing application lack the ability to simultaneously display the interior spaces and the external structure of the environment.
Motivation
Arcball style manipulator Walkthrough
Can’t see overall interior/exterior structure!
ArcBall [Shoemake 1992] [Teller 1992]
Motivation
The occlusions make it impossible to see all the action at once!
Quake III[Id Software c. 2002]
The Idea
• Exploded view– just below the ceilings
• Non-Invasive [Mohr 2001]
– without modification– use Chromium
[Humphreys et al. 2002]
Overall structure is visible!
How It’s Done
• Example Architecture: Soda Hall
– Geometric Analysis (once)
– Rendering (every frame)
OpenGLStream
Geometric Analysis
GatherData
FindSplits
Rendering
…Floor
FloorComposite
Gather Architectural Data• Intercept the OpenGL stream
– Find downward facing polygons• Requires up-vector
up
1
2 3
– Compute the height of downward facing polygon
1
height = v1‧upVector
polygon normal = (v2-v1) x (v3-v2)
446
Gather Architectural Data• Create Histogram
286126
Height Ceiling Area
Geometric Analysis Rendering
OpenGLStream
…Floor
FloorComposite
Soda Hall Side Profile
606766942
FindSplits
GatherData
FindSplits
Find Splitting Heights
Geometric Analysis Rendering
GatherData
OpenGLStream
…Floor
FloorComposite
Offset Ceiling Heights
Offset Ceiling Heights
Geometric Analysis
FindSplits
Geometric Analysis Rendering
GatherData
OpenGLStream
…Floor
Floor
Composite
Find Downward Facing Polygons
Up Vector
Find SplitHeights
Player Height
NumSplits
Table MappingHeight to
Surface Area
List of Split Height
Rendering
• Multiple Playback (Once per Floor)– Viewpoint Control– Clipping Planes – Translate along Up Vector
Geometric Analysis Rendering
GatherData
FindSplits
OpenGLStream
…Floor
FloorComposite
Rendering
MultiplePlayback
Set ViewpointClip Plans &Translation
Viewpoint
NumSplits
MultipassComposite
Set ViewpointClip Plans &Translation
…
Num
Spli
ts P
asse
s of
Ori
gina
l Ope
nGL
Num
Spli
ts P
asse
s of
M
odif
ied
Ope
nGL
SeparationDistance
Exploded viewvisualization
GeometricAnalysis
List of SplitHeights
OriginalApplication
OpenGL
Cluster Speedup
Composite
Floor 1 Floor 2 Floor 3Complete Model
800 MHz Pentium III Xeon processorNVIDIA GeForce4 graphics accelerator
Soda Hall
TrackballWalkthrough
Results with Soda Hall
(Single Floor)
Quake III: Arena
TrackballWalkthrough
Results with Quake III: Arena
(Single Floor)
Item
Video
Transparent Back-Faces
Future Directions
• Make fully automated:– Semantic inputs
• Up vector
• Number of stories to split into
Future Directions
[Salomon et al, 2003]
Future Directions
(Hand Designed Mock-up)
Summary and Conclusions
• Can improve viewer comprehension
Resource
• Visibility Cullinghttp://www.cg.tuwien.ac.at/~msh/
• Stephen Chenney http://www.cs.wisc.edu/~schenney/
• Non-Invasive Interactive Visualization of Dynamic Architectural Environments http://graphics.stanford.edu/papers/archsplit/
• Chromium Homepagehttp://chromium.sourceforge.net/