46
Advanced Computer Graphics Advanced Computer Graphics (Spring 2013) (Spring 2013) Mesh representation, overview of mesh simplification Many slides courtesy Szymon Rusinkiew

Advanced Computer Graphics (Spring 2013)

Embed Size (px)

DESCRIPTION

Advanced Computer Graphics (Spring 2013). Mesh representation, overview of mesh simplification. Many slides courtesy Szymon Rusinkiewicz. Motivation. A polygon mesh is a collection of triangles We want to do operations on these triangles - PowerPoint PPT Presentation

Citation preview

Page 1: Advanced Computer Graphics                    (Spring 2013)

Advanced Computer Graphics Advanced Computer Graphics (Spring 2013) (Spring 2013)

Mesh representation, overview of mesh simplification

Many slides courtesy Szymon Rusinkiewicz

Page 2: Advanced Computer Graphics                    (Spring 2013)

MotivationMotivation

A polygon mesh is a collection of triangles

We want to do operations on these triangles E.g. walk across the mesh for simplification Display for rendering Computational geometry

Best representations (mesh data structures)? Compactness Generality Simplicity for computations Efficiency

Page 3: Advanced Computer Graphics                    (Spring 2013)

Desirable Characteristics 1

Generality – from most general to least Polygon soup Only triangles 2-manifold ≤ 2 triangles per edge Orientable consistent CW / CCW winding Closed no boundary

Compact storage

Mesh Data StructuresMesh Data Structures

Page 4: Advanced Computer Graphics                    (Spring 2013)

Mesh Data StructuresMesh Data Structures

Desirable characteristics 2

Efficient support for operations: Given face, find its vertices Given vertex, find faces touching it Given face, find neighboring faces Given vertex, find neighboring vertices Given edge, find vertices and faces it touches

These are adjacency operations important in mesh simplification, many other applications

Page 5: Advanced Computer Graphics                    (Spring 2013)

Outline Outline

Independent faces

Indexed face set

Adjacency lists

Winged-edge

Half-edge

Overview of mesh decimation and simplification

Page 6: Advanced Computer Graphics                    (Spring 2013)

Independent FacesIndependent Faces

Faces list vertex coordinates Redundant vertices No topology information

Face TableFace TableFF00: (x: (x00,y,y00,z,z00), (x), (x11,y,y11,z,z11), (x), (x22,y,y22,z,z22))

FF11: (x: (x33,y,y33,z,z33), (x), (x44,y,y44,z,z44), (x), (x55,y,y55,z,z55))

FF22: (x: (x66,y,y66,z,z66), (x), (x77,y,y77,z,z77), (x), (x88,y,y88,z,z88))

FF00

FF11

FF22

Page 7: Advanced Computer Graphics                    (Spring 2013)

Indexed Face SetIndexed Face Set

Faces list vertex references – “shared vertices”

Commonly used (e.g. OFF file format itself)

Augmented versions simple for mesh processing

Vertex TableVertex Tablevv00: (x: (x00,y,y00,z,z00))

vv11: (x: (x11,y,y11,z,z11))

vv22: (x: (x22,y,y22,z,z22))

vv33: (x: (x33,y,y33,z,z33))

vv44: (x: (x44,y,y44,z,z44))

Face TableFace TableFF00: 0, 1, 2: 0, 1, 2

FF11: 1, 4, 2: 1, 4, 2

FF22: 1, 3, 4: 1, 3, 4

Note CCW orderingNote CCW ordering

FF00

FF11

FF22

vv00 vv11 vv33

vv44vv22

Page 8: Advanced Computer Graphics                    (Spring 2013)

Indexed Face SetIndexed Face Set

Storage efficiency?

Which operations supported in O(1) time?

Vertex TableVertex Tablevv00: (x: (x00,y,y00,z,z00))

vv11: (x: (x11,y,y11,z,z11))

vv22: (x: (x22,y,y22,z,z22))

vv33: (x: (x33,y,y33,z,z33))

vv44: (x: (x44,y,y44,z,z44))

Face TableFace TableFF00: 0, 1, 2: 0, 1, 2

FF11: 1, 4, 2: 1, 4, 2

FF22: 1, 3, 4: 1, 3, 4

Note CCW orderingNote CCW ordering

FF00

FF11

FF22

vv00 vv11 vv33

vv44vv22

Page 9: Advanced Computer Graphics                    (Spring 2013)

Efficient Algorithm DesignEfficient Algorithm Design

Can sometimes design algorithms to compensate for operations not supported by data structures

Example: per-vertex normals Average normal of faces touching each vertex With indexed face set, vertex face is O(n) Naive algorithm for all vertices: O(n2) Can you think of an O(n) algorithm?

Page 10: Advanced Computer Graphics                    (Spring 2013)

Efficient Algorithm DesignEfficient Algorithm Design

Can sometimes design algorithms to compensate for operations not supported by data structures

Example: per-vertex normals Average normal of faces touching each vertex With indexed face set, vertex face is O(n) Naive algorithm for all vertices: O(n2) Can you think of an O(n) algorithm?

Useful to augment with vertex face adjacency For all vertices, find adjacent faces as well Can be implemented while simply looping over faces

Page 11: Advanced Computer Graphics                    (Spring 2013)

Outline Outline

Independent faces

Indexed face set

Adjacency lists

Winged-edge

Half-edge

Overview of mesh decimation and simplification

Page 12: Advanced Computer Graphics                    (Spring 2013)

Full Adjacency ListsFull Adjacency Lists

Store all vertex, face,and edge adjacencies

FF00

FF11

FF22

vv00 vv11 vv33

vv44vv22

ee22

ee00 ee33

ee44

ee66

ee11

ee55

Edge Adjacency TableEdge Adjacency Tableee00: v: v00, v, v11; F; F00,,; ; ,e,e22,e,e11,,ee11: v: v11,v,v22; F; F00,F,F11; e; e55,e,e00,e,e22,e,e66……

Face Adjacency TableFace Adjacency TableFF00: v: v00,v,v11,v,v22; F; F11,,,,; e; e00,e,e22,e,e00

FF11: v: v11,v,v44,v,v22; ; ,F,F00,F,F22; e; e66,e,e11,e,e55

FF22: v: v11,v,v33,v,v44; ; ,F,F11,,; e; e44,e,e55,e,e33

Vertex Adjacency TableVertex Adjacency Tablevv00: v: v11,v,v22; F; F00; e; e00,e,e22

vv11: v: v33,v,v44,v,v22,v,v00; F; F22,F,F11,F,F00; e; e33,e,e55,e,e11,e,e00……

Page 13: Advanced Computer Graphics                    (Spring 2013)

Full adjacency: IssuesFull adjacency: Issues

Garland and Heckbert claim they do this

Easy to find stuff

Issue is storage

And updating everything once you do something like an edge collapse for mesh simplification

I recommend you implement something simpler (like indexed face set plus vertex to face adjacency)

Page 14: Advanced Computer Graphics                    (Spring 2013)

Partial Adjacency ListsPartial Adjacency Lists

Store some adjacencies,use to derive others

Many possibilities…

Edge Adjacency TableEdge Adjacency Tableee00: v: v00, v, v11; F; F00,,; ; ,e,e22,e,e11,,ee11: v: v11,v,v22; F; F00,F,F11; ; ee55,e,e00,e,e22,e,e66……

Face Adjacency TableFace Adjacency TableFF00: v: v00,v,v11,v,v22; ; FF11,,,,;; e e00,e,e22,e,e00

FF11: v: v11,v,v44,v,v22; ; ,F,F00,F,F22;; e e66,e,e11,e,e55

FF22: v: v11,v,v33,v,v44; ; ,F,F11,,;; e e44,e,e55,e,e33

Vertex Adjacency TableVertex Adjacency Tablevv00: : vv11,v,v22;; F F00; ; ee00,e,e22

vv11: : vv33,v,v44,v,v22,v,v00;; F F22,F,F11,F,F00; ; ee33,e,e55,e,e11,e,e00……

FF00

FF11

FF22

vv00 vv11 vv33

vv44vv22

ee22

ee00 ee33

ee44

ee66

ee11

ee55

Page 15: Advanced Computer Graphics                    (Spring 2013)

Partial Adjacency ListsPartial Adjacency Lists

Some combinations onlymake sense for closedmanifolds

Edge Adjacency TableEdge Adjacency Tableee00: v: v00, v, v11; F; F00,,; ; ,e,e22,e,e11,,ee11: v: v11,v,v22; F; F00,F,F11; e; e55,e,e00,e,e22,e,e66……

Face Adjacency TableFace Adjacency TableFF00: v: v00,v,v11,v,v22; F; F11,,,,; ; ee00,e,e22,e,e00

FF11: v: v11,v,v44,v,v22; ; ,F,F00,F,F22; ; ee66,e,e11,e,e55

FF22: v: v11,v,v33,v,v44; ; ,F,F11,,; ; ee44,e,e55,e,e33

Vertex Adjacency TableVertex Adjacency Tablevv00: : vv11,v,v22;; F F00; ; ee00,e,e22

vv11: : vv33,v,v44,v,v22,v,v00;; F F22,,FF11,F,F00; e; e33,e,e55,e,e11,e,e00……

FF00

FF11

FF22

vv00 vv11 vv33

vv44vv22

ee22

ee00 ee33

ee44

ee66

ee11

ee55

Page 16: Advanced Computer Graphics                    (Spring 2013)

Outline Outline

Independent faces

Indexed face set

Adjacency lists

Winged-edge

Half-edge

Overview of mesh decimation and simplification

Page 17: Advanced Computer Graphics                    (Spring 2013)

Winged, Half Edge RepresentationsWinged, Half Edge Representations

Idea is to associate information with edges

Compact Storage

Many operations efficient

Allow one to walk around mesh

Usually general for arbitrary polygons (not triangles)

But implementations can be complex with special cases relative to simple indexed face set++ or partial adjacency table

Page 18: Advanced Computer Graphics                    (Spring 2013)

Winged EdgeWinged Edge

Most data stored at edges

Verts, faces point toone edge each

Edge Adjacency TableEdge Adjacency Tableee00: v: v00, v, v11; F; F00,,; ; ,e,e22,e,e11,,ee11: v: v11,v,v22; F; F00,F,F11; e; e55,e,e00,e,e22,e,e66……

Face Adjacency TableFace Adjacency TableFF00: : vv00,v,v11,v,v22;; FF11,,,,;; e e00,,ee22,e,e00

FF11: : vv11,v,v44,v,v22; ; ,F,F00,F,F22;; e e66,,ee11,e,e55

FF22: : vv11,v,v33,v,v44; ; ,F,F11,,;; e e44,,ee55,e,e33

Vertex Adjacency TableVertex Adjacency Tablevv00: : vv11,v,v22;; FF00;; e e00,e,e22

vv11: : vv33,v,v44,v,v22,v,v00;; FF22,F,F11,F,F00;; e e33,e,e55,e,e11,e,e00……

FF00

FF11

FF22

vv00 vv11 vv33

vv44vv22

ee22

ee00 ee33

ee44

ee66

ee11

ee55

Page 19: Advanced Computer Graphics                    (Spring 2013)

Winged EdgeWinged Edge

Each edge stores 2 vertices, 2 faces, 4 edges – fixed size

Enough information to completely “walk around” faces or vertices

Think how to implement Walking around vertex Finding neighborhood of face Other ops for simplification vvbeginbegin

vvendend

FFleftleft FFrightright

eeforw,rightforw,righteeforw,leftforw,left

eeback,leftback,left eeback,rightback,right

Page 20: Advanced Computer Graphics                    (Spring 2013)

Half EdgeHalf Edge

Instead of single edge, 2 directed “half edges”

Makes some operations more efficient

Walk around face very easily (each face need only store one pointer)

vvbeginbegin

hehenextnext

FFleftleft heheinvinv

Page 21: Advanced Computer Graphics                    (Spring 2013)

Outline Outline

Independent faces

Indexed face set

Adjacency lists

Winged-edge

Half-edge

Overview of mesh decimation and simplification

Page 22: Advanced Computer Graphics                    (Spring 2013)

Mesh DecimationMesh Decimation

TriangleTriangles: s:

41,855 41,855 27,970 27,970 20,922 20,922 12,939 12,939 8,385 8,385 4,7664,766

Division, Viewpoint, CohenDivision, Viewpoint, Cohen

Multi-resolution hierarchies for efficient geometry processing and level of detail rendering

Page 23: Advanced Computer Graphics                    (Spring 2013)

Oversampled 3D scan data

Page 24: Advanced Computer Graphics                    (Spring 2013)

Adapt to hardware capabilitiesAdapt to hardware capabilities

Page 25: Advanced Computer Graphics                    (Spring 2013)

Mesh DecimationMesh Decimation

Reduce number of polygons Less storage Faster rendering Simpler manipulation

Desirable properties Generality Efficiency Produces “good” approximation

Michelangelo’s St. MatthewMichelangelo’s St. MatthewOriginal model: ~400M polygonsOriginal model: ~400M polygons

Page 26: Advanced Computer Graphics                    (Spring 2013)

Primitive OperationsPrimitive Operations

Simplify model a bit at a time byremoving a few faces (mesh simplification) Repeated to simplify whole mesh

Types of operations Vertex cluster Vertex remove Edge collapse (main operation used in assignment)

Page 27: Advanced Computer Graphics                    (Spring 2013)

Vertex ClusterVertex Cluster

Method Merge vertices based on proximity Triangles with repeated vertices can collapse to edges or points

Properties General and robust Can be unattractive if results in topology change

Page 28: Advanced Computer Graphics                    (Spring 2013)

Vertex ClusteringVertex Clustering

Cluster generation Hierarchical approach Top-down or bottom up

Computing a representative Average / median vertex position Error quadrics

Mesh generation

Topology changes

Further reading: Model simplification using vertex clustering, Low and Tan, I3D, 1997.

Page 29: Advanced Computer Graphics                    (Spring 2013)

Best approachBest approach

Page 30: Advanced Computer Graphics                    (Spring 2013)

Vertex RemoveVertex Remove

Method Remove vertex and adjacent faces Fill hole with new triangles (reduction of 2)

Properties Requires manifold surface, preserves topology Typically more attractive Filling hole well not always easy

Page 31: Advanced Computer Graphics                    (Spring 2013)

Vertex RemovalVertex Removal

Page 32: Advanced Computer Graphics                    (Spring 2013)

Edge CollapseEdge Collapse

Method Merge two edge vertices to one Delete degenerate triangles (triangle formed by three collinear points)

Properties Special case of vertex cluster Allows smooth transition Can change topology

Page 33: Advanced Computer Graphics                    (Spring 2013)

Half-edge collapseHalf-edge collapse

Page 34: Advanced Computer Graphics                    (Spring 2013)

Half-Edge CollapseHalf-Edge Collapse

Page 35: Advanced Computer Graphics                    (Spring 2013)

Mesh Decimation/SimplificationMesh Decimation/Simplification

Typical: greedy algorithm Measure error of possible “simple” operations (primarily

edge collapses) Place operations in queue according to error Perform operations in queue successively (depending on

how much you want to simplify model) After each operation, re-evaluate error metrics

Page 36: Advanced Computer Graphics                    (Spring 2013)

Geometric Error MetricsGeometric Error Metrics

Motivation Promote accurate 3D shape preservation Preserve screen-space silhouettes and pixel coverage

Types Vertex-Vertex Distance Vertex-Plane Distance Point-Surface Distance Surface-Surface Distance

Page 37: Advanced Computer Graphics                    (Spring 2013)

Vertex-Vertex DistanceVertex-Vertex Distance

E = max(|v3v1|, |v3v2|)

Appropriate during topology changes Rossignac and Borrel 93 Luebke and Erikson 97

Loose for topology-preserving collapses

vv11vv22

vv33

Page 38: Advanced Computer Graphics                    (Spring 2013)

Vertex-Plane DistanceVertex-Plane Distance

Store set of planes with each vertex Error based on distance from vertex to planes When vertices are merged, merge sets

Ronfard and Rossignac 96 Store plane sets, compute max distance

Error Quadrics – Garland and Heckbert 96 Store quadric form, compute sum of squared distances

aabb cc

ddaa

ddbb

ddcc

Page 39: Advanced Computer Graphics                    (Spring 2013)

Point-Surface DistancePoint-Surface Distance

For each original vertex,find closest point on simplified surface

Compute sum of squared distances

Page 40: Advanced Computer Graphics                    (Spring 2013)

Surface-Surface DistanceSurface-Surface Distance

Compute or approximate maximum distance between input and simplified surfaces Tolerance Volumes - Guéziec 96 Simplification Envelopes - Cohen/Varshney 96 Hausdorff Distance - Klein 96 Mapping Distance - Bajaj/Schikore 96, Cohen et al. 97

Page 41: Advanced Computer Graphics                    (Spring 2013)

Geometric Error ObservationsGeometric Error Observations

Vertex-vertex and vertex-plane distance Fast Low error in practice, but not guaranteed by metric

Surface-surface distance Required for guaranteed error bounds

Edge swapEdge swap

vertex-vertex ≠ surface-surface

Page 42: Advanced Computer Graphics                    (Spring 2013)

Topology changesTopology changes

Marge vertices across non-edges Changes mesh topology Need spatial neighborhood information Generates non-manifold meshes

Page 43: Advanced Computer Graphics                    (Spring 2013)

Mesh SimplificationMesh Simplification

Advanced Considerations

Type of input mesh, Modifies topology, Continuous LOD, Speed vs. quality

Vertex clustering is fast but difficult to control simplified mesh that will leads to the previously mentioned errors

Page 44: Advanced Computer Graphics                    (Spring 2013)

View-Dependent SimplificationView-Dependent Simplification

Simplify dynamically according to viewpoint Visibility Silhouettes Lighting

HoppeHoppe

Page 45: Advanced Computer Graphics                    (Spring 2013)

7,809 tris7,809 tris

3,905 tris3,905 tris

1,951 tris1,951 tris

488 tris488 tris

975 tris975 tris

Appearance PreservingAppearance Preserving

Caltech & Stanford Graphics Labs and Caltech & Stanford Graphics Labs and Jonathan CohenJonathan Cohen

Page 46: Advanced Computer Graphics                    (Spring 2013)

SummarySummary

Many mesh data structures Compact storage vs ease, efficiency of use How fast and easy are key operations

Mesh simplification Reduce size of mesh in efficient quality-preserving way Based on edge collapses mainly

Choose appropriate mesh data structure Efficient to update, edge-collapses are local

Material covered in text Classical approaches to simplification Quadric metrics next week