Download presentation source

Download Report

Transcript Download presentation source

CS 551 / 645:
Introductory Computer Graphics
General Occlusion Culling
David Luebke
7/27/2016
Administrivia


Questions on assignment 4?
Class Thursday: guest lecture by Professor
Brogan
David Luebke
7/27/2016
Recap: Cells & Portals

An example:
David Luebke
7/27/2016
Recap: Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
H
F
G
Recap: Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
H
F
G
Recap: Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
H
F
G
Recap: Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
H
F
G
Recap: Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
H
F
G
Recap: Cells & Portals
E
A
D
B
C
?
F
G
H
A
B
E
C
D
?
H
F
G
Recap: Cells & Portals
E
A
D
B
C
X
F
G
H
A
B
E
C
D
X
H
F
G
Recap: Cells & Portals

View-independent solution: find all cells a particular
cell could possibly see:
E
A
D
B
F
C
G
H
C can only see A, D, E, and H
Recap: Cells and Portals

Good solution for most architectural or urban
models
– Use the simplest algorithm that suffices for your
needs:


David Luebke
pfPortals-style algorithm: view-dependent solution,
reasonably tight PVS, no preprocess necessary
Teller-style algorithm: tighter PVS, somewhat more
complex, can provide view-independent solution for
prefetching
7/27/2016
General Occlusion Culling

When cells and portals don’t work…
– Trees in a forest
– A crowded train station

Need general occlusion culling algorithms:
– Aggregate occlusion
– Dynamic scenes
– Non-polygonal scenes (?)
David Luebke
7/27/2016
General Occlusion Culling

I’ll discuss two algorithms:
– Hierarchical Z-Buffer

Ned Greene, SIGGRAPH 93
– Hierarchical Occlusion Maps

David Luebke
Hansong Zhang, SIGGRAPH 97
7/27/2016
Hierarchical Z-Buffer

Replace Z-buffer with a Z-pyramid
– Lowest level: full-resolution Z-buffer
– Higher levels: each pixel represents the maximum
depth of the four pixels “underneath” it

Basic idea: hierarchical rasterization of the
polygon, with early termination where
polygon is occluded
David Luebke
7/27/2016
Hierarchical Z-Buffer

Idea: test polygon against highest level first
– If polygon is further than distance recorded in
pixel, stop--it’s occluded
– If polygon is closer, recursively check against next
lower level
– If polygon is visible at lowest level, set new
distance value and propagate up
David Luebke
7/27/2016
Hierarchical Z-Buffer

Z-pyramid exploits image-space coherence:
– Polygon occluded in a pixel is probably occluded
in nearby pixels

HZB also exploits object-space coherence
– Polygons near an occluded polygon are probably
occluded
David Luebke
7/27/2016
Hierarchical Z-Buffer

Exploiting object-space coherence:
– Subdivide scene with an octree
– All geometry in an octree node is contained by a
cube
– Before rendering the contents of a node, “render”
the faces of its cube (query the Z-pyramid)
– If cube faces are occluded, ignore the entire node
David Luebke
7/27/2016
Hierarchical Z-Buffer

HZB can exploit temporal coherence
– Most polygons affecting the Z-buffer last frame
will affect Z-buffer this frame
– HZB also operates at max efficiency when Zpyramid already built

So start each frame by rendering octree
nodes visible last frame
David Luebke
7/27/2016
Hierarchical Z-Buffer:
Discussion


HZB needs hardware support to be really
competitive
Hardware vendors haven’t bought in:
– Z-pyramid (and hierarchies in general) unfriendly
to hardware
– Unpredictable Z-query times generate bubbles in
rendering pipe

But there is a promising trend…
David Luebke
7/27/2016
Hierarchical Z-Buffer

Hardware beginning to support
Z-query operation
– Allows systems to exploit:


Object-space coherence (bounding boxes)
Temporal coherence (last-rendered list)
– Systems I’m aware of:


HP Visualize-fx graphics
SGI Visual Workstation products
– An aside: applies to cell-portal culling!
David Luebke
7/27/2016
Hierarchical
Occlusion Maps


A more hardware-friendly general occlusion
culling algorithm
Two major differences from HZB:
– Separates occluders from occludees
– Decouples occlusion test into an depth test and a
overlap test
David Luebke
7/27/2016
Hierarchical
Occlusion Maps

Occluders versus occludees:
Blue parts: occluders
Red parts: occludees
David Luebke
7/27/2016
Hierarchical
Occlusion Maps

Depth versus overlap:
View
Point
X
Z
Y
Depth
David Luebke
+
Overlap
= Occlusion
7/27/2016
Hierarchical
Occlusion Maps

Representation of projection for overlap test:
occlusion map
– Corresponds to a screen subdivision
– Records average opacity per partition

Generate by rendering occluders
– Record pixel opacities (== coverage)
David Luebke
7/27/2016
Occlusion Maps
Rendered Image
David Luebke
Occlusion Map
7/27/2016
Occlusion Map Pyramid
64 x 64
David Luebke
32 x 32
16 x 16
7/27/2016
Occlusion Map Pyramid
David Luebke
7/27/2016
Occlusion Map Pyramid

Analyzing cumulative projection:
– A hierarchical occlusion map (HOM)
– Generate by recursive averaging (l.p.f.)
– Records average opacities for blocks of multiple
pixels, representing occlusion at multiple
resolutions
– Construction can be accelerated by texture
hardware
David Luebke
7/27/2016
Overlap Tests

Query: is projection of occludee inside
cumulative projection of occluders?
– Cumulative projection: occlusion pyramid
– Ocludee projection: expensive in general


David Luebke
Overestimate ocludee with 3-D bounding box
Overestimate projection of 3-D bounding box with 2-D
bounding rectangle in screen-space
7/27/2016
Overlap Tests

Hierarchical structure enables some
optimizations:
– Predictive rejection

Terminate test when it must fail later
– Conservative rejection

The transparency threshold
– Aggressive Approximate Culling


David Luebke
Ignore objects barely visible through holes
The opacity threshold
7/27/2016
Aggressive
Approximate Culling
0
David Luebke
1
2
3
4
7/27/2016
Hierarchical
Occlusion Maps

Not discussed here:
– Depth test


Depth estimation buffer
Modified Z-buffer
– Selecting occluders

For more details, see attached excerpt from
Hansong Zhang’s dissertation
David Luebke
7/27/2016
HOM: Discussion

Provides a robust, general, hardwarefriendly occlusion culling algorithm
– Supports dynamic scenes
– Supports non-polygonal geometry
– Not many hardware assumptions
David Luebke
7/27/2016
HOM: Discussion


Efficient coding, careful tuning a must
Fairly high per-frame overhead
– Needs high depth complexity, good occluder
selection to be worthwhile
– UNC’s MMR system: HOM used maybe 5% of
the time
David Luebke
7/27/2016
Visibility Culling: Discussion

When is visibility culling worthwhile?
– When scene has high depth complexity


David Luebke
Examples: architectural walkthroughs, complex CAD
assemblies, dense forest
Non-examples: terrain, single highly-tesselated object
(e.g., a radiositized room)
7/27/2016
Visibility Culling:
Discussion

How does visibility culling compare to:
– Level-of-detail:


Reduces geometry processing
Helps transform-bound apps
– Visibility culling:


Reduces geometry and pixel processing
Helps transform- and fill rate-bound apps
– Texture / Image representations:


David Luebke
Reduces geometry and pixel processing
Incurs texture/image processing costs
7/27/2016
Visibility Culling:
Discussion

How does visibility culling interact with level
of detail?
– Fairly seamless integration; generally a win
– One issue: visibility of simplified model may differ
from original model; requires some care
– LODs can speed up occluder selection and
rendering
David Luebke
7/27/2016
Visibility Culling:
Discussion

How does visibility culling interact with
texture and image-based representations?
– Texture/image reps generally replace far-field
geometry



David Luebke
Involves an implicit occlusion culling step
Reduces scene depth complexity, decreasing the
utility of visibility culling
If near-field geometry still includes complex heavilyocclusive assemblies, still a win
7/27/2016
Visibility Culling:
Discussion

How much culling effort is appropriate?
– Cells and portals: relatively cheap, with large
potential speedups
– Hierarchical occlusion maps: relatively costly,
carefully weigh potential gains
– Multiple processors allow much more aggressive
culling calculation


David Luebke
Pipelining culling calculations, Performer-style, lets cull
time = render time
Tradeoff: one frame increased latency
7/27/2016
Summary

The basic, very powerful idea:
– Rapidly compute a potentially visible set
– Let hardware handle the rest

For many scenes, visibility culling is a
simple way to get huge speedups
– View-frustum culling always a must
– For scenes with high depth complexity,
occlusion culling can be a big win
David Luebke
7/27/2016
Summary

Architectural models: visibility is practically a
solved problem
– Cells and portals work well


David Luebke
Cull-box portal culling: simple, fast
Line-stabbing: elegant, powerful
7/27/2016
Summary

Occlusion culling of general models: still a
largely open problem
– Important issues:


David Luebke
Dynamic scenes
Aggregate occlusion effects
7/27/2016
Summary

General occlusion culling algorithms:
– Hierarchical Z-buffer:


A simple, truly elegant algorithm
But doesn’t seem amenable to hardware
– Hierarchical occlusion maps:




David Luebke
More complicated, difficult to code & tune
Better suited to current hardware
Lends itself well to aggressive culling
Fairly high overhead, only worthwhile with high depth
complexity
7/27/2016
The End
Questions?
David Luebke
7/27/2016