Você está na página 1de 73

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.. D
..B.. B
Topology
..C..
..D.. 015 E
..E.. 135 F
..F.. 123
534 A
654
056 G
What order should
we choose?
Post vertex shader cache
Triangle Strip
Vertex Attributes C
..A.. D
..B.. B
..C.. Topology
..D.. E
..E.. ABFDE
F
..F.. AFGE
BCD A

Can we turn any given G


model into a single strip?

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 V0
xyzuvabc
 Better triangle locality V1
xyzuvabc

 Structure of arrays x0 x1 x2 x3
 Better shader locality
y0 y1 y2 y3
Half-Edge Data Structure
Vertex List Face List Edge List
..V0.. V0 V1, F0, E1 E2, E5
E0 E2 E1
..V1.. ..
E5 E4 E3
..V2.. V1 V0, F1, E3 E4, E0
.
..V3.. ..
.
.
. V1
E5 E3
E2
F1
F0
E0 E4
E1
V0
Winged-Edge Data Structure
Vertex List Face List Edge List
..V0.., E0 E0 V0 V1, F0 F1, E1 E2, E3 E4
..V1.., E0 E4 .
..V2.., E1 . .
..V3.., E4 .
.
V1
. E3

F1
Edge is oriented based on E2
F0 E0
one of its faces: left or right 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


Simple Operation
 Collapse edges, one at a time

ecol(vs ,vt , vs’ )


vt
vl vr vl v’s vr
vs
Simplification

13,546 500 152 150

^
M=Mn M175 M1 M0
ecoln-1 ecoli ecol0

courtesy H. Hoppe
Inverse?
parameters
vspl(vs ,vl ,vr , vs’ ,vt’,…)
v’t

vl vr vl vr
vs
v’s
Reconstruction

150 152 500 13,546

M0 M1 M175 ^
Mn=M
vspl0 … vspli … vspln-1

Progressive Mesh (PM) representation

courtesy H. Hoppe
Continuous LOD
From PM, extract Mi of any size
3,478 faces?
M0 vspl0 vspl1 vspli-1 vspln-1 3,478

Mi

M0 ^
Mn=M
Mi

courtesy H. Hoppe
Vertex Correspondence
Mf Mf-1 Mf-2 Mc
Mn v1 v1 v1 v1 M0
v2 v2 v2 v2
ecol ecol
v3 v3 v3 v3
v4 v4 v4
ecol
v5 v5 v5
v6 v6 v6
v7 v7
v8

courtesy H. Hoppe
Space Overhead
vspl(vs ,vl ,vr , v’s ,vt’,…)
Attrib deltas:
v’t vt -’ vs
vl vs vr vl vr vs -’ vs
v’s …

Topology:

Index of vs

Pair of index offsets
Selective Refinement

M0 vspl0 vspl1 vspli-1 vspln-1

What’s the problem? courtesy H. Hoppe


Parent-Child Correspondence

vs

vsplit

vt vu
Vertex Hierarchy
PM: M0 vspl0 vspl1 vspl2 vspl3 vspl4 vspl5

M0 v1 v2 v3

v10 v11 v4 v5 v8 v9

Mn v12 v13 v6 v7

v14 v15
[Xia & Varshney 96]
Selective Refinement
M0 vspl0 vspl1 vspl2 vspl3 vspl4 vspl5

M0 v1 v2 v3

v10 v11 v4 v5 v8 v9

v12 v13 v6 v7

selectively refined mesh


v14 v15
Restrictions?
Dependencies

vsplit
vl vr v’t
vs
vl vr
ecol v’s
 vsplit legal if vs, vl , and vr present

 ecol legal if local neighbors present

[Xia & Varshney 96]


Consistency
vsplit

fn1 fn1 v’u fn3


fn3
vs
fn0 fn2 ecol
fn0 v’t f
n2

vsplit legal if:


vs is active
fn0,fn1,fn2,fn3 are active

ecol legal if:


v’s,v’t are active
[Hoppe 97] fn0,fn1,fn2,fn3 are adjacent
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
Rendering Algorithm

M0 v1 v2 v3

v10 v11 v4 v5 v8 v9

v12 v13 v6 v7
dependency
previous mesh
v14 v15 new mesh
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
Error Metric
 Preserve appearance:
 Geometric shape
 Scalar fields (e.g. color)

 Discontinuity curves

E  (e
face areas
shape  escalars )dA   (e disc
disc. edges
)dL


points

points
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

v’t

 Do not collapse edges


v’s
 Merge vertices
Quadric Error Metric
 Plane equation for a face:
p: Ax  By  Cz  D  0
 Distance to vertex v : x 
p  v  A D   
T y
B C
1z 
 Distance to vertex v :
( v )  ( p T
v)
2

p planes ( v )

 
 (v T T
p )( p v )  v T T
( pp )v  v  ppT
T
v
p planes ( v ) p planes ( v ) pplanes ( v ) 
Quadric Error (cont’d)
 A2 AB AC AD 
 2 
 AB B BC BD 
ppT

 AC BC C2 CD 
 2 
AD BD CD D 

 Sum over all planes intersecting at v


 Call it Q, the quadric error

(v) v Qv
T
Quadrics Based Simplification
 Maintain quadric Q for every vertex
v1 v2
 Assign Edge Quadrics
Q1 Q  Q1  Q2 Q2
 Sort edges based on quadric error
 Need position of resulting vertex
(v) vT Qv

 One of original vertices or mid-point?


Optimal Vertex Placement
 Minimize Q to calculate optimal coordinates
for placing new vertex

1
 q11 q12 q13 q14  0 
q q 22 q 23 q 24  0 
 12   

V 
 q13 q 23 q33 q34  0 
0 0 0 1  1
  
Boundary Preservation
 Label boundaries
 Form boundary plane perpendicular to face
 Convert planes into quadrics
 Weighted sum of quadrics
 Scale border plane quadric higher
Preventing Mesh Inversion
 Preventing foldovers:
7
8 8
2 2

10 10
A 6 A 6
9 9
3 3
1 merge

4 5 4 5

 Adjacent face normals should not flip


 Disallow foldover, or simply weight heavily
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

Original model Edge Contractions


(4,204 faces) (250 faces)

Uniform Vertex Clustering Pair Contractions


(262 faces) (250 faces)
courtesy Garland, Heckbert
Image-Driven Simplification
 [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
 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
Screen Space Error

y+ε sin θ ε θ
z+ε cos θ y,z
εs
y/z

Eye

y+ε sin θ y/z


εs = z+ε cos θ
Image
Plane
Screen Space Error


LOD

d
viewing p
plane r d dr
p 2 
 z 2 
2 z tan( )
eye 2
Appearance Preservation

 Preserve three appearance attributes:


 Surface Position
 Surface Curvature

 Material Color

 Each may require different sampling


Normals Undersampled

13,433 triangles 1,749 triangles


10 pixels of surface deviation
Normals Properly Sampled

13,433 triangles 1,749 triangles,


10 pixels of deviation
Recall

v2, c2, n2
 Filters surface
position, colors, and
normals
v3, c3, n3  Must filter all three
v1, c1, n1 equally

v = vertex coordinate = (x,y,z)


c = color = (r,g,b)
n = normal = (nx,ny,nz)
Decoupled Representation
v 2, t 2 texture map
c2
c3 c1

v 1, t 1
v3, t3
normal map
v = vertex coordinate = (x,y,z) n2
t = texture coordinate = (u,v) n 3 n1
c = color = (r,g,b)
n = normal vector = (nx,ny,nz)
Decoupled Approach

 Simplification filters surface position and


texture coordinates

 Color and normal attributes filtered per-


pixel (mip-mapping, etc.)
Sample Normal Map

polygonal surface patch normal map


Texture Deviation Metric
mesh Mi
(i+1)st edge collapse mesh Mi+1

Xi
Xi+1

x
ei,i+1(x) = || xi+1 - xi ||
P
Ei,i+1 = max ei,i+1(x)
2D texture domain xP
New Texture Coordinates

Invalid texnew Valid choices lie in convex kernel


Texture Deviation Error

Texture Space

1
Ei ( X ) || X  T0 (Ti ( X )) ||
APS Levels-of-detail

7,809 tris
488 tris
975 tris

1,951 tris

3,905 tris

courtesy J. Cohen
Terrains
 Uniform array of height values
 May encode in raster formats (DEM, GeoTIFF)
 Store Z instead of color

 Easy to interpolate to find elevations


 Easy view culling
 There also are TINs
 Triangulated Irregular Networks
TINs

 Fewer polygons needed


 Adaptively sampled
 Precisely model maxima, minima, ridges,
valleys, overhangs, caves
LOD Hierarchy Structures

QuadTree Hierarchy

BinTree Hierarchy
Quadtrees
 Each quad is actually two triangles
 Produces cracks and T-junctions
 But simple
Bintrees

 Binary Triangle tree


 Right triangular irregular networks (RTIN)
 longest edge bisection

 Easier to avoid cracks and T-junctions


 Neighbor must be at adjacent levels
Cracks and T-Junctions

 Avoid cracks:
 Convert cracks into T-junctions
 Fill cracks with extra triangles
 Avoid T-junctions:
 Continue to simplify ...
Bin-tree and T-junction
Terrain as a Pyramid
•Terrain as mipmap pyramid
•LOD using nested grids

Coarsest Level

Finest Level [Losasso & Hoppe 2005]


Geometry Clip Maps
 Transition region
 Insert “0 area” triangles
 Damp refined vertices as they get close to the
coarser level
Geometry Clip Maps
 Transition region
 Insert 0 area triangles
 Damp refined vertices as they get close to the
coarser level
Texture Mapping PM
 [Sander et al, 2001]

Você também pode gostar