Occlusion Culling - PowerPoint PPT Presentation

1 / 38
About This Presentation
Title:

Occlusion Culling

Description:

Transparent portals connect cells. Doorways, entrances, windows... A cell is only visible if it can be seen through a sequence of portals ... – PowerPoint PPT presentation

Number of Views:98
Avg rating:3.0/5.0
Slides: 39
Provided by: davidl9
Category:

less

Transcript and Presenter's Notes

Title: Occlusion Culling


1
Occlusion Culling
  • David Luebke
  • University of Virginia

2
Cells Portals
  • Goal walk through architectural models
    (buildings, cities, catacombs)
  • These divide naturally into cells
  • Rooms, alcoves, corridors
  • Transparent portals connect cells
  • Doorways, entrances, windows
  • Notice cells only see other cells through portals

3
Cells Portals
  • An example

4
Cells Portals
  • Idea
  • Cells form the basic unit of PVS
  • Create an adjacency graph of cells
  • Starting with cell containing eyepoint, traverse
    graph, rendering visible cells
  • A cell is only visible if it can be seen through
    a sequence of portals
  • So cell visibility reduces to testing portal
    sequences for a line of sight

5
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
6
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
7
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
8
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
9
Cells Portals
A
D
E
F
C
B
G
H
E
A
B
C
D
F
G
H
10
Cells Portals
A
D
E
?
F
C
B
G
H
E
A
B
C
D
F
G
?
H
11
Cells Portals
A
D
E
X
F
C
B
G
H
E
A
B
C
D
F
G
X
H
12
Cells Portals
  • View-independent solution find all cells a
    particular cell could possibly see
  • C can only see A, D, E, and H

A
D
E
H
13
Cells Portals
  • View-independent solution find all cells a
    particular cell could possibly see
  • H will never see F

A
D
E
C
B
G
14
Cells and Portals
  • Questions
  • How can we detect whether a given cell is visible
    from a given viewpoint?
  • How can we detect view-independent visibility
    between cells?
  • The key insight
  • These problems reduce to eye-portal and
    portal-portal visibility

15
Cells and Portals History
  • Airey (1990) view-independent only
  • Portal-portal visibility determined by
    ray-casting
  • Non-conservative portal-portal test resulted in
    occasional errors in PVS
  • Slow preprocess
  • Order-of-magnitude speedups

16
Cells and Portals History
  • Teller (1993) view-independent view-dependent
  • Portal-portal visibility calculated by line
    stabbing using linear program
  • Cell-cell visibility stored in stab trees
  • View-dependent eye-portal visibility stage
    further refines PVS at run time
  • Slow preprocess
  • Elegant, exact scheme

17
Cells and Portals History
  • Luebke (1995) view-dependent only
  • Eye-portal visibility determined by intersecting
    portal cull boxes
  • No preprocess (integrate w/ modeling)
  • Quick, simple hack
  • Public-domain library pfPortals

18
pfPortals Algorithm
  • Depth-first adjacency graph traversal
  • Render cell containing viewer
  • Treat portals as special polygons
  • If portal is visible, render adjacent cell
  • But clip to boundaries of portal!
  • Recursively check portals in that cell against
    new clip boundaries (and render)
  • Each visible portal sequence amounts to a series
    of nested portal boundaries
  • Kept implicitly on recursion stack

19
pfPortals Algorithm
  • Recursively rendering cells while clipping to
    portal boundaries not new
  • Visible-surface algorithm (Jones 1971) general
    polygon-polygon clipping
  • Elegant, expensive, complicated
  • Conservative overestimate (pfPortals) use
    portals cull box
  • Cull box x-y screenspace bounding box
  • Cheap to compute, very cheap to intersect

20
pfPortals Algorithm
  • How badly does the cull box approximation
    overestimate PVS?
  • Not much for most architectural scenes
  • Note Can implement mirrors as portals with an
    extra transformation!
  • Some clipping Z-buffering issues
  • Must limit recursion

21
Cells and Portals Details
  • Usually separate model into occluders and detail
    objects
  • Occluders walls, floors
  • Detail objects desks, chairs, pencils
  • Cell creation process only accounts for occluders
    (Why?)
  • pfPortals find detail object visibility through
    portal sequences at run time
  • Teller also precompute into PVS

22
Why View-Independent?
  • If view-dependent techniques can often calculate
    a reasonable PVS fast enough, why bother finding
    view-independent PVS?
  • One good answer smart prefetching
  • Soda Hall walkthrough (Funkhouser)
  • Whole model doesnt fit in memory
  • Use Teller stab trees to load in only cells that
    might be visible

23
Creating Cells and Portals
  • Given a model, how might you extract the cells
    and portals?
  • Airey k-D tree (axis-aligned boxes)
  • Teller BSP tree (general convex cells)
  • Luebke modeler (any cells at all)
  • Problems and issues
  • Running time
  • Free cells
  • Intra-wall cells

24
Cells and Portals Discussion
  • Good solution for most architectural or urban
    models
  • Use the simplest algorithm that suffices for your
    needs
  • pfPortals-style algorithm view-dependent
    solution, reasonably tight PVS, no preprocess
    necessary (except partition)
  • Teller-style algorithm tighter PVS, somewhat
    more complex, can provide view-independent
    solution for prefetching

25
General Occlusion Culling
  • When cells and portals dont work
  • Trees in a forest
  • A crowded train station
  • Need general occlusion culling algorithms
  • Aggregate occlusion
  • Dynamic scenes
  • Non-polygonal scenes

26
General Occlusion Culling
  • Ill discuss two algorithms
  • Loose front-to-back sorting
  • Hierarchical Z-Buffer
  • Ned Greene, SIGGRAPH 93
  • Ill also describe current hardware support

27
Loose Front-To-Back Sorting
  • Can sort your geometry in roughly front-to-back
    order, e.g. by
  • Using an octree/BSP tree
  • Sorting centroids or near points of bounding
    volumes
  • Why would this help?
  • A Early rejection helps whole fragment pipeline
  • Why might this be hard?
  • A could conflict with sorting by render state

28
Image-SpaceOcclusion Culling
  • Most general occlusion culling algorithms use an
    image-space approach
  • Idea solve visibility in 2D, on the image plane

29
Hierarchical Z-Buffer
  • Replace Z-buffer with a Z-pyramid
  • Lowest level full-resolution Z-buffer
  • Higher levels each pixel represents the max
    depth of the four pixels underneath it
  • Basic idea hierarchical rasterization of the
    polygon, with early termination where polygon is
    occluded

30
Hierarchical Z-Buffer
  • Idea test polygon against highest level first
  • If polygon is further than distance recorded in
    pixel, stopits 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

31
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

32
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 (i.e., query the Z-pyramid)
  • If cube faces are occluded, ignore the entire node

33
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
    Z-pyramid already built
  • So start each frame by rendering octree nodes
    visible last frame

34
Hierarchical Z-BufferDiscussion
  • HZB needs hardware support to be really
    competitive
  • Hardware vendors havent entirely bought in
  • Z-pyramid (and hierarchies in general) unfriendly
    to hardware
  • Unpredictable Z-query times generate bubbles in
    rendering pipe
  • But something almost as good has emerged

35
Modern Occlusion Culling
  • Support from hardware would be nice
  • Want an occlusion test would this polygon be
    visible if I rendered it?
  • How could you use such a test?
  • Test portal polygons before rendering adjacent
    cell
  • Test object bounding boxes before rendering
    object
  • Yay! GL_HP_OCCLUSION_TEST extension
  • Problems
  • CPU/GPU synchronization bad
  • Might want to know how visible is the polygon

36
Modern Occlusion Culling
  • GL_NV_OCCLUSION_QUERY to the rescue
  • Non-blocking query
  • Is this occlusion query done yet?
  • Multiple queries in flight
  • Returns number of fragments visible
  • Note can actually render object or not
  • Supports object-space coherence, temporal
    coherence
  • Still lots of issues for efficient culling

37
111 uses for NV_OCCLUSION_QUERY
  • Occlusion culling (duh)
  • Others?
  • Approximate culling
  • LOD size estimation
  • Lens flare effects
  • Transparency
  • Collision detection (!)
  • Convergence testing

38
NV_OCCLUSION_QUERYDetails
  • Go to NVIDIA presentation
Write a Comment
User Comments (0)
About PowerShow.com