Visibility Culling - PowerPoint PPT Presentation

visibility culling n.
Skip this Video
Loading SlideShow in 5 Seconds..
Visibility Culling PowerPoint Presentation
Download Presentation
Visibility Culling

play fullscreen
1 / 149
Download Presentation
Visibility Culling
Download Presentation

Visibility Culling

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Visibility Culling Roger A. Crawfis CIS 781 The Ohio State University

  2. Interactive Frame Rates Are Difficult To Achieve

  3. The Problem • Two keys for an interactive system • Interactive rendering speed: too many polygons – difficult!! • Uniform frame rate: varied scene complexity – difficult!!

  4. Possible Solutions • Visibility Culling – back face culling, frustum culling, occlusion culling (might not be sufficient) • Levels of Detail (LOD) – hierarchical structures and choose one to satisfy the frame rate requirement

  5. LOD Selections How to pick the Optimal ones??!!

  6. Occlusion Culling • Hidden Surface Removal methods are not fast enough for massive models on current hardware • Occlusion Culling avoids rendering primitives that are occluded by another part of the scene • Occlusion Culling techniques are ideally output sensitive – runtime is proportional to the size of exact visibility set

  7. Related Work • Hierarchical Z-Buffer • Image space occlusion culling method [Greene’93] • Build a layered Z-pyramid with a different resolution of the Z-buffer at each level • Allows quick accept/reject • Hierarchical LODs • Simplification Culling : Approximate entire branch of the scene graph by an HLOD • Can we use HLODs as occluders/occludees?

  8. Visibility in Games • What do we need it for? • Increase of rendering speed by removing unseen scene data from the rendering pipeline as early as possible • Reduction of data transfers to the graphics hardware • Current games would not be possible without visibility calculations

  9. Visibility methods • 2 very different categories: • Visibility from a region (Portals, PVS) • (Quake, Unreal, Severance and co.) • Visibility from a point (Z-Buffer, BFC,...) • Racing games, outdoor scenes, sports games etc.

  10. Point-Visibility Occlusion • Traditionally used: • Back-Face culling • Z-Buffering • View frustum culling • Octree • Quadtree

  11. A PSX Example • Iron Soldier 3 on PSX: • View frustum culling based on a quad-tree • Back-face culling • Painters algorithm Only culling to the leftand right sides of theviewing frustum.

  12. New Occlusion Methods • Image-space occlusion culling • Hierarchical Z-Buffering • Hierarchical Occlusion Maps • Object-space occlusion culling • Hierarchical View Frustum culling • Hierarchical Back-Face culling

  13. Visibility Culling • We will look at these: • Hierarchical Back-face culling • View-frustum culling • Occlusion culling • Detail culling

  14. Hierarchical Back-Face Culling • Partitions each model into clusters • Primitives in one cluster are: • Facing into similar directions • Lie close to each other • If the cluster fails the visibility test, all primitives in this cluster are culled

  15. Hierarchical Back-Face Culling

  16. Normal Maps • Create a data structure that places each polygon in the space according to its normal direction. • Partition this space and then simply look at those partitions that might have visible polygons. phi theta

  17. Construct bounding • volumes (BVs) • Create hierarchy • BV/V-F intersection • tests View-Frustum Culling • Remove objects that are outside the viewing frustum Mostly done in “Application Stage”

  18. View-Frustum Culling • Culling against bounding volumes to save time • Bounding volumes – AABB, OBB, Spheres, etc. – easy to compute, as tight as possible Sphere OBB AABB

  19. View-Frustum Culling • Often done hierarchically to save time In-order, top-down traversal and test

  20. View-Frustum Culling • Two popular hierarchical data structures – BSP Tree and Octree Axis-Aligned BSP Polygon-Aligned BSP Intersecting?

  21. View-Frustum Culling • Octree • A parent has 8 childrens • Subdivide the space until the • number of primitives within • each leaf node is less than a • threshold • In-order, top-down traversal

  22. Hierarchical Z-Buffer • Z-Buffer is arranged in an image pyramid. • Scene is partitioned in an octree. • Octree nodes are tested against the Z-Pyramid where pixels have the same size. • Visible nodes serve as input for the next frame. • Relies on HW visibility query.

  23. HZB/Hierarchical occlusion maps

  24. Hierarchical occlusion maps • Potential occluders are pre-selected • These occluders are rendered to the occlusion map. The hierarchy can be built with MIP-Mapping HW • Depth test after occlusion test • Separate depth estimation buffer

  25. Hierarchical View Frustum Culling • Speeds up VFC by testing only 2 box corners of a bounding box first. • Plane coherency during frame advancing • Test against VF-octants. • BB-Child masking

  26. Detail Culling • A technique that sacrifices quality for speed • Base on the size of projected BV – if it is too small, discard it. • Also often done hierarchically. Always helps to create a hierarchical structure, or scene graph.

  27. Occlusion Culling • Discard objects that are occluded • Z-buffer is not the smartest algorithm in the world (particularly for high depth- complexity scenes) • We want to avoid the processing of invisible objects

  28. Occlusion Culling • G: input graphics data • Or: occlusion representation • The problem: • algorithms for isOccluded() • Fast update Or OcclusionCulling (G) Or = empty For each object g in G if (isOccluded(g, Or)) skip g else render (g) update (Or) end End

  29. Hierarchical Visibility • Object-space octree • Primitives in a octree node are hidden if the octree node (cube) is hidden • A octree cube is hidden if its 6 faces are hidden polygons • Hierarchical visibility test:

  30. Hierarchical Visibility (obj-sp.) From the root of octree: • View-frustum culling • Scan conversion each of the 6 faces and perform z-buffering • If all 6 faces are hidden, discard the entire node and sub-branches • Otherwise, render the primitives here and traverse the front-to-back children recursively A conservative algorithm – why?

  31. Hierarchical Visibility (obj-sp.) • Scan conversion the octree faces can be expensive – cover a large number of pixels (overhead) • How can we reduce the overhead? • Goal: quickly conclude that a large polygon is hidden • Method: use hierarchical z-buffer !

  32. Hierarchical Z-buffer An image-space approach • Create a Z-pyramid 1 value ¼ resolution ½ resolution Original Z-buffer

  33. 1 0 6 0 3 1 2 • 6 9 3 9 1 2 9 2 9 1 2 2 Hierarchical Z-buffer (2) Keep the maximum value

  34. Hierarchical Z-buffer update Visibility (OctreeNode N) if (isOccluded (N, Zp) then return; for each primitive p in N render and update Zp end for each child node C of N in front-to-back order Visibility ( C ) end

  35. Some Practical Issues • A fast software algorithm • Lack of hardware support • Scan conversion • Efficient query of if a polygon is visible (without render it) • Z feedback

  36. Combining with hardware • Utilizing frame-to-frame coherence • First frame – regular HZ algorithm (software) • Remember the visible octree nodes • Second frame (view changes slightly) • Render the previous visible nodes using OpenGL • Read back the Z-buffer and construct Z-pyramid • Perform regular HZ (software) • What about the third frame? • Utilizing hardware to perform rendering and Z-buffering – considerably faster

  37. Hierarchical Occlusion Map Zhang et al SIGGRAPH 98

  38. Basic Ideas • Choose a set of graphics objects from the scene as Occluders • Use the occluders to define an Occlusion Map (hierarchically) • Compare the rest of scene against the occlusion map

  39. Example Blue: Occluders Red: Occludees

  40. Occluder Viewing Frustum Occluder Rendering Database Culling Selection Build Occlusion Map Hierarchy Real Viewing Frustum Occlusion Test Scene Culling Algorithm Pipeline

  41. 2-Step Occlusion Test • Overlap Test • Overlap Test Overlap + Depth = Occlusion

  42. Why decomposition? • The occlusion test is done approximately (conservatively) • We can afford to be more conservative in depth test than overlap test

  43. Why Decomposition?

  44. Overlap Test – Occlusion Map • Representation of projection for overlap test: occlusion map • A gray scale image – each pixel represents one block of screen region • Generate by rendering occluders

  45. Occlusion Map (OM) • Each pixel of the occlusion map has an opacity, which represents the ratio of the sum of the opaque areas in the block to the total area. • If fully covered, p= 1, if anti-alised pixel, p <1) • Occlusion map: the alpha channel of an image

  46. Overlap Test using OM For each potential occludee, we can scan-convert it and compare against the opacity of the pixels it overlaps Expensive!! • Conservative Approximation: use the screen-space • bounding box of the occludee (a superset of the actual • covered pixels) • If all the pixels inside the bounding box are opaque, • the object is occluded.

  47. Hierarchical Occlusion Map Like hierarchical Z-buffer, we can create a hierachy to speed up the comparison (for large objects) The low resolution pixel is an average of the high resolution pixels

  48. Overlap Test using HOM Basic Algorithm • Start from the lowest resolution • If the pixel cover the bounding • rectangle has a value 1, • the object is occluded • Otherwise traverse down the • hierarchy: • If all children =1: occluded • If all children =0; not occluded • Otherwise, traverse down further

  49. Approximate Overlap Test • Instead of concluding an object is occluded only when the bounding box is within pixels with opacity 1, we can use an threshold between [0,1] • Early termination in the high level of the hierarchy • What does it mean when a block has high opacity but not one? This is the unique feature of HOM !!