10/14/03cs679 - fall 2003 - copyright univ. of wisconsin last time level of detail
TRANSCRIPT
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Last Time
• Level of Detail
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Today
• LOD Error Metrics
• Progressive LOD
• View Dependent LOD
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Edge Contraction
• Single edge contraction (v1,v2) v’ is performed by– moving v1 and v2 to position v’– replacing all occurrences of v2 with v1
– removing v2 and all degenerate triangles
v1v2 v’
Slide courtesy Michael Garland, http://graphics.cs.uiuc.edu/~garland
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Vertex Pair Contraction
• Can also easily contract any pair of vertices– fundamental operation is exactly the same
– joins previously unconnected areas
– can be used to achieve topological simplification
Slide courtesy Michael Garland, http://graphics.cs.uiuc.edu/~garland
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Operations to Algorithms
• A single operation doesn’t reduce a mesh!
• Most common approach is a greedy algorithm built on edge contractions (iterative edge contractions):– Rank each possible edge contraction according to how much error it
would introduce
– Contract edge that introduces the least error
– Repeat until done
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Error Metrics
• The error metric measures the error introduced by contracting an edge– Should be low for edges whose removal leaves mesh nearly
unchanged• What is an example of an edge that can be removed without
introducing any error?
• Issues:– How well does it measure changes in appearance?– How easy is it to compute?
• Subtle point: Error should be measured with respect to original mesh, which can pose problems
– Can it handle color and other non-geometric attributes?
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Measuring Error With Planes
• An edge contraction moves two vertices to a single new location• Measure how far this location is from the planes of the original faces• 2D examples (planes are lines):
Low error
High error
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Which Planes?
• Each vertex has a (conceptual) set of planes– Error sum of squared distances to planes in set– Each plane given by normal, ni, and distance to origin, di
• Initialize with planes of incident faces– Consequently, all initial errors are 0
• When contracting pair, use plane set union– planes(v’) = planes(v1) planes(v2)
i
id2
)(Error vnv Ti
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
The Quadric Error Metric
• Given a plane, we can define a quadric Q
measure squared distance to the plane as
2,,,, ddcQ T nnnbA
cQ vbAvvv TT 2)(
2
2
2
2
2)( d
z
y
x
dndndn
z
y
x
nnnnn
nnnnn
nnnnn
zyxQ zyx
zzyzx
zyyyx
zxyxx
v
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
The Quadric Error Metric
• Sum of quadrics represents set of planes
• Each vertex has an associated quadric– Error(vi) = Qi (vi)
– Sum quadrics when contracting (vi, vj) v’
– Error introduced by contraction is Q(v’)
)()(2
vvvnTi
i
ii
ii
i QQd
jijijiji ccQQQ ,, bbAA
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Where Does v’ Belong?
• Choose the location for v’ that will minimize the error introduced
• Alternative is to use fixed placement:– Select v1 or v2
– Fixed placement is faster but lower quality– But it also gives smaller progressive meshes (more later)– Fallback to fixed placement if A is non-invertible
• When is A non-invertible (hard!)?
bAvv 1 0)(Q
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Visualizing Quadrics in 3-D
• Quadric isosurfaces– Contain all the vertex
locations that are within a given distance of the face planes
– Are ellipsoids(maybe degenerate)
– Centered around vertices
– Characterize shape
– Stretch in least-curved directions
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Sample Model: Dental Mold
424,376 faces424,376 faces 60,000 faces60,000 faces
50 sec50 sec
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Sample Model: Dental Mold
424,376 faces424,376 faces 8000 faces8000 faces
55 sec55 sec
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Sample Model: Dental Mold
424,376 faces424,376 faces 1000 faces1000 faces
56 sec56 sec
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Must Also Consider Attributes
Mesh for solutionMesh for solution Radiosity solutionRadiosity solution
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Must Also Consider Attributes
• Add extra terms to plane equations for color information (or texture coords)
• Makes matrices and vectors bigger, but doesn’t change overall approach
50,761 faces50,761 faces 10,000 faces10,000 faces
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Limitations of Static Models
• The LOD schemes we have discussed assume a fixed set of models
• There are reasons to improve upon this:– Objects that are both near and far at the same time, such as terrain,
must have varying LOD over a single surface
– Static representations waste resolution on back-facing polygons - they are view-independent
– Different machines have different processing power - hard to adjust LOD switching appropriately
• We desire models that adapt to context:– Viewer location, viewer direction, machine load, …
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Progressive Meshes (PMs)
• Store more than just final approximations– Sequence of contractions
– Implicitly, corresponding intermediate approximations
• Re-encode as progressive mesh (PM) [Hoppe]– Start with the final approximation
– Reverse of contraction sequence is split sequence• A single vertex is split into two, and triangles are created
– Can reconstruct any intermediate model
– Allow for progressive transmission & compression
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
PM Details
• Modification to contraction operation:– Make a record of which vertices were contracted– Record information to reverse the contraction
• Original vertex locations, where the edges go, normals, …
• Store final approximation and the sequence of contraction records
• Implicitly have a many meshes as there were contractions• At run time, perform contractions until target number of
triangles, or until error bound is met• Various optimizations to reduce storage cost
– For example, always contract to one of the original vertices
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Improving PMs
• Progressive meshes fix the order of contractions– Still a fixed sequence of meshes
– Based on an error metric that ignored runtime context
• We would like to be able to vary the contraction order– If we have a view dependent error metric we will want a different
collapse sequence depending on the view• Want less error at silhouettes, more in front facing, don’t care about
back facing
– For terrain, we want to contract distant edges first - care about how big error appears on screen
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Structure Induced on Surface
• Every vertex on approximation corresponds to– A connected set of vertices on the original - all the vertices belonging to
edges collapsed to this vertex– Hence a region on the surface: the union of neighborhoods
• Initial conditions– every vertex set is a singleton, every region a neighborhood
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Structure Induced on Surface
• A contraction merges corresponding vertex sets– remaining vertex accumulates larger surface region
• When merging regions, can link them by mesh edge– as shown on left hand side
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Structure Induced on Surface
• Links within single region form spanning tree– links within all regions form spanning forest
– any contraction order within regions is (topologically) valid
• Regions always completely partition original surface
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Structure Induced on Surface
• Pair-wise merging forms hierarchy– binary tree of vertices
– also a binary tree of surface regions
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Example:Initial Vertex Neighborhoods
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Example:99% of vertices removed
Regions of constant color contain vertices that have all been contracted to a single vertex
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Example:99.9% of vertices removed
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Vertex Hierarchies
• After the entire mesh has been contracted down to a single point, all the vertices lie in a tree
• Generally, stop sooner and get a forest– A set of trees, one per final
vertex
• We can talk about a cut through the tree– A curve that never crosses a
descendent of an edge it’s already crossed
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Cuts and Valid Models
• If we contract every edge below a cut, we get a valid approximation– Vertices just above the cut are said to be active
– Different cuts give different approximations
• The vertex hierarchy encodes dependencies– Better than PMs, because there is no fixed order to perform the
contractions
– Each sub-tree can be treated independently, because no collapses in one sub-tree depend on collapses in other sub-trees
• But have to be careful of mesh folding over itself
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
View-Dependent Refinement
• Use an error metric that depends on the viewing direction
• Use a cut through the vertex hierarchy as the approximation– incrementally move the cut between frames
[Xia-Varshney, Hoppe, Luebke-Erickson]
– move up/down where less/more detail needed
– relies on frame-to-frame coherence - best approximation probably doesn’t change much from one frame to next
– can accommodate geomorphing [Hoppe]
• More flexibility than discrete LOD, but more overhead
– Have to re-assess approximation at every frame, figuring out where to add detail and where to remove it
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
View Dependent Example
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
View Dependent Addendum
• The entire world can be one vertex tree– Good for very large models such as stadiums
• Can build strips out of the vertices as the cut is moved– Speeds rendering
• Also works for error metrics involving lighting reproduction– Don’t want to simplify near specularities, for instance
• Not used in games (to my knowledge) except for terrain– Too slow, and mesh changes on every frame, so hard to utilize vertex arrays
and other speed optimizations
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
More On Error Metrics
• Always include a geometric component:– Vertex-Vertex distance
– Vertex-Plane Distance
– Point-Surface Distance
– Surface-Surface Distance
• May include attribute metrics– Aim to preserve pixel colors
– Components for normal vectors, texture coordinates…
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Vertex-Vertex Distance
• E=max(||v3-v1||, ||v3-v2||)
• Works during topological changes– Vertex clustering, Vertex pair
– Rossignac and Borrel 93, Luebke and Erikson 97
• A loose metric for collapse type operations– Vertices don’t move very far, but surface deviation may be high
v1 v2
v3
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Vertex-Plane Distance
• Store a set of planes with each vertex– Error based on distance from the vertex to the planes
– Merge the plane sets when vertices are merged
– Tries to keep vertices near original surface
• Ronfard and Rossignac 96– Store planes, use max distance
• Error Quadrics – Garland and Heckbert 96– Quadratic form instead of planes, use sum of square distances
a b c
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Point-Surface Distance
• Measure the distance from a set of points to the simplified surface– Point set representative of original surface
– Use sum of squares distances
• Hoppe 93 and 96
• Approximation to surface-surface distance
• Expensive to compute
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Surface-Surface Distance
• Bounds the maximum distance between the input and simplified surfaces– Tolerance volumes – Gueziec 96– Simplification Envelopes – Cohen/Varshey 96– Hausdorf Distance – Klein 96– Mapping Distance – Bajaj/Schikore 96, Cohen et. al. 97
• Arguably best measures, but most expensive to compute
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Error Metric Notes
• A good metric allows you to transform error in object space into error in screen space– Simplifies decision of which model to display
• Note that the metrics can be very different– Consider an edge-swap:
– E=0 at verts and edges
– E0 everywhere else
– Metrics that look only at vertices or edges will give this a zero error
• Run-time metrics may take view into account
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Project Stage 3
• Focus on modeling and efficient rendering
• Terrain and terrain LOD or tiling– Quadtrees, octrees, …
– Generation of terrain
• Visibility– Occlusion culling?
– Frustum culling (far clip plane and fog)?
• LOD for objects– Probably just use off-the-shelf solution
• Other modeling issues …
10/14/03 CS679 - Fall 2003 - Copyright Univ. of Wisconsin
Todo
• By Monday, Oct 20, Stage 3 goals
• By Monday, Nov 3, Stage 3 demo