1 / 17

Occlusion Culling

Occlusion Culling. Fall 2003 Ref: Gamasutra. Introduction. To cull : to "select from a flock “ The flock: the whole scene that we want to render the selection: limited to those portions of the scene that are not considered to contribute to the final image

nita
Télécharger la présentation

Occlusion Culling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Occlusion Culling Fall 2003 Ref: Gamasutra

  2. Introduction • To cull : to "select from a flock“ • The flock: the whole scene that we want to render • the selection: limited to those portions of the scene that are not considered to contribute to the final image • Culling is often achieved by using geometric calculations (e.g., frustum culling) but is in no way limited to these. • For example, an algorithm may also use the contents of the frame buffer.

  3. Occlusion Culling • the Z-buffer is not a very smart mechanism • try to cull away objects that are occluded, that is, inside the view frustum but not visible in the final image.

  4. The idea behind efficient occlusion culling algorithms is to perform some simple tests early on and so avoid sending data through much of the pipeline. 1.OcclusionCulling(G) 2: OR=empty3: for each object g in G4: if(isOccluded(g,OR))5: Skip(g)6: else7: Render(g)8: Update(OR,g)9: end10:end Occlusion Culling (cont)

  5. Hierarchical Visibility (HV) [Greene93] • maintains the scene model in an octree, and a frame's Z-buffer as an image pyramid, the Z-pyramid, the occlusion representation of this algorithm. • Octree generation: • Recursive process continues until each box contains fewer than the threshold number of primitives, or until the recursion has reached a specified deepest level • The construction of an octree takes too much time to be done at runtime, so this method is best suited for static models.

  6. each frame is rendered in approximately front-to-back order by calling the procedure ProcessOctreeNode with the root node of the octree. ProcessOctreeNode(OctreeNode N)2: if(isOccluded(NBV, ZP)) then return;3: for each primitive p in N4:   tileInto(p, ZP) 5: end6: for each child node C in N in front-to-back order7:   ProcessOctreeNode(C)8: end HV (cont)

  7. HV • Octree nodes that are outside the view frustum are culled away. • The first step determines whether the node's bounding box is visible with respect to the Z-pyramid. • To determine whether a node is visible, the front faces of its bounding box are tested against the Z-pyramid. The node is occluded if all of its front faces are occluded by the Z-pyramid.

  8. Otherwise, we render the primitives associated with the node into the Z-pyramid (tileInto in the pseudocode) and then process each of the node's children (if it has any) in front-to-back order using this same recursive procedure. HV

  9. HV (Z-pyramid) • The finest (highest-resolution) level of the Z-pyramid is simply a standard Z-buffer. At all other levels, each z-value is the farthest z in the corresponding 2x2 window of the adjacent finer level. Therefore each z-value represents the farthest z for a square region of the screen. • This is done recursively until the top of the image pyramid is reached, where only one z-value remains

  10. Hierarchical Occlusion Map (HOM) [Zhang97] • it can handle dynamic scenes • The test is divided into two parts: a one-dimensional depth test in the z-direction and a two-dimensional overlap test in the xy (projection) plane. The overlap test supports approximate visibility culling, where objects that "shine through" small holes in the occluders can be culled away using an opacity threshold parameter.

  11. HOM • For both tests, a set of potentially good occluders is identified before the scene is rendered, and the occlusion representation is built from these. • This step is followed by the rendering of the scene, where the occluders are rendered without an occlusion test. Then the rest of the scene is processed by having each object tested against the occlusion representation. If the object occluded by the occluder representation, it is not rendered

  12. HOM • The gray-scale values in the HOM are said to be the opacity of the pixels. A high opacity value (near white) for a pixel at a level above 0 means that most of the pixels it represents are covered by the HOM • The overlap test against the HOM starts by projecting the bounding volume of the object (e.g., OBB) to be tested onto the screen.This projection is then bounded by a rectangle, which is then compared against the HOM for overlap.

  13. HOM • The overlap test starts at the level in which the size of the pixel in the HOM is approximately the size of the rectangle. • Non-approximate culling • If all pixels in the rectangle are opaque, then the rectangle is occluded in the xy plane and the object is said to pass the test. On the other hand, if a pixel is not opaque, then the test for that pixel continues recursively to the subpixels in the HOM which are covered by the rectangle, meaning that the resolution of the occlusion maps increases with each test. • Approximate visibility culling • the pixels in the HOM are not compared to full opacity, i.e., white, but rather against an opacity threshold value, a gray-scale value. The lower the threshold value, the more approximate the culling.

  14. HOM • The depth estimation buffer is built for each frame. During rendering, to test whether an object passes the depth test (i.e., whether it is behind the occluders) the z-value of the nearest vertex of its bounding box is computed. This value is compared against the z-values of all regions in the depth estimation buffer that the bounding box rectangle covers in screen space.

  15. HOM • For an object to be occluded, it must thus first pass the overlap test; i.e., the rectangle of the projected bounding volume of the object must pass the HOM test. Then it must pass the depth test, i.e., it must be behind the occluders. If an object passes both tests, the object is occluded and is not rendered

  16. At runtime, occluders are selected from the database Only objects inside the view frustum are selected They are selected with respect to their distance from the viewer and to their size. Occluder Selection Strategy

  17. HOM • The number of occluders can vary during runtime using an adaptive scheme • For extremely dense scenes, i.e., those with high depth complexity, the HOM algorithm was able to cull away between about 50% and 95% of the scene

More Related