Presentation is loading. Please wait.

Presentation is loading. Please wait.

Visibility Culling David Luebke Computer Science Department University of Virginia

Similar presentations


Presentation on theme: "Visibility Culling David Luebke Computer Science Department University of Virginia"— Presentation transcript:

1 Visibility Culling David Luebke Computer Science Department University of Virginia <luebke@cs.virginia.edu>

2 D2 Recap: General Occlusion Culling When cells and portals don’t work…When cells and portals don’t work… –Trees in a forest –A crowded train station Need general occlusion culling algorithms:Need general occlusion culling algorithms: –Aggregate occlusion –Dynamic scenes –Non-polygonal scenes

3 D3 Recap: General Occlusion Culling I’ll discuss two algorithms:I’ll discuss two algorithms: –Hierarchical Z-Buffer Ned Greene, SIGGRAPH 93 Ned Greene, SIGGRAPH 93 –Hierarchical Occlusion Maps Hansong Zhang, SIGGRAPH 97 Hansong Zhang, SIGGRAPH 97

4 D4 Recap: Hierarchical Z-Buffer Replace Z-buffer with a Z-pyramidReplace 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 occludedBasic idea: hierarchical rasterization of the polygon, with early termination where polygon is occluded

5 D5 Hierarchical Z-Buffer Idea: test polygon against highest level firstIdea: 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

6 D6 Hierarchical Z-Buffer Z-pyramid exploits image-space coherence :Z-pyramid exploits image-space coherence : –Polygon occluded in a pixel is probably occluded in nearby pixels HZB also exploits object-space coherenceHZB also exploits object-space coherence –Polygons near an occluded polygon are probably occluded

7 D7 Hierarchical Z-Buffer Exploiting object-space coherence: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 (i.e., query the Z-pyramid) –If cube faces are occluded, ignore the entire node

8 D8 Hierarchical Z-Buffer HZB can exploit temporal coherenceHZB 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 Z-pyramid already built So start each frame by rendering octree nodes visible last frameSo start each frame by rendering octree nodes visible last frame

9 D9 Hierarchical Z-Buffer: Discussion HZB needs hardware support to be really competitiveHZB needs hardware support to be really competitive To date, hardware vendors haven’t bought in:To date, 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…But there is a promising trend…

10 D10 Hierarchical Z-Buffer Hardware beginning to support Z-query operationHardware beginning to support Z-query operation –Allows systems to exploit: Object-space coherence (bounding boxes) Object-space coherence (bounding boxes) Temporal coherence (last-rendered list) Temporal coherence (last-rendered list) –Systems I’m aware of: HP Visualize- fx graphics HP Visualize- fx graphics SGI Visual Workstation products SGI Visual Workstation products –An aside: applies to cell-portal culling!

11 D11 Hierarchical Occlusion Maps A more hardware-friendly general occlusion culling algorithmA more hardware-friendly general occlusion culling algorithm Two major differences from HZB:Two major differences from HZB: –Separates occluders from occludees –Decouples occlusion test into an depth test and a overlap test

12 D12 Hierarchical Occlusion Maps Occluders versus occludees:Occluders versus occludees: Blue parts: occluders Red parts: occludees

13 D13 Hierarchical Occlusion Maps Depth versus overlap:Depth versus overlap: View Point Z X Y Depth + Overlap = Occlusion Depth + Overlap = Occlusion

14 D14 Hierarchical Occlusion Maps Representation of projection for overlap test: occlusion mapRepresentation of projection for overlap test: occlusion map –Corresponds to a screen subdivision –Records average opacity per partition Generate by rendering occludersGenerate by rendering occluders –Record pixel opacities (i.e., coverage)

15 D15 Rendered Image Occlusion Map Occlusion Maps

16 D16 Occlusion Map Pyramid 64 x 6432 x 3216 x 16

17 D17 Occlusion Map Pyramid

18 D18 Occlusion Map Pyramid Analyzing cumulative projection:Analyzing cumulative projection: –A hierarchical occlusion map (HOM) –Generate by recursive averaging (once per frame) –Records average opacities for blocks of multiple pixels, representing occlusion at multiple resolutions –Construction can be accelerated by texture hardware

19 D19 Overlap Tests Query: is projection of occludee inside cumulative projection of occluders?Query: is projection of occludee inside cumulative projection of occluders? –Cumulative projection: occlusion pyramid –Ocludee projection: expensive in general Overestimate ocludee with 3-D bounding box Overestimate ocludee with 3-D bounding box Overestimate projection of 3-D bounding box with 2-D bounding rectangle in screen-space Overestimate projection of 3-D bounding box with 2-D bounding rectangle in screen-space

20 D20 Overlap Tests Hierarchical structure enables some optimizations:Hierarchical structure enables some optimizations: –Predictive rejection Terminate test when it must fail later Terminate test when it must fail later –Conservative rejection The transparency threshold The transparency threshold –Aggressive Approximate Culling Ignore objects barely visible through holes Ignore objects barely visible through holes The opacity threshold The opacity threshold

21 D21 Aggressive Approximate Culling 0 1 234

22 D22 Hierarchical Occlusion Maps Not discussed here:Not discussed here: –Depth test Depth estimation buffer Depth estimation buffer Modified Z-buffer Modified Z-buffer –Selecting occluders For more details, see attached excerpt from Hansong Zhang’s dissertationFor more details, see attached excerpt from Hansong Zhang’s dissertation

23 D23 HOM: Discussion Provides a robust, general, hardware- friendly occlusion culling algorithmProvides a robust, general, hardware- friendly occlusion culling algorithm –Supports dynamic scenes –Supports non-polygonal geometry –Not many hardware assumptions

24 D24 HOM: Discussion Efficient coding, careful tuning a mustEfficient coding, careful tuning a must Fairly high per-frame overheadFairly high per-frame overhead –Needs high depth complexity, good occluder selection to be worthwhile –UNC’s MMR system:

25 D25 Visibility Culling: Discussion When is visibility culling worthwhile? When is visibility culling worthwhile? –When scene has high depth complexity Examples: architectural walkthroughs, complex CAD assemblies, dense forest Examples: architectural walkthroughs, complex CAD assemblies, dense forest Non-examples: terrain, single highly-tesselated object (e.g., a radiositized room) Non-examples: terrain, single highly-tesselated object (e.g., a radiositized room)

26 D26 Visibility Culling: Discussion How does visibility culling compare to: How does visibility culling compare to: –Level-of-detail: Reduces geometry processing Reduces geometry processing Helps transform-bound apps Helps transform-bound apps –Visibility culling: Reduces geometry and pixel processing Reduces geometry and pixel processing Helps transform- and fill rate-bound apps Helps transform- and fill rate-bound apps –Texture / Image representations: Reduces geometry and pixel processing Reduces geometry and pixel processing Incurs texture/image processing costs Incurs texture/image processing costs

27 D27 Visibility Culling: Discussion How does visibility culling interact with level of detail? 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

28 D28 Visibility Culling: Discussion How does visibility culling interact with texture and image-based representations? How does visibility culling interact with texture and image-based representations? –Texture/image reps generally replace far-field geometry Involves an implicit occlusion culling step Involves an implicit occlusion culling step Reduces scene depth complexity, decreasing the utility of visibility culling Reduces scene depth complexity, decreasing the utility of visibility culling If near-field geometry still includes complex heavily- occlusive assemblies, still a win If near-field geometry still includes complex heavily- occlusive assemblies, still a win

29 D29 Visibility Culling: Discussion How much culling effort is appropriate? 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 Pipelining culling calculations, Performer-style, allows cull time = render time Pipelining culling calculations, Performer-style, allows cull time = render time Tradeoff: one frame increased latency Tradeoff: one frame increased latency

30 D30 Summary The basic, very powerful idea: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 speedupsFor 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

31 D31 Summary Architectural models: visibility is practically a solved problemArchitectural models: visibility is practically a solved problem –Cells and portals work well Cull-box portal culling: simple, fast Cull-box portal culling: simple, fast Line-stabbing: elegant, powerful Line-stabbing: elegant, powerful

32 D32 Summary Occlusion culling of general models: still a largely open problemOcclusion culling of general models: still a largely open problem –Important issues: Dynamic scenes Dynamic scenes Aggregate occlusion effects Aggregate occlusion effects

33 D33 Summary General occlusion culling algorithms:General occlusion culling algorithms: –Hierarchical Z-buffer: A simple, truly elegant algorithm A simple, truly elegant algorithm But doesn’t seem amenable to hardware But doesn’t seem amenable to hardware –Hierarchical occlusion maps: More complicated, difficult to code & tune More complicated, difficult to code & tune Better suited to current hardware Better suited to current hardware Lends itself well to aggressive culling Lends itself well to aggressive culling Fairly high overhead, only worthwhile with high depth complexity Fairly high overhead, only worthwhile with high depth complexity –Promising trend in hardware


Download ppt "Visibility Culling David Luebke Computer Science Department University of Virginia"

Similar presentations


Ads by Google