CS 551/651: Simplification Continued David Luebke

advertisement
CS 551/651:
Simplification Continued
David Luebke
cs551dl@cs.virginia.edu
http://www.cs.virginia.edu/~cs551dl
DPL
7/27/2016
Assignment 3 Issues
Due Thursday morning (late week?)
 Matrix inversion code
 The .poly files

– How many floats/vertex?
– Max vertices/face?
– What’s wrong with the horse model?
Efficiently finding nearby vertices
 Other questions?

DPL
7/27/2016
Administrivia

Final: Test or Project
– Likely test: ~1.5 hours
– Likely project: particle-system OpenGL
eye candy

Opinions?
– Note: I reserve the right to ignore them
DPL
7/27/2016
Lecture Outline
Recap Quadric Error Metrics
 Finish up QEM
 Dynamic LOD

DPL
7/27/2016
Recap: Level of Detail
50 Vertices
500 Vertices
2000 Vertices
Model courtesy of InfoGraphica
DPL
7/27/2016
Recap: Creating LODs

Creating LODs
– Polygon elision mechanisms
Sampling
 Decimation
 Vertex-merging (edge-collapsing)
 Adaptive subdivision

– What criteria to guide simplification?
Visual/perceptual criteria are hard
 Geometric criteria are more common

DPL
7/27/2016
Recap: Vertex Clustering

Rossignac/Borrel: uniform 3D grid
– Rank vertices
– Collapse all verts to most important
– Filter out degenerate polygons

Low-Tan: floating cell clustering
– Center cells on most important vertices
– Collapse to nearest containing cell
– Rank slightly differently (cos /2)
DPL
7/27/2016
Recap: Decimation

The algorithm: multiple passes over
all model vertices
– Consider each vertex for deletion
Characterize local geometry/topology
 Evaluate criteria & possibly delete vertex
with surrounding triangles
 If deleted, triangulate resulting hole

DPL
7/27/2016
Edge Collapse Algorithm
V2
Collapse
V2
V1
DPL
7/27/2016
Edge Collapse Algorithm
Sort all edges (by some metric)
repeat
Collapse edge
choose edge vertex (or compute
optimal vertex)
Fix-up topology
until (no edges left)
DPL
7/27/2016
Vertex-Pair Merging

Even better: vertex-pair merging
merges two vertices that:
– Share an edge, or
– Are within some threshold distance t
Allows holes to close and objects to
merge
 In Garland-Heckbert terms: the two
vertices share a virtual edge

DPL
7/27/2016
Quadric Error Metric


Minimize distance to all planes at a vertex
Plane equation for each face:
v
p:

Ax + By + Cz + D = 0
Distance to vertex v :
p  v = [A
T
DPL
B C
x 
y
D ]  
1z 
7/27/2016
Quadric Derivation (cont’d)

ppT is simply the plane equation
squared:
2
A

AB
T

pp =
 AC

AD

AD 

BD 
BC C2 CD 
2 
BD CD D 
AB
B2
AC
BC
The ppT sum at a vertex v is a matrix, Q:
D( v ) = vT (Q )v
DPL
7/27/2016
Using Quadrics

Construct a quadric Q for every vertex
v1
The edge quadric:
v2
vnew
Q1
Q
Q2
Q = Q1 + Q2

Sort edges based on edge cost
– Suppose we contract to vnew:

Edge cost = VnewT Q Vnew
– v1’s new quadric is simply Q
DPL
7/27/2016
Optimal 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
– Authors claim 40-50% less error
DPL
7/27/2016
Q.E.M. Algorithm
find candidate vertex pairs;
sort pairs by edge cost;
repeat
merge lowest-cost vertex pair;
replace with optimal vertex;
remove degenerate triangles;
adjust cost of affected pairs;
re-sort pairs;
until no pairs left or budget met
DPL
7/27/2016
Boundary 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.

DPL
7/27/2016
Preventing Mesh Inversion

Preventing foldovers:
7
8
8
2
2
10
A
9
3
A
9
5
6
3
merge
1
4
10
6
4
5
Calculate the adjacent face normals,
then test if they would flip after
simplification
 If so, that simplification can be
weighted heavier or disallowed.

DPL
7/27/2016
Quadric Error Metric

Pros:
– Fast! (bunny to 100 polygons: 15 sec)
– Good fidelity even for drastic reduction
– Robust -- handles non-manifold
surfaces
– Aggregation -- can merge objects
DPL
7/27/2016
Quadric 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
(7x7 matrices)
DPL
7/27/2016
Dynamic LOD

DPL
New topic: dynamic level of detail
7/27/2016
Traditional Approach:
Static Level of Detail

Traditional LOD in a nutshell:
– Create LODs for each object
separately in a preprocess
– At run-time, pick each object’s LOD
according to the object’s distance
(or similar criterion)

DPL
Since LODs are created offline at
fixed resolutions, I refer to this as
Static LOD
7/27/2016
Advantages of
Static LOD

Simplest programming model; decouples
simplification and rendering
– LOD creation need not address real-time
rendering constraints
– Run-time rendering need only pick LODs

Fits modern graphics hardware well
– Can compile each LOD into triangle strips
and display lists
– These render much faster than unorganized
polygons on today’s hardware
DPL
7/27/2016
Dynamic Level of Detail

A relatively recent departure from
the traditional static approach:
– Static LOD: create individual LODs in a
preprocess
– Dynamic LOD: create data structure
from which any desired level of detail
can be extracted at run time.
DPL
7/27/2016
Advantages of
Dynamic LOD
Better granularity  better fidelity
 Better granularity  smoother
transitions
 Supports progressive transmission
 Supports view-dependent LOD

– Use current view parameters to select
best representation for the current view
– Single objects may thus span several
levels of detail
DPL
7/27/2016
View-Dependent LOD:
Examples

Show nearby portions of object at
higher resolution than distant
portions
View from eyepoint
DPL
Birds-eye view
7/27/2016
View-Dependent LOD:
Examples

DPL
Show silhouette regions of object at
higher resolution than interior
regions
7/27/2016
Advantages of
View-Dependent LOD
Even better granularity
 Enables drastic simplification of
very large objects

– Example: stadium model
– Example: terrain flyover
DPL
7/27/2016
Drastic Simplification:
The Problem With Large Objects
DPL
7/27/2016
Dynamic LOD Algorithms

Many good published algorithms:
– Progressive Meshes by Hoppe
[SIGGRAPH 96, SIGGRAPH 97]
– Merge Trees by Xia & Varshney
[Visualization 96]
– Hierarchical Dynamic Simplification by
Luebke & Erikson [SIGGRAPH 97]
– Others...

DPL
I’ll mostly describe my own work
7/27/2016
Overview:
The Algorithm
A preprocess builds the vertex tree,
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

DPL
7/27/2016
Data Structures

The vertex tree
– 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
– We’ll come back to this later
DPL
7/27/2016
The Vertex Tree

Each vertex tree node contains:
– A subset of model vertices
– A representative vertex or repvert
Folding a node collapses its vertices
to the repvert
 Unfolding a node splits the repvert
back into vertices

DPL
7/27/2016
Vertex Tree Example
8
7
R
2
I
10
6
9
3
10
1
A
1
4
2
B
7
4
5
C
6
8
3
9
5
Triangles in active list
DPL
II
Vertex tree
7/27/2016
Vertex Tree Example
8
7
R
2
A
I
10
6
9
3
10
1
A
1
4
2
B
7
4
5
C
6
8
3
9
5
Triangles in active list
DPL
II
Vertex tree
7/27/2016
Vertex Tree Example
8
R
A
I
10
6
9
3
10
A
1
4
2
B
7
4
5
C
6
8
3
9
5
Triangles in active list
DPL
II
Vertex tree
7/27/2016
Vertex Tree Example
8
R
A
I
10
6
9
3
10
B
4
A
1
2
B
7
4
5
C
6
8
3
9
5
Triangles in active list
DPL
II
Vertex tree
7/27/2016
Vertex Tree Example
8
R
A
I
10
9
3
10
B
Triangles in active list
DPL
II
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
8
R
A
C
9
I
10
3
10
B
Triangles in active list
DPL
II
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
A
C
I
10
II
3
10
B
Triangles in active list
DPL
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
A
C
II
I
10
II
3
10
B
Triangles in active list
DPL
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
A
II
I
10
10
B
Triangles in active list
DPL
II
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
A
I
II
I
10
10
B
Triangles in active list
DPL
II
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
I
II
I
10
B
Triangles in active list
DPL
II
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
I
II
I
II
R
10
B
Triangles in active list
DPL
A
1
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
Vertex Tree Example
R
I
II
R
10
A
1
Triangles in active list
DPL
2
B
7
4
5
C
6
8
3
9
Vertex tree
7/27/2016
The Vertex Tree:
Folding And Unfolding
8
7
2
8
Fold Node A
A
A
10
6
9
4
6
9
3
1
DPL
10
3
Unfold Node A
5
4
5
7/27/2016
The Vertex Tree:
Tris and Subtris
8
8
7
Fold Node A
2
A
10
10
6
9
1
4
6
9
3
3
Unfold Node A
5
4
5
Node->Tris: triangles that change shape upon folding
Node->Subtris: triangles that disappear completely
DPL
7/27/2016
The Vertex Tree:
Tris and Subtris
Each node’s tris and subtris can be
computed offline to be accessed
very quickly at run time
 This is the key observation behind
dynamic simplification

DPL
7/27/2016
The Vertex Tree:
Tris and Subtris

Computing tris and subtris:
– node->tris = triangles with exactly
one corner vertex supported by node
– node->subtris = triangles with:
Two or three corners in different subnodes
 No two corners in the same subnode

DPL
7/27/2016
The Vertex Tree:
Tris and Subtris
A Node
Subnodes
DPL
7/27/2016
The Vertex Tree:
Tris and Subtris
This is a tri
of the node
DPL
7/27/2016
The Vertex Tree:
Tris and Subtris
This is a
subtri of
the node
DPL
7/27/2016
The Vertex Tree:
Tris and Subtris
This is neither.
It is a subtri
of a subnode
DPL
7/27/2016
View-Dependent
Simplification
Any run-time criterion for folding and
unfolding nodes may be used
 I’ve implemented three such criteria:

– Screenspace error threshold
– Silhouette preservation
– Triangle budget simplification
DPL
7/27/2016
Screenspace Error
Threshold

Nodes chosen by projected area
– User sets screenspace size threshold
– Nodes which grow larger than
threshold are unfolded
DPL
7/27/2016
Silhouette Preservation

Retain more detail near silhouettes
– A silhouette node supports triangles on
the visual contour
– Use tighter thresholds when examining
silhouette nodes
DPL
7/27/2016
Triangle Budget
Simplification

Minimize error within specified
number of triangles
– Sort nodes by screenspace error
– Unfold node with greatest error
– Repeat until budget is reached
DPL
7/27/2016
Other Possible
View-Dependent Criteria
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
 Quadric error metrics: Can represent
Garland’s Q.E.M.’s as ellipsoids,
which map to ellipses on screen

DPL
7/27/2016
Optimizations

Exploiting temporal coherence
– Scene changes slowly over time

Asynchronous simplification
– Parallelize the algorithm
DPL
7/27/2016
Exploiting
Temporal Coherence
Idea: frame-to-frame changes are
small
 Two examples:

– Active triangle list
– Vertex tree
DPL
7/27/2016
Exploiting
Temporal Coherence

Active triangle list
– Few triangles are added or deleted
each frame
– Store current simplification, make only
incremental changes
– Simple implementation: doubly-linked
list of triangles
– Better: arrays with garbage collection
DPL
7/27/2016
Exploiting
Temporal Coherence

Vertex Tree
– Few nodes change per frame
– Don’t traverse whole tree
– Do local updates only
at boundary nodes
Unfolded
Nodes
Boundary Nodes
DPL
7/27/2016
Asynchronous
Simplification

Algorithm partitions into two tasks:
Vertex Tree

DPL
…
Simplify
Task
Render
Task
Active Triangle List
Run them on separate processors
7/27/2016
Optimizations: NodeTris

Recall that nodetris is a list of
triangles that change shape when
node is folded or unfolded

Storing this list explicitly is an
optimization of questionable value
– Speeds up folding & unfolding slightly
– But requires considerably more storage

Alternative: lazy evaluation
– Update triangle shape at render time
DPL
7/27/2016
Summary: Pros
View-dependent; handles the
Problem With Large Objects
 Hierarchical; handles the Problem
With Small Objects

– Assuming vertices from different
objects are merged in vertex tree
Robust; does not require (or
preserve) clean mesh topology
 Supports drastic simplification!

DPL
7/27/2016
Summary: Cons

Currently nothing to prevent mesh
foldovers:
7
8
2
10
6
9
3
1
4
DPL
5
7/27/2016
Summary: Cons

Currently nothing to prevent mesh
foldovers:
7
8
2
10
A
9
6
3
1
4
DPL
5
7/27/2016
Summary: Cons

Currently nothing to prevent mesh
foldovers:
8
2
10
A
9
3
4
DPL
6
5
7/27/2016
Related Work

Hoppe: Progressive Meshes
(SIGGRAPH 96, 97)
– Edge collapse vs. vertex merging
– Pros:
Dynamic, view-dependent simplification
 Elegant scheme for mesh attributes

– Cons:
Requires clean mesh topology
 Slow preprocess
 Still per-object LOD

DPL
7/27/2016
Related Work

Popovic: Progressive Simplicial
Complexes
– General vertex pair unification
– Pros:
Intelligently simplifies topology
 Dynamic and hierarchical LOD

– Cons:
Extremely slow preprocess
 Doesn’t address view-dependent LOD

DPL
7/27/2016
Related Work: Static LOD

Garland: Quadric Error Metrics
– Leading (published) static LOD algorithm
– Uses vertex pair merging
– Pros:
Very fast with good fidelity
 Doesn’t require clean topology

– Cons:
Still static LOD
 “Tweak factor” picking distance threshold t

DPL
7/27/2016
Dynamic Vs. Static LOD

Dynamic LOD is superior to
traditional static LOD when:
– Models contain very large individual
objects (e.g., terrains)
– Simplification must be completely
automatic (e.g., CAD design reviews)
– Experimenting with view-dependent
simplification criteria
– Progressive refinement is desirable
DPL
7/27/2016
Dynamic Vs. Static LOD

Static LOD is often the better choice:
– Simplest programming model
– Reduced run-time CPU load
– Can capture LODs in display lists,
which render much faster on most
modern hardware
DPL
7/27/2016
Dynamic Vs. Static LOD

Summary:
– Dynamic (and view-dependent) LOD
Conceptually cleaner
 Better fidelity for given polygon count

– Static LOD
Easier to do
 Fits current hardware better

DPL
7/27/2016
Dynamic Vs. Static LOD

Applications that may want to use:
– Static LOD
Video games
 Simulators
 Many walkthrough-style demos

– Dynamic LOD
CAD design review tools
 Medical & scientific visualization toolkits
 Many terrain flyovers

DPL
7/27/2016
Download