Transcript Document

CSL 859: Advanced
Computer Graphics
Dept of Computer Sc. & Engg.
IIT Delhi
Mesh

List of triangles

Each is a triplet of Vertices


Euler’s relation:


Each is an array of attributes
V + F -2 = E
Adjacency list
List of vertices
 List of “pointers”
 A vertex referred ~6 times (closed model)

Vertex & Topology
Vertex Attributes
..A..
..B..
..C..
..D..
..E..
..F..
What order should
we choose?
C
Topology
015
135
123
534
654
056
Post vertex shader cache
D
B
E
F
A
G
Triangle Strip
Vertex Attributes
..A..
..B..
..C..
..D..
..E..
..F..
C
D
B
Topology
ABFDE
AFGE
BCD
E
F
A
Can we turn any given
model into a single strip?
Would that eliminate the
need for storing topology?
G
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
xyzuvabc
V1
xyzuvabc
x0 x1 x2 x3
y0 y1 y2 y3
Half-Edge Data Structure
Vertex List
..V0..
..V1..
..V2..
..V3..
.
.
Face List
E0 E2 E1
E5 E4 E3
.
.
Edge List
V0 V1, F0, E1 E2, E5
..
V1 V0, F1, E3 E4, E0
..
V1
E2
F0
E1
E5
E3
F1
E0
E4
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
.
.
Edge is oriented based on
one of its faces: left or right
V1
E3
F1
E2
F0
E1
E0
E4
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
vr
vl
vs
vl
v’s
vr
Simplification
13,546
^
n
M=M
ecoln-1
500
152
M175
150
M1
ecoli
M0
ecol0
courtesy H. Hoppe
Inverse?
parameters
vspl(vs ,vl ,vr , vs’ ,vt’ ,…)
v’t
vl
vs
vr
vr
vl
v’s
Reconstruction
150
152
M0
500
M1
vspl0
13,546
^
Mn=M
M175
… 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
Mi
^
Mn=M
courtesy H. Hoppe
Vertex Correspondence
Mn
Mf
Mf-1
Mf-2
Mc
v1
v2
v3
v4
v5
v6
v7
v8
v1
v2
v3
v4
v5
v6
v7
v1
v2
v3
v4
v5
v6
v1
v2
v3
ecol
ecol
ecol
M0
courtesy H. Hoppe
Space Overhead
vspl(vs ,vl ,vr , v’s ,v’t ,…)
v’t
vl
vs vr
vl
v’s
vr
Attrib deltas:
vt -’ vs
vs -’ vs
…
Topology:
 Index of v
s
 Pair of index offsets
Selective Refinement
M0
What’s the problem?
vspl0
vspl1
vspli-1
vspln-1
courtesy H. Hoppe
Parent-Child Correspondence
vs
vsplit
vt
vu
Vertex Hierarchy
PM: M0
vspl0
vspl2
v1
M0
v10
Mn v12
vspl1
vspl3
vspl4
v2
v11
v4
v13
[Xia & Varshney 96]
v3
v5
v6
v14
vspl5
v8
v7
v15
v9
Selective Refinement
M0
vspl0
vspl2
v1
M0
v10
v12
vspl1
vspl3
vspl4
v2
v11
v4
v13
selectively refined mesh
v3
v5
v6
v14
vspl5
v8
v9
v7
v15
Restrictions?
Dependencies
vsplit
vl
vs
vr
v’t
vr
vl
v’s
ecol
 vsplit legal if vs, vl , and vr present

ecol legal if local neighbors present
[Xia & Varshney 96]
Consistency
vsplit
fn1
fn3
vs
fn0
fn2
ecol
fn1
v’u
fn0
v’t
fn3
fn2
vsplit legal if:
vs is active
fn0,fn1,fn2,fn3 are active
ecol legal if:
[Hoppe 97]
v’s,v’t are active
fn0,fn1,fn2,fn3 are adjacent
Rendering Algorithm

Start with the active front in previous frame.



For each vertex, decided refine or coarsen
If legal, perform operation, otherwise:



Exploits frame coherence
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
v1
M0
v10
v12
v2
v11
v4
v13
previous mesh
v3
v5
v6
v8
v9
v7
dependency
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


Lazy optimization


Re-insert modified edges after each step
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
shape
face areas
S
points
 escalars )dA 
 (e
disc
disc. edges
)dL
S
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

Merge vertices
v’s
Quadric Error Metric

Plane equation for a face:
Ax  By  Cz  D  0
p:


Distance to vertex v :
pT × v  [A
Distance to vertex v :
D( v ) 
x 
y
D ]× 
1z 
B C
( p
T
v) 2
p planes ( v )

(v
T
p planes ( v )
T
p )( p v )

v
T
p planes ( v )
T
( pp )v

 v  ppT
pplanes ( v )
T

÷
÷v

Quadric Error (cont’d)
 A2

AB
T


pp
 AC

AD
AC AD 

BC BD 
C2 CD 
2 
BD CD D 
AB
B2
BC

Sum over all planes intersecting at v

Call it Q, the quadric error
D(v) vT (Q)v
Quadrics Based Simplification


Maintain quadric Q for every vertex
v1
Assign Edge Quadrics
Q1


v2
Q  Q1  Q2
Sort edges based on quadric error
Need position of resulting vertex
D(v) vT (Q)v

One of original vertices or mid-point?
Q2
Optimal Vertex Placement

Minimize Q to calculate optimal
coordinates for placing new vertex
 q11
q
12


V 
 q13
0

q12
q13
q 22
q 23
q 23
q33
0
0
q14 
q 24 

q34 

1
1
0 
0 
 
0 
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
A
9
3

A
9
5
6
3
merge
1
4
10
6
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
(4,204 faces)
Uniform Vertex Clustering
(262 faces)
Edge Contractions
(250 faces)
Pair Contractions
(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 θ
εs
ε θ
y,z
y/z
Eye
y+ε sin θ
εs = z+ε
cos θ
Image
Plane
y/z
Screen Space Error

LOD
d
viewing
plane
p
r

eye
p
d
z
2

dr
2

2 z tan( )
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
v3, c3, n3


v1, c1, n1
v = vertex coordinate = (x,y,z)
c = color = (r,g,b)
n = normal = (nx,ny,nz)
Filters surface
position, colors,
and normals
Must filter all
three equally
Decoupled Representation
texture map
c2
c3 c1
v2, t2
v1, t1
v 3, t 3
v = vertex coordinate = (x,y,z)
t = texture coordinate = (u,v)
c = color = (r,g,b)
n = normal vector = (nx,ny,nz)
normal map
n2
n3 n1
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
P
2D texture domain
ei,i+1(x) = || xi+1 - xi ||
Ei,i+1 = max ei,i+1(x)
xP
New Texture Coordinates
Invalid texnew
Valid choices lie in convex kernel
Texture Deviation Error
Texture Space
X
Ei ( X ) || X
1
 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]