730 likes | 845 Views
CSL 859: Advanced Computer Graphics. Dept of Computer Sc. & Engg. IIT Delhi. Mesh. List of triangles Each is a triplet of Vertices Each is an array of attributes Euler’s relation: V + F -2 = E Adjacency list List of vertices List of “pointers” A vertex referred ~6 times (closed model).
E N D
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi
Mesh • List of triangles • Each is a triplet of Vertices • Each is an array of attributes • Euler’s relation: • V + F -2 = E • Adjacency list • List of vertices • List of “pointers” • A vertex referred ~6 times (closed model)
Vertex & Topology Vertex Attributes C ..A.. ..B.. ..C.. ..D.. ..E.. ..F.. D B Topology E 0 1 5 1 3 5 1 2 3 5 3 4 6 5 4 0 5 6 F A G What order should we choose? Post vertex shader cache
Triangle Strip Vertex Attributes C ..A.. ..B.. ..C.. ..D.. ..E.. ..F.. D B Topology E ABFDE AFGE BCD F A Can we turn any given model into a single strip? G Would that eliminate the need for storing topology?
Post Shader Cache • Perfect Triangle Strip of n triangles => • 1 new vertex per triangle • n-2 cache misses • Can we do better? • Euler’s law: V + F = E + 2 • V ~ 0.5F (E = 1.5F for closed model) • Yes (Ideal: 0.5verts/triangle) • [Chhugani & Kumar, I3D 2007]
Vertex Arrays • Array of structures • Better triangle locality • Structure of arrays • Better shader locality V0 x y z u v a b c V1 x y z u v a b c x0 x1 x2 x3 y0 y1 y2 y3
Half-Edge Data Structure Vertex List Face List Edge List ..V0.. ..V1.. ..V2.. ..V3.. . . E0 E2 E1 E5 E4 E3 . . V0 V1, F0, E1 E2, E5 .. V1 V0, F1, E3 E4, E0 .. V1 E5 E3 E2 F1 F0 E4 E0 E1 V0
Winged-Edge Data Structure Vertex List Face List Edge List ..V0.., E0 ..V1.., E0 ..V2.., E1 ..V3.., E4 . . E0 E4 . . V0 V1, F0 F1, E1 E2, E3 E4 . . V1 E3 F1 E2 Edge is oriented based on one of its faces: left or right E0 F0 E4 E1 V0
Mesh Simplification Ideally, the change is incremental courtesy H. Hoppe
Nominal Framework • Pre-processing • Create and store levels in a data-structure • Rendering time • Decide the appropriate detail • Coarse or fine-grained • Output count or approximation error • Traverse DS to generate that detail • Render
Competing Goals • Computational Efficiency • Some pre-processing • Storage Efficiency • Quality • Error metrics • screen space vs object space • Geometry, attributes, appearance • Global vs local optimization • local may be faster • global may generate closer approximations
Attributes • Color • Normal Vectors • Texture Coordinates • Curvature • Material Properties
Topology Considerations • Manifold vs non-manifold • Topology preservation • important in some areas • if topology is changed, then we can: • close holes in objects • join disconnected components • Shape and attribute appearance more important than topology
Possible Algorithm? • Subdivide space into cells • Choose a vertex to represent each cell • For each pair of cells • If two vertices in two cells have an edge • Connect the representative vertices • Borel, Rossignac [1993]
Reduce Geometry Count • Remove a vertex • That leave a hole • Retriangulate the hole Schroeder et al., 1992
ecol(vs ,vt , vs) ’ vl vr vs ’ Simple Operation • Collapse edges, one at a time vt vr vl vs
^ M=Mn Simplification 13,546 500 152 150 M175 M1 M0 ecoln-1 ecol0 ecoli courtesy H. Hoppe
v’t vr vl vl vr vs v’s Inverse? parameters vspl(vs ,vl ,vr , vs,vt,…) ’ ’
150 152 500 13,546 ^ ^ M0 M1 M175 Mn=M Mn=M … vspli … vspl0 vspln-1 Reconstruction Progressive Mesh (PM) representation courtesy H. Hoppe
3,478 ^ M0 Mn=M Mi Continuous LOD From PM, extract Mi of any size 3,478 faces? M0 vspl0 vspl1 vspli-1 vspln-1 Mi courtesy H. Hoppe
Mf-1 Mf-2 v1 v1 v2 v2 ecol ecol v3 v3 v4 v4 ecol v5 v5 v6 v6 v7 Vertex Correspondence Mf Mc M0 v1 v1 Mn v2 v2 v3 v3 v4 v5 v6 v7 v8 courtesy H. Hoppe
v’t vr vl vl vr vs v’s Space Overhead ’ ’ vspl(vs ,vl ,vr , vs,vt,…) • Attrib deltas: vt - vs vs - vs … ’ ’ • Topology: • Index of vs • Pair of index offsets
Selective Refinement vspl0 vspl1 vspli-1 vspln-1 M0 What’s the problem? courtesy H. Hoppe
Parent-Child Correspondence vs vsplit vu vt
vspl0 vspl1 vspl2 vspl3 vspl4 vspl5 M0 v1 v2 v3 v10 v10 v11 v4 v5 v5 v8 v9 v12 v13 v6 v6 v7 Mn v14 v15 Vertex Hierarchy M0 vspl0 vspl1 vspl2 vspl3 vspl4 vspl5 PM: M0 v1 v2 v3 [Xia & Varshney 96]
vspl0 vspl1 vspl2 vspl3 vspl4 vspl2 v1 v1 v2 v2 v3 v3 v3 v10 v10 v10 v11 v11 v4 v4 v5 v5 v5 v8 v8 v9 v9 v8 v9 v12 v12 v13 v13 v6 v6 v7 v7 selectively refined mesh v14 v15 Selective Refinement M0 vspl0 vspl1 vspl2 vspl3 vspl4 vspl5 M0 v1 v2 v3 Restrictions?
v’t vr vl vl vr vs v’s Dependencies • vsplit legal if vs, vl , and vr present • ecol legal if local neighbors present vsplit ecol [Xia & Varshney 96]
v’u fn3 fn1 fn1 fn3 vs fn0 fn2 v’t fn0 fn2 Consistency vsplit ecol vsplit legal if: vs is active fn0,fn1,fn2,fn3 are active ecol legal if: v’s,v’t are active fn0,fn1,fn2,fn3 are adjacent [Hoppe 97]
Rendering Algorithm • Start with the active front in previous frame. • Exploits frame coherence • For each vertex, decided refine or coarsen • If legal, perform operation, otherwise: • Make vertex split legal by generating necessary vertices • Leave Edge collapses alone • Amortize? • At each frame apply only a fraction of the eligible ops
v3 v10 v11 v4 v8 v9 v9 v10 v10 v11 v11 v4 v4 v8 v8 v8 v9 v9 v7 dependency v12 v13 v6 v6 v7 v7 previous mesh v14 v15 new mesh v14 v14 v15 v15 v15 Rendering Algorithm M0 v1 v2 v3 v10 v11 v4 v5 v8 v9 v12 v12 v13 v6 v7 v14 v15
LOD Algorithms • Simplification operator • Where should it be applied • No optimization • e.g., uniform grid cells • Greedy optimization • Sort edge collapses by error • Re-insert modified edges after each step • Lazy optimization • Re-insert a modified edge only when in front • Local vs Global optimization
S S points points Error Metric • Preserve appearance: • Geometric shape • Scalar fields (e.g. color) • Discontinuity curves courtesy H. Hoppe
Measuring Error • Geometric error • Distance between the original and simplified surface? • Volume between the surfaces? • Visual error • Color, normal, & texture distortion • Silhouettes, background illumination • Semantics • Many others
Measuring Geometric Error • Surface-surface • Hausdorff distance • Vertex-surface vs • Vertex-plane • Vertex-vertex • Average distance or Max distance
Quadric Error • [Garland & Heckbert] 1998 • Measure error by deviation from shape • Vertices are at intersection of planes • Do not collapse edges • Merge vertices v’t v’s
å D = T 2 ( v ) ( p v ) Î p planes ( v ) å = T T ( v p )( p v ) Î p planes ( v ) + + + = p : Ax By Cz D 0 å = T T v ( pp ) v Î p planes ( v ) é ù x æ ö å [ ] ç ÷ = ê ú T T = × T v pp v y × p v ç ÷ A B C D è ø z ê ú Î p planes ( v ) ë û 1 Quadric Error Metric • Plane equation for a face: • Distance to vertex v : • Distance to vertex v :
é ù 2 A AB AC AD ê ú 2 AB B BC BD ê ú = T pp ê ú 2 AC BC C CD ê ú 2 AD BD CD D ë û ( ) D = T ( v ) v Q v Quadric Error (cont’d) • Sum over all planes intersecting at v • Call it Q, the quadric error
( ) D = T ( v ) v Q v Quadrics Based Simplification • Maintain quadric Q for every vertex • Assign Edge Quadrics v1 v2 = + Q1 Q Q Q Q2 1 2 • Sort edges based on quadric error • Need position of resulting vertex • One of original vertices or mid-point?
Optimal Vertex Placement • Minimize Q to calculate optimal coordinates for placing new vertex
Boundary Preservation • Label boundaries • Form boundary plane perpendicular to face • Convert planes into quadrics • Weighted sum of quadrics • Scale border plane quadric higher
8 2 10 A 6 9 3 4 5 Preventing Mesh Inversion • Preventing foldovers: • Adjacent face normals should not flip • Disallow foldover, or simply weight heavily 7 8 2 10 A 6 9 merge 3 1 4 5
Quadric Error Metric • Pros: • Reasonably fast • Good fidelity even for drastic reduction • Robust -- handles non-manifold surfaces • Aggregation -- can merge objects • Cons: • Introduces non-manifold surfaces • User controls virtual-edge collapse threshold • Increased running time due to search for potential pairs • Correct value varies with model density • Needs extension to handle color (7x7 matrices)
Result – Bunny Model 69,451 triangles 1,000 triangles 100 triangles 1.4% of original size 0.14% of original size courtesy Garland, Heckbert
Result – Terrain Model 199,114 faces 999 faces (46 secs) courtesy Garland, Heckbert
Method Comparison Edge Contractions Original model (250 faces) (4,204 faces) Uniform Vertex Clustering Pair Contractions (262 faces) (250 faces) courtesy Garland, Heckbert
[Lindstrom & Turk 2000] Compare simplifications to original via images Collapse edge Render from many views Evaluate difference (need image metric) “Unrender” and retry Pick cheapest and apply Image-Driven Simplification
Image-Driven Simplification • Pros: • Preserves appearance • Does not need to trade off geometric error against attribute error • Shading artifacts accounted for • Side effects: • Drastically simplifies invisible regions!
Image-Driven Simplification • Cons: • Very slow • Still many examples that breaks it: • Hard to know how many images is enough • Hard to know how to evaluate images (RMS vs Bolin-Meyer)
Screen Space Error • Depends on location and orientation of error vector • We don’t even store error vectors
y+ε sin θ y+ε sin θ z+ε cos θ z+ε cos θ y/z εs= Screen Space Error ε θ y,z εs y/z Eye Image Plane