Title: CSL%20859:%20Advanced%20Computer%20Graphics
1CSL 859 Advanced Computer Graphics
- Dept of Computer Sc. Engg.
- IIT Delhi
2Mesh
- List of triangles
- Each is a triplet of Vertices
- Each is an array of attributes
- Eulers relation
- V F -2 E
- Adjacency list
- List of vertices
- List of pointers
- A vertex referred 6 times (closed model)
3Vertex 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
4Triangle 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?
5Post Shader Cache
- Perfect Triangle Strip of n triangles gt
- 1 new vertex per triangle
- n-2 cache misses
- Can we do better?
- Eulers law V F E 2
- V 0.5F (E 1.5F for closed model)
- Yes (Ideal 0.5verts/triangle)
- Chhugani Kumar, I3D 2007
6Vertex 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
7Half-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
8Winged-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
9Mesh Simplification
Ideally, the change is incremental
courtesy H. Hoppe
10Nominal 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
11Competing 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
12Attributes
- Color
- Normal Vectors
- Texture Coordinates
- Curvature
- Material Properties
13Topology 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
14Possible 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
15Reduce Geometry Count
- Remove a vertex
- That leave a hole
- Retriangulate the hole
Schroeder et al., 1992
16Simple Operation
- Collapse edges, one at a time
vt
vl
vr
vs
17Simplification
13,546
500
152
150
M0
M1
M175
ecol0
ecoli
ecoln-1
courtesy H. Hoppe
18Inverse?
parameters
vspl(vs ,vl ,vr , vs ,vt ,)
19Reconstruction
Progressive Mesh (PM) representation
courtesy H. Hoppe
20Continuous LOD
- From PM, extract Mi of any size
3,478 faces?
M0
vspl0
vspl1
vspli-1
vspln-1
Mi
courtesy H. Hoppe
21Vertex Correspondence
Mc
Mf
M0
v1
v1
Mn
v2
v2
v3
v3
v4
v5
v6
v7
v8
courtesy H. Hoppe
22Space Overhead
vspl(vs ,vl ,vr , vs ,vt ,)
- Attrib deltas
- vt - vs
- vs - vs
- Topology
- Index of vs
- Pair of index offsets
23Selective Refinement
M0
vspl0
vspl1
vspli-1
vspln-1
Whats the problem?
courtesy H. Hoppe
24Parent-Child Correspondence
vs
vsplit
vu
vt
25Vertex Hierarchy
vspl0
M0
vspl1
vspl2
vspl3
vspl4
vspl5
PM
v2
v1
v3
M0
Xia Varshney 96
26Selective Refinement
vspl2
vspl0
M0
vspl1
vspl3
vspl4
vspl5
v2
v1
v3
M0
Restrictions?
27Dependencies
vsplit
ecol
- vsplit legal if vs, vl , and vr present
- ecol legal if local neighbors present
Xia Varshney 96
28Consistency
vsplit
ecol
vsplit legal if vs is active fn0,fn1,fn2,fn3
are active ecol legal if vs,vt are
active fn0,fn1,fn2,fn3 are adjacent
Hoppe 97
29Rendering 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
30Rendering Algorithm
v1
v2
v3
M0
v5
v10
v11
v4
v8
v9
v7
v12
v13
v6
v12
v14
v15
31LOD 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
32Error Metric
- Preserve appearance
- Geometric shape
- Scalar fields (e.g. color)
- Discontinuity curves
courtesy H. Hoppe
33Measuring 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
34Measuring Geometric Error
- Surface-surface
- Hausdorff distance
- Vertex-surface vs
- Vertex-plane
- Vertex-vertex
- Average distance or Max distance
35Quadric Error
- Garland Heckbert 1998
- Measure error by deviation from shape
- Vertices are at intersection of planes
- Do not collapse edges
- Merge vertices
vt
vs
36Quadric Error Metric
- Plane equation for a face
37Quadric Error (contd)
- Sum over all planes intersecting at v
- Call it Q, the quadric error
38Quadrics Based Simplification
- Maintain quadric Q for every vertex
- Assign Edge Quadrics
v1
v2
Q1
Q2
Q
Q
Q
2
1
- Sort edges based on quadric error
- Need position of resulting vertex
- One of original vertices or mid-point?
39Optimal Vertex Placement
- Minimize Q to calculate optimal coordinates for
placing new vertex
40Boundary Preservation
- Label boundaries
- Form boundary plane perpendicular to face
- Convert planes into quadrics
- Weighted sum of quadrics
- Scale border plane quadric higher
41Preventing Mesh Inversion
- Preventing foldovers
- Adjacent face normals should not flip
- Disallow foldover, or simply weight heavily
7
8
2
10
A
6
9
3
merge
1
5
4
42Quadric 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)
43Result Bunny Model
69,451 triangles
1,000 triangles
100 triangles
1.4 of original size
0.14 of original size
courtesy Garland, Heckbert
44Result Terrain Model
199,114 faces
999 faces (46 secs)
courtesy Garland, Heckbert
45Method Comparison
Edge Contractions
Original model
(250 faces)
(4,204 faces)
Uniform Vertex Clustering
Pair Contractions
(262 faces)
(250 faces)
courtesy Garland, Heckbert
46Image-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
47Image-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!
48Image-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)
49Screen Space Error
- Depends on location and orientation of error
vector - We dont even store error vectors
50Screen Space Error
e
?
y,z
es
y/z
Eye
Image Plane
51Screen Space Error
e
LOD
d
p
viewing
plane
r
q
eye
52Appearance Preservation
- Preserve three appearance attributes
- Surface Position
- Surface Curvature
- Material Color
- Each may require different sampling
53Normals Undersampled
1,749 triangles 10 pixels of surface deviation
13,433 triangles
54Normals Properly Sampled
1,749 triangles, 10 pixels of deviation
13,433 triangles
55Recall
v2, c2, n2
- Filters surface position, colors, and normals
- Must filter all three equally
v3, c3, n3
v1, c1, n1
v vertex coordinate (x,y,z) c color
(r,g,b) n normal (nx,ny,nz)
56Decoupled Representation
texture map
v2, t2
c2
c1
c3
v1, t1
v3, t3
normal map
n2
v vertex coordinate (x,y,z) t texture
coordinate (u,v) c color (r,g,b) n normal
vector (nx,ny,nz)
n3
n1
57Decoupled Approach
- Simplification filters surface position and
texture coordinates - Color and normal attributes filtered per-pixel
(mip-mapping, etc.)
58Sample Normal Map
polygonal surface patch
normal map
59Texture Deviation Metric
mesh Mi
mesh Mi1
(i1)st edge collapse
Xi
Xi1
x
ei,i1(x) xi1 - xi Ei,i1 max
ei,i1(x) xÃŽP
P
2D texture domain
60New Texture Coordinates
Invalid texnew
Valid choices lie in convex kernel
61Texture Deviation Error
Texture Space
X
62APS Levels-of-detail
7,809 tris
488 tris
975 tris
1,951 tris
3,905 tris
courtesy J. Cohen
63Terrains
- 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
64TINs
- Fewer polygons needed
- Adaptively sampled
- Precisely model maxima, minima, ridges, valleys,
overhangs, caves
65LOD Hierarchy Structures
QuadTree Hierarchy
BinTree Hierarchy
66Quadtrees
- Each quad is actually two triangles
- Produces cracks and T-junctions
- But simple
67Bintrees
- Binary Triangle tree
- Right triangular irregular networks (RTIN)
- longest edge bisection
- Easier to avoid cracks and T-junctions
- Neighbor must be at adjacent levels
68Cracks and T-Junctions
- Avoid cracks
- Convert cracks into T-junctions
- Fill cracks with extra triangles
- Avoid T-junctions
- Continue to simplify ...
69Bin-tree and T-junction
70Terrain as a Pyramid
- Terrain as mipmap pyramid
- LOD using nested grids
Coarsest Level
Finest Level
Losasso Hoppe 2005
71Geometry Clip Maps
- Transition region
- Insert 0 area triangles
- Damp refined vertices as they get close to the
coarser level
72Geometry Clip Maps
- Transition region
- Insert 0 area triangles
- Damp refined vertices as they get close to the
coarser level
73Texture Mapping PM