meshes
play

Meshes CS418 Computer Graphics John C. Hart Simple Meshes - PowerPoint PPT Presentation

Meshes CS418 Computer Graphics John C. Hart Simple Meshes Cylinder ( x , y , z ) = (cos q , sin q , z ) Cone ( x , y , z ) = (| z| cos q , | z| sin q , z ) Sphere ( x , y , z ) = (cos f cos q , cos f sin q , sin f ) Torus


  1. Meshes CS418 Computer Graphics John C. Hart

  2. Simple Meshes • Cylinder ( x , y , z ) = (cos q , sin q , z ) • Cone ( x , y , z ) = (| z| cos q , | z| sin q , z ) • Sphere ( x , y , z ) = (cos f cos q , cos f sin q , sin f ) • Torus ( x , y , z ) = (( R + cos f ) cos q ,( R + cos f ) sin q , sin f )

  3. Good Meshes • Manifold : 1. Every edge connects exactly two faces 2. Vertex neighborhood is “disk - like” • Orientable : Consistent normals • Watertight : Orientable + Manifold • Boundary : Some edges bound only one face • Ordering : Vertices in CCW order when viewed from normal

  4. Indexed Face Set ( x 4 , y 4 , z 4 ) ( x 3 , y 3 , z 3 ) • Popular file format – VRML, Wavefront “.obj”, etc. ( x 2 , y 2 , z 2 ) ( x 1 , y 1 , z 1 ) • Ordered list of vertices – Prefaced by “v” (Wavefront) v x 1 y 1 z 1 – Spatial coordinates x,y,z v x 2 y 2 z 2 v x 3 y 3 z 3 – Index given by order v x 4 y 4 z 4 • List of polygons f 1 2 3 – Prefaced by “f” (Wavefront) f 2 4 3 – Ordered list of vertex indices – Length = # of sides – Orientation given by order

  5. v x 0 y 0 z 0 Other Attributes v x 1 y 1 z 1 ( x 2 , y 2 , z 2 ) v x 2 y 2 z 2 ( a 2 , b 2 , c 2 ) ( u 2 , v 2 ) vn a 0 b 0 c 0 vn a 1 b 1 c 1 • Vertex normals vn a 2 b 2 c 2 ( x 0 , y 0 , z 0 ) – Prefixed w/ “vn” (Wavefront) ( a 0 , b 0 , c 0 ) vt u 0 v 0 – Contains x,y,z of normal ( u 0 , v 0 ) vt u 1 v 1 vt u 2 v 2 – Not necessarily unit length – Not necessarily in vertex order ( x 1 , y 1 , z 1 ) – Indexed as with vertices ( a 1 , b 1 , c 1 ) • ( u 1 , v 1 ) Texture coordinates – Prefixed with “vt” (Wavefront) – Not necessarily in vertex order – Contains u,v surface parameters • Faces – Uses “/” to separate indices – Vertex “/” normal “/” texture – Normal and texture optional f 0/0/0 1/1/1 2/2/2 f 0/0/0 1/0/1 2/0/2 – Can eliminate normal with “//”

  6. Catmull Clark Subdivision • First subdivision generates quad mesh • Generates B-spline patch when applied to 4x4 network of vertices Some vertices extraordinary (valence  4) • Rules: • Face vertex = average of face’s vertices • Edge vertex = average of edge’s two vertices & adjacent face’s two vertices • New vertex position = (1/valence) x sum of… – Average of neighboring face points – 2 x average of neighboring edge points – (valence – 3) x original vertex position (boundary edge points set to edge midpoints, boundary vertices stay put)

  7. Face vertex = average of face’s vertices Edge vertex = average of edge’s two vertices Implementation & adjacent face’s two vertices New vertex position = (1/valence) x sum of… Average of neighboring face points 2 x average of neighboring edge points • Face vertex (valence – 3) x original vertex position – For each face v x 1 y 1 z 1 add vertex at its centroid v x 2 y 2 z 2 • Edge vertex v x 3 y 3 z 3 v x 4 y 4 z 4 – How do we find each edge? … • New vertex position f 1 2 3 4 – For a given vertex ... how do we find neighboring faces and edges?

  8. Half Edge class HalfEdge { HalfEdge *opp; Vertex *end; Face *left; HalfEdge *next; }; HalfEdge e;

  9. Half Edge class HalfEdge { HalfEdge *opp; Vertex *end; Face *left; HalfEdge *next; }; HalfEdge e; e e->opp()

  10. Half Edge class HalfEdge { HalfEdge *opp; Vertex *end; Face *left; HalfEdge *next; }; e->end() HalfEdge e; e e->opp() e->start() = e->opp()->end(); e->start()

  11. Half Edge class HalfEdge { HalfEdge *opp; Vertex *end; Face *left; HalfEdge *next; }; HalfEdge e; e->left() e->right() e e->opp() e->right() = e->opp()->left();

  12. Half Edge class HalfEdge { HalfEdge *opp; Vertex *end; Face *left; HalfEdge *next; }; HalfEdge e; e e->opp() Can walk around left face until e(->next) n = e

  13. Vertex Star Query 7 8 6 … 5 1. e 4 2. e->next() 3 3. e->next()->opp() 2 4. e->next()->opp()->next() 1 5. e->next()->opp()->next()->opp() 6. e->next()->opp()->next()->opp()->next() 7. e->next()->opp()->next()->opp()->next()->opp() 8. e->next()->opp()->next()->opp()->next()->opp()->next() … until e( ->next()->opp()) n == e

  14. Digital Michelangelo • In 1998 Marc Levoy takes a sabbatical year in Florence to scan a bunch of Michelangelo sculptures • David at 1mm resolution St. Matthew at 290  m resolution •

  15. Edge-Face-Vertex Half Edges Faces Vertices HalfEdge *opp; f 1 2 3 <he> v <x1> <y1> <z1> <he> Vertex *end; f 3 2 4 <he> v <x2> <y2> <z2> <he> Face *left; f 3 4 5 <he> v <x3> <y3> <z3> <he> HalfEdge *next; … … HalfEdge *opp; Vertex *end; Face *left; HalfEdge *next;

Recommend


More recommend