polygon meshes and
play

Polygon Meshes and in Computer Graphics? Graded: Implicit - PowerPoint PPT Presentation

Announcements What do we need from shapes Polygon Meshes and in Computer Graphics? Graded: Implicit Surfaces Programming Assignment 1 Ian or Michael Local control of shape for modeling Grades in file in your turnin


  1. Announcements What do we need from shapes Polygon Meshes and in Computer Graphics? • Graded: Implicit Surfaces – Programming Assignment 1 – Ian or Michael • Local control of shape for modeling » Grades in file in your turnin directory • Ability to model what we need – Written Assignment – Michael Polygon Meshes • Smoothness and continuity – Derivation for Assignment 2 – Ian Polygon Meshes Implicit Surfaces Implicit Surfaces • Programming Assignment 2 due on • Ability to evaluate derivatives Constructive Solid Geometry Constructive Solid Geometry Thursday – questions? • Ability to do collision detection Watt: Chapter 2 • Written Assignment 2 out on Thursday • Ease of rendering No one technique solves all problems 10/01/02 1 3 Computer Graphics 15-462 Computer Graphics 15-462 Two Ways to Define a Circle Surface Representations Curve Representations • Explicit: y = f(x) • Parametric surface — x(u,v), y(u,v), z(u,v) y = = + 2 x y mx b Parametric Implicit – e.g. plane, sphere, cylinder, torus, bicubic surface, swept surface – must be a function (single-valued): – parametric functions let you iterate over the surface by incrementing u – big limitation—vertical lines? and v in nested loops F>0 • Parametric: (x,y) = (f(u),g(u)) – great for making polygon meshes, etc = F=0 ( x , y ) (cos u , sin u ) – terrible for intersections: ray/surface, point-inside-boundary, etc. u • Implicit surface: F(x,y,z) = 0 + easy to specify, modify, control – extra “hidden” variable u, the parameter – e.g. plane, sphere, cylinder, quadric, torus, blobby models F<0 – terrible for iterating over the surface – great for intersections, morphing • Implicit: f(x,y) = 0 • Subdivision surfaces + − = 2 2 2 x y r 0 x = f(u) = r cos (u) – defined by a control mesh and a recursive subdivision procedure F(x,y) = x² + y² - r² + y can be multiple valued function of x y = g(u) = r sin (u) – good for interactive design – hard to specify, modify, control 4 5 6 Computer Graphics 15-462 Computer Graphics 15-462 Computer Graphics 15-462 1

  2. Frontfacing / Backfacing Modeling Complex Shapes Polygon Meshes •A polygon has two sides, of course. • We want to build models of very complicated • Any shape can be modeled out of •Customary in CG to use the right hand rule to pick one polygons objects side to call the front face . – if you use enough of them… • An equation for a sphere is possible, but how •Counterclockwise = front, clockwise = back • Polygons with how many sides? about an equation for a telephone, or a face, or a – Can use triangles, quadrilaterals, pentagons, … n- •Important for: cloud? gons –lighting – Triangles are most common. • Complexity is achieved using simple pieces –backface culling – When > 3 sides are used, ambiguity about what to do – polygons, parametric surfaces, or implicit surfaces when polygon nonplanar, or concave, or self- –for the triangle ABC below, the front face is up . intersecting. • Goals N • Polygon meshes are built out of – Model anything with arbitrary precision (in principle) – vertices (points) C – Easy to build and modify – edges (line segments between vertices) – Efficient computations (for rendering, collisions, etc.) A – faces (polygons bounded by edges) – Easy to implement (a minor consideration...) B 7 8 9 Computer Graphics 15-462 Computer Graphics 15-462 Computer Graphics 15-462 Normals and Plane Equations Polygon Models in OpenGL Data Structures for Polygon Meshes • Need normals for shading, plane eqns for intersection tests • Simplest (but dumb) • A normal to a plane is a vector that is perpendicular to that plane – float triangle[n][3][3]; (each triangle stores 3 (x,y,z) points) (two possible choices) • for faceted shading • for smooth shading – redundant: each vertex stored multiple times • A plane is specified by a point P and a normal vector N < calculate face normal n glBegin(GL_POLYGONS); • Vertex List, Face List • N•(X-P) = 0 if and only if X lies in the plane; this is an implicit using cross product rule > glNormal3fv(normal1); equation for the plane – List of vertices, each vertex consists of (x,y,z) geometric (shape) glNormal3fv(n); glVertex3fv(vert1); info only – Expand this out: 0 = N•X - N•P = ax + by + cz + d glBegin(GL_POLYGONS); glNormal3fv(normal2); – List of triangles, each a triple of vertex id’s (or pointers) topological • 3 vertices define a plane, its normal is: N=(B-A) x (C-A) (connectivity, adjacency) info only glVertex3fv(vert1); glVertex3fv(vert2); • Unit normal Fine for many purposes, but finding the faces adjacent to a vertex glVertex3fv(vert2); glNormal3fv(normal3); takes O(F) time for a model with F faces. Such queries are N glVertex3fv(vert3); glVertex3fv(vert3); important for topological editing. ˆ = glEnd(); • Fancier schemes: N N / N glEnd(); C Store more topological info so adjacency queries can be answered in O(1) time. A X P Winged-edge data structure – edge structures contain all topological info (pointers to adjacent vertices, edges, and faces). B 10 11 12 Computer Graphics 15-462 Computer Graphics 15-462 Computer Graphics 15-462 2

  3. How Many Polygons to Use? A File Format for Polygon Models: OBJ Why Level of Detail? • Different models for near and far objects # OBJ file for a 2x2x2 cube v -1.0 1.0 1.0 - vertex 1 • Different models for rendering and collision detection v -1.0 -1.0 1.0 - vertex 2 v 1.0 -1.0 1.0 - vertex 3 • Compression of data recorded from the real world v 1.0 1.0 1.0 - … v -1.0 1.0 -1.0 v -1.0 -1.0 -1.0 We need automatic algorithms for reducing the polygon Syntax: v 1.0 -1.0 -1.0 v 1.0 1.0 -1.0 count without f 1 2 3 4 •losing key features v x y z - a vertex at (x,y,z) f 8 7 6 5 •getting artifacts in the silhouette f 4 3 7 8 •popping f v 1 v 2 … v n f 5 1 4 8 a face with vertices v 1 , v 2 , … v n f 5 6 2 1 f 2 6 7 3 # anything - comment 13 14 15 Computer Graphics 15-462 Computer Graphics 15-462 Computer Graphics 15-462 What Implicit Functions are Good For Surface Representations Sets of Points, Surfaces and Solids • Implicit surface: set of all points that satisfy F(x,y,z)=0 • Parametric surface — x(u,v), y(u,v), z(u,v) • The points that satisfy F(x,y,z)<0 define a solid (or – e.g. plane, cylinder, bicubic surface, swept surface solids) bounded by the surface F < 0 ? – parametric functions let you iterate over the surface by F = 0 ? X + kV • The solid is directly defined (unlike definitions using incrementing u and v in nested loops F > 0 ? parametric surfaces) – great for making polygon meshes, etc • Example X – terrible for intersections: ray/surface, point-inside- – An infinitely long (solid) cylinder with radius r: boundary, etc. F = x 2 + y 2 - r 2 F(X + kV) = 0 – To limit cylinder to length L, abs(z) < L/2 and keep the function implicit use • Implicit surface: F(x,y,z) = 0 max: ( ) Ray - Surface Intersection Test Inside/Outside Test F = max abs(z)-L/2,x 2 + y 2 -r 2 – e.g. plane, sphere, cylinder, quadric, torus, blobby models • Implicit functions for a cube? Any convex polyhedron? – terrible for iterating over the surface – great for intersections, morphing 16 17 18 Computer Graphics 15-462 Computer Graphics 15-462 Computer Graphics 15-462 3

  4. Surfaces from Implicit Functions Blobby Models How to draw implicit surfaces? • Constant Value Surfaces are called • It’s easy to ray trace implicit surfaces (depending on whom you ask): – because of that easy intersection test – constant value surfaces • Volume Rendering can display them – level sets – isosurfaces • Convert to polygons: the Marching Cubes algorithm • Implicit function is the sum of Gaussians centered at • Nice Feature: you can add them! (and other – Divide space into cubes several points in space, minus a threshold tricks) – Evaluate implicit function at each cube vertex – this merges the shapes – Do root finding or linear interpolation along each • varying the standard deviations of the Gaussians – When you use this with spherical exponential potentials, it’s edge called Blobs , Metaballs, or Soft Objects . Great for modeling makes each blob bigger animals. – Polygonize on a cube-by-cube basis • varying the threshold makes blobs merge or separate 19 20 21 Computer Graphics 15-462 Computer Graphics 15-462 Computer Graphics 15-462 Isosurfaces of Simulated Tornado Constructive Solid Geometry (CSG) A CSG Train Generate complex shapes with basic building blocks machine an object - saw parts off, drill holes glue pieces together This is sensible for objects that are actually made that way (human-made, particularly machined objects) Brian Wyvill & students, Univ. of Calgary 22 23 24 Computer Graphics 15-462 Computer Graphics 15-462 Computer Graphics 15-462 4

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend