Download presentation source

Download Report

Transcript Download presentation source

CS 551 / 645:
Introductory Computer Graphics
Occlusion Culling Continued
David Luebke
7/27/2016
Administrivia

Go over assignment 4
David Luebke
7/27/2016
Recap: 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
David Luebke
7/27/2016
Recap: Cells & Portals

An example:
David Luebke
7/27/2016
Recap: 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

David Luebke
So cell visibility reduces to testing portal sequences for a
line of sight…
7/27/2016
Recap: Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
H
F
G
Recap: Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
H
F
G
Recap: Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
H
F
G
Recap: Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
H
F
G
Recap: Cells & Portals
E
A
D
B
F
C
G
H
A
B
E
C
D
H
F
G
Recap: Cells & Portals
E
A
D
B
C
?
F
G
H
A
B
E
C
D
?
H
F
G
Recap: Cells & Portals
E
A
D
B
C
X
F
G
H
A
B
E
C
D
X
H
F
G
Recap: Cells & Portals

View-independent solution: find all cells a particular
cell could possibly see:
E
A
D
B
F
C
G
H
C can only see A, D, E, and H
Recap: Cells & Portals

View-independent solution: find all cells a particular
cell could possibly see:
E
A
D
B
F
C
H
H will never see F
G
Recap: 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 portalportal visibility
David Luebke
7/27/2016
Recap: Cells and Portals

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
David Luebke
7/27/2016
Cells and Portals

Teller (1993): view-independent + viewdependent
– 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
David Luebke
7/27/2016
Cells and Portals

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
David Luebke
7/27/2016
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

David Luebke
Kept implicitly on recursion stack
7/27/2016
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
portal’s cull box


David Luebke
Cull box = x-y screenspace bounding box
Cheap to compute, very cheap to intersect (constant
time)
7/27/2016
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
David Luebke
7/27/2016
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
David Luebke
7/27/2016
Why View-Independent?


If view-dependent techniques can often
calculate a reasonable PVS fast enough, why
bother with view-independent solutions?
One good answer: smart prefetching
– Soda Hall walkthrough (Funkhouser)


David Luebke
Whole model doesn’t fit in memory
Use Teller stab trees to load in only cells that might be
visible
7/27/2016
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
David Luebke
7/27/2016
Cells and Portals:
Discussion

Good solution for most architectural or urban
models
– Use the simplest algorithm that suffices for your
needs:


David Luebke
pfPortals-style algorithm: view-dependent solution,
reasonably tight PVS, no preprocess necessary
Teller-style algorithm: tighter PVS, somewhat more
complex, can provide view-independent solution for
prefetching
7/27/2016
Cells and Portals:
Discussion

Public-domain code I’m aware of:
– pfPortals: http://pfPortals.virginia.edu

A very simple set of Performer callbacks that
implements cull-box portal culling
– pfWalkthru: http://home.earthlink.net/~mmchow/

Includes code to extract cells and portals
– Game engine sites


David Luebke
Lots of “level builders” and “level compilers”
Treat these with a grain of salt
7/27/2016
General Occlusion Culling

When cells and portals don’t work…
– Trees in a forest
– A crowded train station

Need general occlusion culling algorithms:
– Aggregate occlusion
– Dynamic scenes
– Non-polygonal scenes (?)
David Luebke
7/27/2016