760 likes | 921 Views
CS 551/651: Simplification Continued. David Luebke cs551dl@cs.virginia.edu http://www.cs.virginia.edu/~cs551dl. 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?
E N D
CS 551/651: Simplification Continued David Luebke cs551dl@cs.virginia.edu http://www.cs.virginia.edu/~cs551dl DPL 7/13/2014
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/13/2014
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/13/2014
Lecture Outline • Recap Quadric Error Metrics • Finish up QEM • Dynamic LOD DPL 7/13/2014
Recap: Level of Detail 50 Vertices 500 Vertices 2000 Vertices Model courtesy of InfoGraphica DPL 7/13/2014
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/13/2014
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/13/2014
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/13/2014
Edge Collapse Algorithm V2 V2 Collapse V1 DPL 7/13/2014
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/13/2014
Vertex-Pair Merging • Even better: vertex-pair mergingmerges 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/13/2014
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 : é ù x [ ] ê ú × = × T y p v A B C D z ê ú ë û 1 DPL 7/13/2014
Quadric Derivation (cont’d) • ppTis simply the plane equation squared: é ù 2 A AB AC AD ê ú 2 AB B BC BD ê ú = T pp ê ú 2 AC BC C CD ê ú 2 AD BD CD D ë û • The ppT sum at a vertex v is a matrix, Q: ( ) D = T ( v ) v Q v DPL 7/13/2014
Using Quadrics • Construct a quadric Q for every vertex v2 v1 vnew The edge quadric: Q2 Q1 Q = + Q Q Q 1 2 • 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/13/2014
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/13/2014
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/13/2014
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/13/2014
8 2 10 A 6 9 3 4 5 Preventing 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 merge 3 1 4 5 DPL 7/13/2014
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/13/2014
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/13/2014
Dynamic LOD • New topic: dynamic level of detail DPL 7/13/2014
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) • Since LODs are created offline at fixed resolutions, I refer to this as Static LOD DPL 7/13/2014
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/13/2014
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/13/2014
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/13/2014
View-Dependent LOD: Examples • Show nearby portions of object at higher resolution than distant portions View from eyepoint Birds-eye view DPL 7/13/2014
View-Dependent LOD: Examples • Show silhouette regions of object at higher resolution than interior regions DPL 7/13/2014
Advantages of View-Dependent LOD • Even better granularity • Enables drastic simplification of very large objects • Example: stadium model • Example: terrain flyover DPL 7/13/2014
Drastic Simplification:The Problem With Large Objects DPL 7/13/2014
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... • I’ll mostly describe my own work DPL 7/13/2014
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/13/2014
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/13/2014
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/13/2014
Vertex Tree Example 8 7 R 2 I II 10 6 9 3 10 A B C 3 1 1 2 7 4 5 6 8 9 4 5 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example 8 7 R A 2 I II 10 6 9 3 10 A B C 3 1 1 2 7 4 5 6 8 9 4 5 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example 8 R A I II 10 6 9 3 10 A B C 3 1 2 7 4 5 6 8 9 4 5 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example 8 R A I II 10 6 9 3 10 A B C 3 B 1 2 7 4 5 6 8 9 4 5 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example 8 R A I II 10 9 3 10 A B C 3 B 1 2 7 4 5 6 8 9 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example 8 R A C I II 10 9 3 10 A B C 3 B 1 2 7 4 5 6 8 9 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example R A C I II 10 3 10 A B C 3 B 1 2 7 4 5 6 8 9 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example R A C II I II 10 3 10 A B C 3 B 1 2 7 4 5 6 8 9 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example R A II I II 10 10 A B C 3 B 1 2 7 4 5 6 8 9 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example R A I II I II 10 10 A B C 3 B 1 2 7 4 5 6 8 9 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example R I II I II 10 A B C 3 B 1 2 7 4 5 6 8 9 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example R I II I II R 10 A B C 3 B 1 2 7 4 5 6 8 9 Vertex tree Triangles in active list DPL 7/13/2014
Vertex Tree Example R I II R 10 A B C 3 1 2 7 4 5 6 8 9 Vertex tree Triangles in active list DPL 7/13/2014
8 8 7 A A 2 10 10 6 6 9 9 3 3 1 4 5 4 5 The Vertex Tree:Folding And Unfolding Fold Node A UnfoldNode A DPL 7/13/2014
8 A 10 6 9 3 4 5 The Vertex Tree:Tris and Subtris 8 7 Fold Node A 2 10 6 9 3 UnfoldNode A 1 4 5 Node->Tris: triangles that change shape upon folding Node->Subtris: triangles that disappear completely DPL 7/13/2014
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 The Vertex Tree:Tris and Subtris DPL 7/13/2014
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/13/2014