Title: Level of Detail Generating LODs CS 446: Real-Time Rendering
1Level of DetailGenerating LODs CS 446
Real-Time Rendering Game Technology
- David Luebke
- University of Virginia
2Demo
- Today Brad Wells
- Thursday Stephen Lawrence
3But first
- Unstructured Lumigraph Rendering
- Buehler, C., Bosse, M., McMillan, L., Gortler,
S., and Cohen, M., SIGGRAPH 2001 - Generalizes formalizes use of geometric proxies
in light field reconstruction
4Recap The Big Question
- How should we evaluate and regulate the visual
fidelity of our simplifications?
5Recap Measuring Fidelity
- Fidelity of a simplification to the original
model is often measured geometrically
METRO by Visual Computing Group, CNR-Pisa
6Recap Measuring Error
- Most LOD algorithms measure error geometrically
- What is the distance between the original and
simplified surface? - What is the volume between the surfaces?
- Etc
- Really this is just an approximation to the
actual visual error, which includes - Color, normal, texture distortion
- Importance of silhouettes, background
illumination, semantic importance, etc.
7Measuring Visual Error
- Measuring error
- Image-based ideas
- Lindstrom Turk, SIGGRAPH 2000
- Perceptually-based ideas
- Luebke Hallen, EGRW 2001
- Williams, Luebke, Cohen, Kelley Schubert, I3D
2003
8Generating LODs
- Next topic generating LODs
- Several subtopics
- Simplification operator (polygon elision mech)
- Cell collapse
- Vertex removal
- Edge collapse
- Simplification algorithm (high-level approach)
- Measuring error
- Hausdorff distance
- Quadrics
9Generating LODs
- Simplification operator
- Cell collapse
- Vertex removal
- Edge collapse
- Full edge collapse
- Half edge collapse
- Vertex-pair merge a.k.a. virtual edge collapse
10Generating LODs
- Simplification operator
- Cell collapse
- Vertex removal
- Edge collapse
- Full edge collapse
- Better fidelity (show why)
- Half edge collapse
- Less memory
- Sort vertices, tris into VAR array for fast
rendering - Vertex-pair merge a.k.a. virtual edge collapse
- Merge separate objects
11Measuring Geometric Error
- Measuring error
- Hausdorff distance
- One-sided
- Two-sided
- Common approximations
- Measure vertex-vertex distance, vertex-plane
distance - METRO Sample H(A,B) by sprinkling points on
triangles - Quadric Error Metrics a variation of
vertex-plane distance that works well in practice
12Edge Collapse Algorithm
V2
V2
Collapse
V1
13Edge Collapse Benefits
- Edge collapse operation is simple
- Supports non-manifold topology
14Edge Collapse vs. Vertex-Pair Merging
- Even better vertex-pair merging merges two
vertices that - Share an edge, or
- Are within some threshold distance t
- Q What does vertex-pair merging enable over edge
collapse?
15Quadric Error Metric
- Minimize distance to all planes at a vertex
- Plane equation for each face
v
0
p
D
Cz
By
Ax
ù
é
x
ú
ê
y
T
v
p
D
C
B
A
z
ú
ê
û
ë
1
16Squared Distance At a Vertex
17Quadric Derivation (contd)
- ppT is simply the plane equation squared
ù
é
2
AD
AC
AB
A
ú
ê
2
BD
BC
B
AB
ú
ê
T
pp
ú
ê
2
CD
C
BC
AC
ú
ê
2
D
CD
BD
AD
û
ë
- The ppT sum at a vertex v is a matrix, Q
18Using Quadrics
- Construct a quadric Q for every vertex
v2
v1
The edge quadric
Q2
Q1
Q
Q
Q
Q
2
1
- Sort edges based on edge cost
- Suppose we contract to v1
- v1s new quadric is simply
T
Qv
v
cost
edge
1
1
Q
19Optimal Vertex Placement
- Each vertex has a quadric error metric Q
associated with it - Error is zero for original vertices
- Error nonzero for vertices created by merge
operation(s) - Minimize Q to calculate optimal coordinates for
placing new vertex - Details in paper
- Requires inverting Q
- Authors claim 40-50 less error
20Boundary Preservation
- To preserve important boundaries, label edges as
normal or discontinuity - For each face with a discontinuity, a plane
perpendicular intersecting the discontinuous edge
is formed. - These planes are then converted into quadrics,
and can be weighted more heavily with respect to
error value.
21Preventing Mesh Inversion
- Preventing foldovers
- Calculate the adjacent face normals, then test if
they would flip after simplification - If so, that simplification can be weighted
heavier or disallowed.
7
8
2
10
A
6
9
3
merge
1
5
4
22Quadric Error Metric
- Pros
- Fast! (bunny to 100 polygons 15 sec in 1997)
- Good fidelity even for drastic reduction
- Robust -- handles non-manifold surfaces
- Aggregation -- can merge objects
23Quadric Error Metric
- Cons
- Introduces non-manifold surfaces(bug or
feature?) - Tweak factor t is ugly
- Too large O(n2) running time
- Correct value varies with model density
- Needs further extension to handle color
- Garland Heckbert 7x7 matrices for XYZRGB, etc
- Hoppe separate matrices for color, texcoords, etc
24View-Dependent LOD Algorithms
- Many good published algorithms
- Progressive Meshes by Hoppe SIGGRAPH 96,
SIGGRAPH 97, - Hierarchical Dynamic Simplification by Luebke
Erikson SIGGRAPH 97 - Multitriangulation by DeFloriani et al
- Others
25Overview The VDS Algorithm
- Ill describe (surprise) my own work
- Algorithm VDS Implementation VDSlib
- Similar in concept to most other algorithms
26Overview The VDS Algorithm
- Overview of the VDS algorithm
- A preprocess builds the vertex hierarchy, a
hierarchical clustering of vertices - At run time, clusters appear to grow and shrink
as the viewpoint moves - Clusters that become too small are collapsed,
filtering out some triangles
27Data Structures
- The vertex hierarchy
- Represents the entire model
- Hierarchy of all vertices in model
- Queried each frame for updated scene
- The active triangle list
- Represents the current simplification
- List of triangles to be displayed
- Triangles added and deleted by operations on
vertex tree
28The Vertex Hierarchy
- Each node in vertex hierarchy supports a subset
of the model vertices - Leaf nodes support a single vertex from the
original full-resolution model - The root node supports all vertices
- For each node we also assign a representative
vertex or proxy
29The Vertex TreeFolding And Unfolding
- Folding a node collapses its vertices to the
proxy - Unfolding the node splits the proxy back into
vertices
Fold Node A
Unfold Node A
30Vertex Tree Example
8
7
R
2
D
E
10
6
9
3
A
B
C
10
3
1
1
2
7
4
5
6
8
9
5
4
Vertex hierarchy
Triangles in active list
31Vertex Tree Example
8
7
R
A
2
D
E
10
6
9
3
A
B
C
10
3
1
1
2
7
4
5
6
8
9
5
4
Vertex hierarchy
Triangles in active list
32Vertex Tree Example
8
R
A
D
E
10
6
9
3
B
C
10
3
A
1
2
7
4
5
6
8
9
5
4
Vertex hierarchy
Triangles in active list
33Vertex Tree Example
8
R
A
D
E
10
6
9
3
B
C
10
3
A
B
1
2
7
4
5
6
8
9
5
4
Vertex hierarchy
Triangles in active list
34Vertex Tree Example
8
R
A
D
E
10
9
3
C
10
3
A
B
B
1
2
7
4
5
6
8
9
Vertex hierarchy
Triangles in active list
35Vertex Tree Example
8
R
A
C
D
E
10
9
3
C
10
3
A
B
B
1
2
7
4
5
6
8
9
Vertex hierarchy
Triangles in active list
36Vertex Tree Example
R
A
C
D
E
10
3
10
3
A
B
C
B
1
2
7
4
5
6
8
9
Vertex hierarchy
Triangles in active list
37Vertex Tree Example
R
A
E
C
D
E
10
3
10
3
A
B
C
B
1
2
7
4
5
6
8
9
Vertex hierarchy
Triangles in active list
38Vertex Tree Example
R
A
E
D
E
10
C
10
3
A
B
B
1
2
7
4
5
6
8
9
Vertex hierarchy
Triangles in active list
39Vertex Tree Example
R
A
D
E
D
E
10
C
10
3
A
B
B
1
2
7
4
5
6
8
9
Vertex hierarchy
Triangles in active list
40Vertex Tree Example
R
D
E
D
E
A
C
10
3
B
B
1
2
7
4
5
6
8
9
Vertex hierarchy
Triangles in active list
41Vertex Tree Example
R
D
E
D
E
R
A
C
10
3
B
B
1
2
7
4
5
6
8
9
Vertex hierarchy
Triangles in active list
42Vertex Tree Example
R
D
E
R
A
B
C
10
3
1
2
7
4
5
6
8
9
Vertex hierarchy
Triangles in active list
43The Vertex Tree
- At runtime, folds and unfolds create a cut or
boundary across the vertex tree
This part of the modelis represented at high
detail
This part in low detail
44The Vertex TreeLivetris and Subtris
- Two categories of triangles affected
8
7
Fold Node A
2
10
6
9
3
1
Unfold Node A
5
4
Node-gtSubtris triangles that disappear upon
folding Node-gtLivetris triangles that just
change shape
45The Vertex TreeLivetris and Subtris
- The key observation
- Each nodes subtris can be computed offline to be
accessed quickly at run time - Each nodes livetris can be maintained at run
time, or lazily evaluated upon rendering
46View-Dependent Simplification
- Any run-time criterion for folding and unfolding
nodes may be used - Examples of view-dependent simplification
criteria - Screenspace error threshold
- Silhouette preservation
- Triangle budget simplification
- Gaze-directed perceptual simplification
47Screenspace Error Threshold
- Nodes chosen by projected area
- User sets screenspace size threshold
- Nodes which grow larger than threshold are
unfolded
48Silhouette Preservation
- Retain more detail near silhouettes
- A silhouette node supports triangles on the
visual contour - Use tighter screenspace thresholds when examining
silhouette nodes
49Triangle Budget Simplification
- Minimize error within specified number of
triangles - Sort nodes by screenspace error
- Unfold node with greatest error, putting children
into sorted list - Repeat until budget is reached
50View-Dependent CriteriaOther Possibilities
- Specular highlights Xia describes a fast test to
unfold likely nodes - Surface deviation Hoppe uses an elegant surface
deviation metric that combines silhouette
preservation and screenspace error threshold
51View-Dependent CriteriaOther Possibilities
- Sophisticated surface deviation metrics
- Sophisticated perceptual criteria
- Sophisticated temporal criteria
52Implementing VDS Optimizations
- Asynchronous simplification
- Parallelize the algorithm
- Exploiting temporal coherence
- Scene changes slowly over time
- Maintain memory coherent geometry
- Optimize for rendering
- Support for out-of-core rendering
53Asynchronous Simplification
- Algorithm partitions into two tasks
- Run them in parallel
Render Task
Simplify Task
Active Triangle List
Vertex Tree
54Asynchronous Simplification
- If S time to simplify, R time to render
- Single process (S R)
- Pipelined max(S, R)
- Asynchronous R
- The goal efficient utilization of GPU/CPU
- e.g., NV_FENCE extension for asynchronous
rendering
55Temporal Coherence
- Exploit the fact that frame-to-frame changes are
small - Three examples
- Active triangle list
- Vertex tree
- Budget-based simplification
56Exploiting Temporal Coherence
- Active triangle list
- Could calculate active triangles every frame
- Butfew triangles are added or deleted each
frame - Idea make only incremental changes to an active
triangle list - Simple approach doubly-linked list of triangles
- Better maintain coherent arrays with swapping
57Exploiting Temporal Coherence
- Vertex Tree
- Few nodes change per frame
- Dont traverse whole tree
- Do local updates only at boundary nodes
UnfoldedNodes
Boundary Nodes
58Temporal CoherenceTriangle Budget Simplification
- Exploiting temporal coherence in budget-based
simplification - Introduced by ROAM Duchaineau 97
- Start with tree from last frame, recalculate
error for relevant nodes - Sort into two priority queues
- One for potential unfolds, sorted on max error
- One for potential folds, sorted on min error
59Temporal CoherenceTriangle Budget Simplification
- Then simplify
- While budget is met, unfold max node
- This is the node whose folding has created the
most error in the model - While budget is exceeded, fold min node
- This is the node that introduces the least error
when folded - Insert parents and children into queues
- Repeat until errormax lt errormin
60Optimizing For Rendering
- Idea maintain geometry in coherent arrays
61Optimizing For Rendering
- Idea use swaps to maintain coherence
Unfolded nodes
Inactive nodes
Boundary nodes
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
Fold node D
62Optimizing For Rendering
- Idea use swaps to maintain coherence
Unfolded nodes
Inactive nodes
Boundary nodes
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
Fold node D Swap D with F
63Optimizing For Rendering
- Idea use swaps to maintain coherence
Unfolded nodes
Inactive nodes
Boundary nodes
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
Fold node D Swap D with F
64Optimizing For Rendering
- Idea use swaps to maintain coherence
Unfolded nodes
Inactive nodes
Boundary nodes
A
B
C
F
E
D
G
H
I
J
K
L
M
N
O
P
Q
Fold node D Swap D with F
65Optimizing For Rendering
- Idea use swaps to maintain coherence
Unfolded nodes
Inactive nodes
Boundary nodes
A
B
C
F
E
D
G
H
I
J
K
L
M
N
O
P
Q
Fold node D Move Unfolded/Boundary Marker
66Optimizing For Rendering
- Idea use swaps to maintain coherence
Unfolded nodes
Inactive nodes
Boundary nodes
A
B
C
F
E
D
G
H
I
J
K
L
M
N
O
P
Q
Fold node D Deactivate Ds children (swap w/
last boundary node)
67Optimizing For Rendering
- Idea use swaps to maintain coherence
Unfolded nodes
Inactive nodes
Boundary nodes
A
B
C
F
E
D
G
H
L
J
K
I
M
N
O
P
Q
Fold node D Deactivate Ds children (swap w/
last boundary node)
68Optimizing For Rendering
- Idea use swaps to maintain coherence
Unfolded nodes
Inactive nodes
Boundary nodes
A
B
C
F
E
D
G
H
L
J
K
I
M
N
O
P
Q
Fold node D Deactivate Ds children (swap w/
last boundary node)
69Optimizing For Rendering
- Idea use swaps to maintain coherence
Unfolded nodes
Inactive nodes
Boundary nodes
A
B
C
F
E
D
G
H
L
J
K
I
M
N
O
P
Q
Fold node D Deactivate Ds children (swap w/
last boundary node)
70Optimizing For Rendering
- Idea use swaps to maintain coherence
Unfolded nodes
Inactive nodes
Boundary nodes
A
B
C
F
E
D
G
K
L
J
H
I
M
N
O
P
Q
Fold node D Deactivate Ds children (swap w/
last boundary node)
71Optimizing For Rendering
- Idea use swaps to maintain coherence
Unfolded nodes
Inactive nodes
Boundary nodes
A
B
C
F
E
D
G
K
L
J
H
I
M
N
O
P
Q
Fold node D Deactivate Ds children (swap w/
last boundary node)
72Optimizing For RenderingVertex Arrays
- Biggest win vertex arrays
- Actually, keep separate parallel arrays for
rendering data (coords, colors, etc)
Unfolded nodes
Inactive nodes
Boundary nodes
Vertex array!
73Optimizing For RenderingVertex Arrays on
GeForce2
74Out-of-core Rendering
- Coherent arrays lend themselves to out-of-core
simplification and rendering
These need to be in memory
These do not
75Out-of-core Rendering
- Coherent arrays lend themselves to out-of-core
simplification and rendering - Only need active portions of triangle and node
arrays - Implement arrays as memory-mapped files
- Let virtual memory system manage paging
- A prefetch thread walks boundary nodes, bringing
their children into memory to avoid glitches
76Summary VDS Pros
- Supports drastic simplification!
- View-dependent handles the Problem With Large
Objects - Hierarchical handles the Problem With Small
Objects - Robust does not require (or preserve) mesh
topology
77Summary VDS Pros
- Rendering can be implemented efficiently using
vertex arrays - Supports rendering of models much larger than
main memory
78Summary VDS Cons
- Increases CPU, memory overhead
- Hard to map efficiently onto GPU for efficient
utilization
79Summary VDS Cons
- Be aware of mesh foldovers
7
8
2
10
6
9
3
1
5
4
80Summary VDS Cons
- Be aware of mesh foldovers
7
8
2
10
A
6
9
3
1
5
4
81Summary VDS Cons
- Be aware of mesh foldovers
8
2
10
A
6
9
3
5
4
82Summary VDS Cons
- Be aware of mesh foldovers
- These can be very distracting artifacts
- Can prevent them at run-time
- Add a normal-flipping test to fold criterion
- Use a clever numbering scheme proposed by El-Sana
and Varshney
83View-Dependent Versus Discrete LOD
- View-dependent LOD is superior to traditional
discrete LOD when - Models contain very large individual objects
(e.g., terrains) - Simplification must be completely automatic
(e.g., complex CAD models) - Experimenting with view-dependent simplification
criteria
84View-Dependent Versus Discrete LOD
- Discrete LOD is often the better choice
- Simplest programming model
- Reduced run-time CPU load
- Easier to leverage hardware
- Compile LODs into vertex arrays/display lists
- Stripe LODs into triangle strips
- Optimize vertex cache utilization and such
85View-Dependent Versus Discrete LOD
- Applications that may want to use
- Discrete LOD
- Video games (but much more on this later)
- Simulators
- Many walkthrough-style demos
- Dynamic and view-dependent LOD
- CAD design review tools
- Medical scientific visualization toolkits
- Terrain flyovers (a whole topic unto itself)
86Continuous LOD The Sweet Spot?
- Continuous LOD may be the right compromise on
modern PC hardware - Benefits of fine granularity without the cost of
view-dependent evaluation - Can be implemented efficiently with regard to
- Memory
- CPU
- GPU
87VDSlib
- Implementation VDSlib
- A public-domain view-dependent simplification and
rendering package - Flexible C interface lets users
- Construct vertex trees for objects or scenes
- Specify with callbacks how to simplify, cull, and
render them - Available at http//vdslib.virginia.edu
88GLOD
- An easy-to-use library for level of detail in
OpenGL - LOD generation
- LOD run-time management
- View-dependent LOD (using VDSlib)
- http//www.cs.jhu.edu/graphics/GLOD
89VDSlibOngoing Work
- Various research projects that have used VDSlib
- Out-of-core LOD for interactive rendering of
truly massive models - Perceptually-guided view-dependent LOD, including
gaze-directed techniques - Non-photorealistic rendering using VDSlib as a
framework