CS 551/651: Visibility Culling David Luebke

advertisement
CS 551/651:
Visibility Culling
David Luebke
cs551dl@cs.virginia.edu
http://www.cs.virginia.edu/~cs551dl
DPL
7/27/2016
Administrivia

DPL
Hand back midterm for real
7/27/2016
Recap

Algorithms for interactive rendering
– Level of detail
– Texture tricks
– Visibility culling

Idea: don’t render what can’t be
seen
– Off-screen: view-frustum culling
– Z-buffered away: occlusion culling
DPL
7/27/2016
Recap

Potentially Visible Set (PVS)
– Conservative overestimate of visible
polygons
– Usually done by clumping polygons,
then deciding potential clump visibility
with some fast test
– Similar to hierarchical bounding volume
or spatial partition schemes for ray
tracing
DPL
7/27/2016
Visibility Culling
First approach: view-frustum culling
(Clark 76)
 Occlusion culling

– Architectural environments (cells and
portals)
– General occlusion culling (trees in a
forest)
DPL
7/27/2016
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…

DPL
Key observation: cells only see each
other through portals!
7/27/2016
Cells & Portals

Idea:
– 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
Need a line of sight
 So cell visibility reduces to testing portal
sequences…

DPL
7/27/2016
Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
F
G
H
DPL
7/27/2016
Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
F
G
H
DPL
7/27/2016
Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
F
G
H
DPL
7/27/2016
Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
F
G
H
DPL
7/27/2016
Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
F
G
H
DPL
7/27/2016
Cells & Portals

View-independent solution: figure out
which cells a particular cell will never see:
E
A
D
B
F
C
G
H
Ex: H will never see F; B can only see H

DPL
Can also figure out all possible cells that
could be seen from a particular cell
7/27/2016
Cells and Portals

Discussion:
– Q: How might you detect whether a cell
is visible?
– Q: How might you detect viewindependent visibility between cells?

DPL
Notice: these problems reduce to
eye-portal and portal-portal visibility
7/27/2016
Cells and Portals

Airey (1990): view-independent
– Slow preprocess
– Bit of a kludge; somewhat inaccurate
– Order-of-magnitude speedups

Portal-portal visibility determined by
ray-casting (draw it)
– Q: What’s wrong with this technique?
– PVS of cells stored and rendered on
per-cell basis
DPL
7/27/2016
Cells and Portals

(Teller 1993): view-independent +
view-dependent
– Slow preprocess
– Elegant, exact scheme

Portal-portal visibility calculated by
line stabbing (draw it)
– Cell-cell vsibility stored in stab trees
– View-dependent eye-portal visibility
stage further refines PVS
DPL
7/27/2016
Cells and Portals

Luebke (1995): view-dependent
– No preprocess (integrate w/ modeling)
– Quick, simple hack
– Public-domain library: pfPortals
DPL
7/27/2016
pfPortals

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

DPL
Kept implicitly on recursion stack
7/27/2016
pfPortals

Recursively rendering cells while
clipping to portal boundaries not new
– Visible-surface algorithm (Jones 1971):
general polygon-polygon clipping

Expensive, complicated
– Conservative overestimate (pfPortals):
use portal’s cull box
Cull box = x-y screenspace bounding box
 Cheap to compute, very cheap to intersect

DPL
7/27/2016
pfPortals
Q: How badly does the cull box
approximation overestimate PVS?
 Q: How to represent and intersect
cull boxes?
 Note: Can implement mirrors as
portals with an extra transformation!

– Some clipping & Z-buffering issues
DPL
7/27/2016
pfPortals
Show pictures (web page)
 Show video

DPL
7/27/2016
Creating Cells and Portals

Q: Given a model, how might you
extract the cells and portals?
– Airey: k-D tree (axis-aligned cells)
– Teller: BSP tree (general convex cells)
– Luebke: modeler (any cells at all)

Problems and issues
– Running time
– Free cells
– Intra-wall cells
DPL
7/27/2016
Outlook
Imagine creating cells and portals for
a forest environment…
 Next up: general occlusion culling
using the hierarchical Z-buffer

DPL
7/27/2016
Download