Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

67
Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    229
  • download

    0

Transcript of Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Page 1: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Polygonal Mesh –Data Structure and Processing

Chiew-Lan Tai

Page 2: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

What is a Mesh?

Page 3: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

What is a Mesh?

A Mesh is a pair (P,K), where P is a set of point positions

and K is an abstract simplicial complex which contains all topological information.

K is a set of subsets of : Vertices Edges Faces

}1|{ 3 niRpP i

Viv }{Ejie },{

Fiiiffn

},...,,{ 21

},,1{ N

FEVK

Page 4: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

What is a Mesh?

Each edge must belong to at least one face, i.e.

Each vertex must belong to at least one edge, i.e.

An edge is a boundary edge if it only belongs to one face

FikjifEkjefn

},,,,,{ iff },{ 1

EjieVjv },{ iff }{

Page 5: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

What is a Mesh?

A mesh is a manifold if Every edge is adjacent to one

(boundary) or two faces For every vertex, its adjacent

polygons form a disk (internal vertex) or a half-disk (boundary vertex) Non-manifold

Manifold

A mesh is a polyhedron if It is a manifold mesh and it is closed (no boundary) Every vertex belongs to a cyclically ordered set of

faces (local shape is a disk)

Page 6: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Orientation of Faces

Each face can be assigned an orientation by defining the ordering of its vertices

Orientation can be clockwise or counter-clockwise.

The orientation determines the normal direction of face. Usually counterclockwise order is the “front” side.

Page 7: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Orientation of Faces

A mesh is well oriented (orientable) if all faces can be oriented consistently (all CCW or all CW) such that each edge has two opposite orientations for its two adjacent faces

Not every mesh can be well oriented.e.g. Klein bottle, Möbius strip

non-orientable surfaces

Page 8: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Euler Formula

The relation between the number of vertices, edges, and faces.

where V : number of vertices E : number of edges F : number of faces

2 FEV

Page 9: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Euler Formula

Tetrahedron V = 4 E = 6 F = 4 4 - 6 + 4 = 2

Cube V = 8 E = 12 F = 6 8 -12 + 6 = 2

Octahedron V = 6 E = 12 F = 8 6 -12 + 8 = 2

V = 8E = 12F = 68 - 12 + 6 = 2

V = 8E = 12 + 1 = 13F = 6 + 1 = 78 - 13 + 7 = 2

Page 10: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Euler Formula

More general rule

where V : number of vertices E : number of edges F : number of faces C : number of connected components G : number of genus (holes, handles) B : number of boundaries

BGCFEV )(2

V = 16E = 32F = 16C = 1G = 1B = 016 – 32 + 16 = 2 (1 - 1) - 0

Page 11: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Data Structure

Page 12: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Neighborhood Relations

Page 13: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Neighborhood Relations

For a vertex All neighboring vertices All neighboring edges All neighboring faces

Knowing some types of relation,we can discover other (but not necessary all)topological information

e.g. if in addition to VV, VE and VF, we know neighboring vertices of a face, we can discover all neighboring edges of the face

Page 14: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Choice of Data Structure

Criteria for choosing a particular data structure Size of mesh (# of vertices and faces) Speed and memory of computer Types of meshes (triangles only, arbitrary polygons) Redundancy of data Operations to be preformed (see next slide)

Tradeoff between updating and query More redundancy of data, faster query but slower

updating

Page 15: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Choice of Data Structure

Face-based data structure Problem: different topological structure for

triangles and quadrangles

Edge-based data structure Winged-edge data structure

Problem: traveling the neighborhood requires one case distinction

Half-edge data structure Aka doubly connected edge list (DCEL)

Page 16: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Half-Edge Data Structure

Each edge is divided into two half-edges Each half-edge has 5 references:

The face on left side (assume counter-clockwise order) Previous and next half-edge in counterclockwise order The “twin” edge The starting vertex

Each face has a pointer to one of its edges

Each vertex has a pointer to a half edge that has this vertex as the start vertex

Page 17: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Half-edge data structure: example

half-edge origin twin incident face next prev

e3,1 v2 e3,2 f1 e1,1 e3,1

e3,2 v3 e3,1 f2 e5,1 e4,1

e4,1 v4 e4,2 f2 e3,2 e5,1

e4,2 v3 e4,1 f3 e7,1 e6,1

Page 18: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Half-Edge Data Structure

Page 19: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Half-Edge Data Structure

Here is another view of half-edge data structure. Next pointers provide links around each face in

counterclockwise (prev pointers can be used to go around in clockwise)

Example: finding all verticesadjacent to vertex v.

/* Assume closed mesh and using counterclockwise order */

HalfEdge he = v.he;HalfEdge curr = he;output (curr.twin.start);while (curr.twin.next != he) { curr = curr.twin.next; output (curr.twin.start);}

Page 20: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Progressive mesh

Page 21: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Progressive Mesh

References: Hoppe, Progressive mesh, Siggraph 96 Hoppe, View-dependent Refinement of Progressive

Meshes, Siggraph 97

New representation of triangular meshes Simplify meshes through sequence of edge

collapse transformations Record the sequence of inverse

transformations (vertex splits)

Page 22: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Vertex 1 xVertex 1 x11 y y11 z z11

Vertex 2 xVertex 2 x22 y y22 z z22

……

Face Face 11 2 3 2 3Face 3 2 4Face 3 2 4Face 4 2 7Face 4 2 7……

VV FF

mesh mesh MM

Traditional Mesh Representation

(appearance attributes:(appearance attributes: normals, colors, textures, ...normals, colors, textures, ...))

Page 23: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Progressive Mesh Representation

150150 152152 500500 13,54613,546

M0

base mesh

M1 M175 Mn

Original mesh

Page 24: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Simplification: Edge Collapse

Idea: apply a sequence of edge collapses:

ecol(vecol(vs s ,v,vt t , , vvss ))

vvll vvrr

vvtt

vvss

vvssvvll vvrr

(optimization)(optimization)

’’

’’

Page 25: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Simplification: Edge Collapse

150150 152152 500500 13,54613,546

MM00 MMnn=M=M̂̂MMii

ecolecol00 … … ecolecolii … … ecolecoln-1n-1

M0 M1 M175 Mn

Page 26: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Reconstruction: Vertex Split

Invertible & lossless!

vvssvvll vvrr

vspl(vvspl(vs s ,v,vl l ,v,vr r , , vvss ,,vvtt ,…),…)

vvll vvrr

vvtt

vvss

’’ ’’’’

’’

attributesattributes

Page 27: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Reconstruction: Vertex Split150150 152152 500500 13,54613,546

MM00 MMnn=M=M̂̂MMii

vsplvspl00 … … vsplvsplii … … vsplvspln-1n-1

M0 M1 M175 Mn

Page 28: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Progressive Mesh: Benefits

efficient continuous-resolution space-efficient progressive

PMPM

VV FF

MM̂̂

MM00

vsplvspllosslesslossless

single-resolution

Optimization process:Optimization process: off-line processoff-line process various metrics (could use simpler heuristics)various metrics (could use simpler heuristics)

Page 29: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Application – Mesh compression

12964 faces 1000 faces

Page 30: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Application – Progressive Transmission

Transmit the records progressively:

MM00 vsplvspl00 vsplvspl11

ReceiverReceiver displays: displays:

timetime

MM0 0

vsplvspli-1i-1

MMii

vsplvspln-1n-1

MM̂̂(~ progressive JPEG)(~ progressive JPEG)

Page 31: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Application – Selective refinement

MM00 vsplvspl00 vsplvspl11 vsplvspli-1i-1 vsplvspln-1n-1

(e.g. view frustum)(e.g. view frustum)

Page 32: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

ecolecol

ecolecol

Property – Vertex Correspondence

MMnn MM00MMccMMff

vv11

vv22

vv33

vv44

vv55

vv66

vv77

vv88

vv11

vv22

vv33

MMf-2f-2

vv11

vv22

vv33

vv44

vv55

vv66

ecolecol

MMf-1f-1

vv11

vv22

vv33

vv44

vv55

vv66

vv77

ecol(vecol(vs s ,v,vt t , , v’v’ss ))

vvll vvrr

vvtt

vvss

vvssvvll vvrr ’ ’

Page 33: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Application – Smooth Transitions

Correspondence is a surjection (onto function):

vv11

vv22

vv33

vv44

vv55

vv66

vv77

vv88

MMff

vv11

vv22

vv33

MMcc

can form a smoothcan form a smooth visual transition: visual transition: geomorphgeomorph

VV FF

MMffcc

VV

Page 34: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Mesh Simplification

Page 35: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

References

Garland and Heckbert, Surface Simplification Using Quadric Error Metrics, Siggraph 97

Page 36: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Applications

Create progressively coarser versions of objects (levels of detail LOD); render less detailed version for small, distant, unimportant parts of scene

Inverse decimation for progressive transmission

Multiresolution decomposition (for compression, editing) – decompose an original mesh M0 into a low frequency component (simplified mesh Ms) and a high frequency component (M0 – Ms)

Page 37: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Introduction

LOD frameworks: discrete LOD continuous LOD view-dependent (anisotropic) LOD

Simplification algorithms can be Fidelity-based – for generating accurate image Budget-based – simplify until a targeted

number of polygons; for time-critical rendering

Page 38: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Basic Approaches

Bottom-up approaches (this lecture) Start with the original fine mesh Remove elements (vertices, edges, triangles,

tetrahedra) and replace with fewer elements Top-down approaches (wavelet, subdivision-

based) Start with very coarse approximation of

original mesh New points are inserted to generate better

meshes

Page 39: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Bottom-up approaches

Most methods operate from a priority queue of element Vertices, edges, triangles, tetrahedra are

ordered in a priority queue and process one-by-one as they are de-queued

The cost function, which assigns the “priority”, determines the order of processing

Page 40: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Local simplification operators Edge collapse (full edge and half edge

collapse) – Hoppe96, Xia96, Bajaj99 Vertex-pair collapse – Shroeder97,

Garland97,Popovic97 Triangle collapse – Hamann94, Gieng98 Vertex removal – Shroeder92 etc …

Page 41: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Operator: Edge Collapse

Half-edge collapse: vnew = va or vb

vnew

va

vb

Edge collapse

Vertex split

Full-edge collapse: vnew = optimized position

Page 42: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Operator: Edge Collapse

Beware triangle folding!

Lead to visual artifacts, e.g., illumination and texture discontinuities.

Can be detected by measuring the change in the normals of the corresponding triangles before and after an edge collapse

Page 43: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Operator: Edge Collapse

Beware topological inconsistence!

vnew

va

vb

Edge collapse

A manifold mesh may become non-manifold due to edge collapse

Page 44: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Operator: Vertex-pair Collapse

vnew

va

vb

Vertex-pair collapse

Enables closing of holes and tunnels – changes topology

Page 45: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Operator: Triangle Collapse

A triangle collapse is equivalent to two edge collapses. Triangle collapse hierarchies are shallower, but also less adaptable since this is a less fine-grained operation.

vnew

va

vb

triangle collapse

vc

Page 46: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Comparisons

Collapse operators: simplest to implement; well-suited for implementing geomorphing between successive levels of detail

Half-edge collapse: advs: less triangles are modified than full-edge collapse; vertices are a subset of original mesh => simplifies bookkeeping

Page 47: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Priority Queue Methods

Using the cost function (priority), prioritize all the elements in the mesh

Collapse the element with the lowest cost (priority)

Readjust the priorities of all the elements in the queue affected by the collapse

Page 48: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Error Metrics

Usually incorporate some form of object-space geometric error measure

Object-space error measure may be converted to a screen-space distance during runtime

May also incorporate measure of attribute errors (color, normal and texture coordinate)

Measure incremental error or total error

Page 49: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Quadric Error Metric (QEM)(Garland and Heckbert, Siggraph 97)

Maybe the “best” method Fast error computation, compact storage,

good visual quality Measures sum of squared vertex-plane

distances

vQvvQvvppv

vppvvpE

vT

pp

T

p

TT

p

TT

vplanespv

)(

))(()()(

2

Page 50: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Quadric Error Metric (QEM) P1 = (a b c d) representing a

plane ax + by + cz + d = 0, and v = [vx vy vz 1]

s1 : distance from vertex v to plane P1

squared vertex-plane distances: s2 = (p·v)2 = (vTp)(pTv)

Total square distances:

vQvvQvvppv

vppvvpE

vT

pp

T

p

TT

p

TT

vplanespv

)(

))(()()(

2

P1

P2

P3

s1

v

s3

s2

The quadratic form Qp is a 4x4 symmetric matrix, represented using 10 unique floating point numbers. Summing all the matrices gives Qv

Page 51: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Quadric Error Metric (QEM)

Introduces QEM to prioritize collapses a 4x4 matrix Q is associated with each vertex Error of a vertex v is vTQv

Initially, compute matrices Q for all vertices Compute the collapse cost of each edge by summing

the QEM of its two vertices The error (cost) of collapsing the edge (va , vb ) v is

vT(Qa+Qb)v Repeat

Collapse the edge with least cost Update collapse costs of v and its neighborhood Until user requirement is achieved

Page 52: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Quadric Error Metric (QEM)

Ellipsoids shown are level surfaces of the error quadrics, illustrate the size and orientation of error quadrics

Page 53: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Quadric Error Metric (QEM)

69,451 triangles 1,000 triangles 100 triangles

Page 54: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

QEM Simplification

Page 55: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Mesh Fairing (Smoothing)

Page 56: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

References

Taubin, A signal processing approach to fair surface design, Siggraph 95.

Kobbelt et al., Interactive multi-resolution modeling on arbitrary meshes, Siggraph 98

Desbrun et al. Implicit fairing of irregular meshes using diffusion and curvature flow, Siggraph 99

Page 57: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Mesh Fairing

Page 58: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Fairing operators for meshes Umbrella [Kobbelt98] Improved umbrella [Desbrun99] Taubin | [Taubin95] Curvature flow [Desbrun99] etc …

Page 59: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Definition: 1-ring Neighbors of a Vertex

p

p1

p2

...

pn

1-ring neighbors of p,N1(p)={p1,p2,…, pn}

Valence of p is n

Page 60: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

General Idea

Predict a vertex position from its neighbor for a vertex vi and its neighbor vj, let the weight be wij

such that

For vertex vi, predict

Iterate through all vertices and update the positions

1)(1

iNj

ijw

)(1

'iNj

jijw vvi

][

)1(

)1(

)(

)(

1

1

iji

i

iii

vvv

vv

'vvv

iNjij

iNjjij

new

w

w

whereIs a specific normalized curvature operator, is a damping factor

][)(1

ij vvv iNj

iji w

Page 61: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

General idea

Two ways to do smoothing- Explicit updating – find each and update

each

- Compute all , solve for all xi as a linear system:

Let K = I – W, then in matrix form, X = - K X

ix

)(1

)(iNj

ijiji xxwx -

iinewi xxx

newix

ix

Page 62: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Umbrella Operator

Pros: simple, fast; work well for meshes with small variation in edge length and face angles

Cons: for irregular connectivity meshes lead to artifacts weights only based on the connectivity, not the

geometry (e.g., edge length, face area, angle between edges)

vertex drifting problem, smoothing affects parametrization, not just geometry

)(1

1

iNjiji xx

nx -

iinewi xxx

Page 63: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Improved Umbrella Operator

Scale-dependent umbrella operator Still has a non-zero tangential component that

causes vertex drifting Discussion: no longer linear (linearized by

assuming the edge lengths do not change during one smoothing round)

iinewi Δxxx

(i)Njij

(i)Nj ij

iji ||eE

||e

-xx

EΔx

11

2

Page 64: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Curvature Flow Operator

))(cot(cot)cot(cot

1

)()(

1

1

jijiNj

jj

iNjj

iii xxx

n

xi xj

j

j

A noise removal procedure that does not depend on parametrization

Vertices move along the surface normal with a speed equal to the mean curvature

Geometry is smoothed without affecting the sampling rate

Page 65: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Curvature Flow Operator

Vertices can only move along their normal no vertex drifting in parameter space

Page 66: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Comparisons

Page 67: Polygonal Mesh – Data Structure and Processing Chiew-Lan Tai.

Extensions and Applications

Volume preservation Fairing meshes with constraints Stopband filters and enhancement Multiresolution editing of arbitrary meshes Non-uniform subdivision Mesh edge detection Fairing of non-manifold models