Lecture 33: Shape Modeling Li Zhang Spring 2008

Slides:



Advertisements
Similar presentations
COMP 175 | COMPUTER GRAPHICS Remco Chang1/6103b – Shapes Lecture 03b: Shapes COMP 175: Computer Graphics February 3, 2015.
Advertisements

1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
1 Building Models. 2 Objectives Introduce simple data structures for building polygonal models ­Vertex lists ­Edge lists OpenGL vertex arrays.
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
2003 by Jim X. Chen: Introduction to Modeling Jim X. Chen George Mason University.
04/09/02(c) University of Wisconsin, CS559 Last Time Texturing in OpenGL Texturing Options Project 2 is now available. Start as soon as you can. Homework.
Modeling and representation 1 – comparative review and polygon mesh models 2.1 Introduction 2.2 Polygonal representation of three-dimensional objects 2.3.
11/30/04© University of Wisconsin, CS559 Fall 2004 Last Time More modeling: –Hierarchical modeling –Instancing and Parametric Instancing –Constructive.
CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling.
In the name of God Computer Graphics Modeling1. Today Introduction Modeling Polygon.
COMP 175: Computer Graphics March 24, 2015
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
3D Object Representations 2005, Fall. Course Syllabus Image Processing Modeling Rendering Animation.
CS559: Computer Graphics Lecture 33: Shape Modeling Li Zhang Spring 2008.
Graphics Graphics Korea University cgvr.korea.ac.kr Creating Virtual World I 김 창 헌 Department of Computer Science Korea University
4/15/04© University of Wisconsin, CS559 Spring 2004 Last Time More modeling: –Hierarchical modeling –Instancing and Parametric Instancing –Constructive.
11/11/04© University of Wisconsin, CS559 Fall 2004 Last Time Shading Interpolation Texture mapping –Barycentric coordinates for triangles.
Geometric Modeling using Polygonal Meshes Lecture 1: Introduction Hamid Laga Office: South.
Object Representation Rama C Hoetzlein, 2010 Univ. of California Santa Barbara Lecture Notes.
CS559: Computer Graphics Lecture 24: Shape Modeling Li Zhang Spring 2010.
Subdivision Schemes Basic idea: Start with something coarse, and refine it into smaller pieces for rendering –We have seen how subdivision may be used.
Introduction to Computer Graphics: Object Representation Rama C Hoetzlein, 2010 Univ. of California Santa Barbara Lecture Notes.
Parametric Surfaces Define points on the surface in terms of two parameters Simplest case: bilinear interpolation s t s x(s,t)x(s,t) P 0,0 P 1,0 P 1,1.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
04/18/02(c) 2002 University of Wisconsin Last Time Hermite Curves Bezier Curves.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Subdivision Surfaces Greg Humphreys University of Virginia CS 445, Fall 2003.
In the name of God Computer Graphics. Introduction Modeling techniques modeling techniques managements Some renderings.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
CS559: Computer Graphics Final Review Li Zhang Spring 2010.
More Object Representations
Introduction to Meshes Lecture 22 Mon, Oct 20, 2003.
Modeling So far in class: –We’ve looked at images and image manipulation –We’ve looked at rendering from polygons Next major section: –Modeling You may.
11/16/04© University of Wisconsin, CS559 Fall 2004 Last Time Texture Anti-Aliasing Texture boundaries Modeling introduction.
11/12/02(c) University of Wisconsin, CS559 Last Time Texturing Details Homework 5.
Solid Modeling Dr. Scott Schaefer.
CS559: Computer Graphics Lecture 33: Shape Modeling Li Zhang Spring 2008.
Introduction to Parametric Curve and Surface Modeling.
Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
© University of Wisconsin, CS559 Spring 2004
Constructing Objects in Computer Graphics
Curve & Surface.
POLYGON MESH Advance Computer Graphics
© University of Wisconsin, CS559 Spring 2004
Introduction to Graphics Modeling
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
Constructing Objects in Computer Graphics By Andries van Dam©
3D Object Representations
Texture Mapping COMP575/COMP770.
© University of Wisconsin, CS559 Spring 2004
Last Time Midterm Shading Light source Shading Interpolation
© University of Wisconsin, CS559 Fall 2004
Building Models Ed Angel
© University of Wisconsin, CS559 Spring 2004
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Fall 2004
Isaac Gang University of Mary Hardin-Baylor
Chapter III Modeling.
(c) University of Wisconsin, CS 559
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Introduction to Meshes
(c) 2002 University of Wisconsin
CS-378: Game Technology Lecture #4: Texture and Other Maps
Introduction to Parametric Curve and Surface Modeling
Last Time Liang-Barsky Details Weiler-Atherton clipping algorithm
Introduction to Meshes
Last Time B-splines Project 3 was made available
Presentation transcript:

Lecture 33: Shape Modeling Li Zhang Spring 2008 CS559: Computer Graphics Lecture 33: Shape Modeling Li Zhang Spring 2008

Today Shape Modeling Reading (optional) Shirley: ch 13.1-13.3 Redbook: ch 2, if you haven’t read it before

Shape model There are many ways to represent the shape of an object You have some experience with shape modeling Rails as curves Tree = cone + cylinder There are many ways to represent the shape of an object choosing a representation depends on application and requirement

Boundary vs. Solid Representations B-rep: boundary representation Sometimes we only care about the surface Rendering opaque objects Solid modeling Some representations are best thought of defining the space filled, rather than the surface around the space Medical data with information attached to the space Transparent objects with internal structure Taking cuts out of an object; “What will I see if I break this object?” Face, chair, building, globe Earth Virtual human Tank of fish

Shape Representation Parametric models Implicit models Procedural models Theta, phi -> 3D Point test

Parametric Model generates all the points on a surface (volume) by “plugging in a parameter” Eg Easy to render, how? Easy to texture map In general (theta, phi) -> (x,y,z) Tessilate theta phi Map theta phi to texture coord.

Implicit Models Implicit models use an equation that is 0 if the point is on the surface Essentially a function to test the status of a point Eg Easy to test inside/outside/on Hard to? Render Texture map

Parametric Model generates all the points on a surface (volume) by “plugging in a parameter” Eg Easy to render, how? Easy to texture map Hard to Test inside/outside/on How to test x,y,z? Change a=2, b=3, c=4;

Procedural Modeling a procedure is used to describe how the shape is formed Simple procedure

Parameterization Parameterization is the process of associating a set of parameters with every point on an object For instance, a line is easily parameterized by a single value Triangles in 2D can be parameterized by their barycentric coordinates Triangles in 3D can be parameterized by 3 vertices and the barycentric coordinates (need both to locate a point in 3D space) Several properties of a parameterization are important: The smoothness of the mapping from parameter space to 3D points The ease with which the parameter mapping can be inverted We care about parameterizations for several reasons Texture mapping is the most obvious one you have seen so far; require (s,t) parameters for every point in a triangle Arc-length parameterization is an example. Shading, interpolation

Popular Modeling Techniques Polygon meshes Surface representation, Parametric representation Prototype instancing and hierarchical modeling (done) Surface or Volume, Parametric Volume enumeration schemes Volume, Parametric or Implicit Parametric curves and surfaces Surface, Parametric Subdivision curves and surfaces Procedural models

Polygon Modeling Polygons are the dominant force in modeling for real-time graphics Why?

Polygons Dominate because Everything can be turned into polygons (almost everything) Normally an error associated with the conversion, but with time and space it may be possible to reduce this error We know how to render polygons quickly Many operations are easy to do with polygons Memory and disk space is cheap Simplicity

What’s Bad About Polygons? What are some disadvantages of polygonal representations?

Polygons Aren’t Great They are always an approximation to curved surfaces Most real-world surfaces are curved, particularly natural surfaces They throw away information Normal vectors are approximate But can be as good as you want, if you are willing to pay in size They can be very unstructured They are hard to globally parameterize (complex concept) How do we parameterize them for texture mapping? It is difficult to perform many geometric operations Results can be unduly complex, for instance Memory issue for unstructured.

Polygon Meshes A mesh is a set of polygons connected to form an object A mesh has several components, or geometric entities: Faces Edges the boundary between faces Vertices the boundaries between edges, or where three or more faces meet Normals, Texture coordinates, colors, shading coefficients, etc What is the counterpart of a polygon mesh in curve modeling? 2d extension of piecewise lenear curve

Polygonal Data Structures Polygon mesh data structures are application dependent Different applications require different operations to be fast Find the neighbor of a given face Find the faces that surround a vertex Intersect two polygon meshes You typically choose: Which features to store explicitly (vertices, faces, normals, etc) Which relationships you want to be explicit (vertices belonging to faces, neighbors, faces at a vertex, etc)

Polygon Soup Many polygon models are just lists of polygons struct Vertex { float coords[3]; } struct Triangle { struct Vertex verts[3]; struct Triangle mesh[n]; glBegin(GL_TRIANGLES) for ( i = 0 ; i < n ; i++ ) { glVertex3fv(mesh[i].verts[0]); glVertex3fv(mesh[i].verts[1]); glVertex3fv(mesh[i].verts[2]); glEnd(); Important Point: OpenGL, and almost everything else, assumes a constant vertex ordering: clockwise or counter-clockwise. Default, and slightly more standard, is counter-clockwise

Cube Soup (0,0,1) (0,1,1) (1,0,1) (1,1,1) (0,0,0) (0,1,0) (1,0,0) struct Triangle Cube[12] = {{{1,1,1},{1,0,0},{1,1,0}}, {{1,1,1},{1,0,1},{1,0,0}}, {{0,1,1},{1,1,1},{0,1,0}}, {{1,1,1},{1,1,0},{0,1,0}}, … }; (0,0,1) (0,1,1) (1,0,1) (1,1,1) (0,0,0) (0,1,0) (1,0,0) (1,1,0)

Polygon Soup Evaluation What are the advantages? What are the disadvantages?

Polygon Soup Evaluation What are the advantages? It’s very simple to read, write, transmit, etc. A common output format from CAD modelers The format required for OpenGL BIG disadvantage: No higher order information No information about neighbors No open/closed information No guarantees on degeneracies

Vertex Indirection v0 v4 vertices v0 v1 v2 v3 v4 v1 faces 2 1 1 4 1 2 3 1 3 4 v2 v3 There are reasons not to store the vertices explicitly at each polygon Wastes memory - each vertex repeated many times Very messy to find neighboring polygons Difficult to ensure that polygons meet correctly Solution: Indirection Put all the vertices in a list Each face stores the indices of its vertices Advantages? Disadvantages?

Cube with Indirection 4 7 5 6 3 1 2 struct Vertex CubeVerts[8] = {{0,0,0},{1,0,0},{1,1,0},{0,1,0}, {0,0,1},{1,0,1},{1,1,1},{0,1,1}}; struct Triangle CubeTriangles[12] = {{6,1,2},{6,5,1},{6,2,3},{6,3,7}, {4,7,3},{4,3,0},{4,0,1},{4,1,5}, {6,4,5},{6,7,4},{1,2,3},{1,3,0}}; 4 7 5 6 3 1 2

Indirection Evaluation Advantages: Connectivity information is easier to evaluate because vertex equality is obvious Saving in storage: Vertex index might be only 2 bytes, and a vertex is probably 12 bytes Each vertex gets used at least 3 and generally 4-6 times, but is only stored once Normals, texture coordinates, colors etc. can all be stored the same way Disadvantages: Connectivity information is not explicit

OpenGL and Vertex Indirection struct Vertex { float coords[3]; } struct Triangle { GLuint verts[3]; struct Mesh { struct Vertex vertices[m]; struct Triangle triangles[n]; glEnableClientState(GL_VERTEX_ARRAY) glVertexPointer(3, GL_FLOAT, sizeof(struct Vertex), mesh.vertices); glBegin(GL_TRIANGLES) for ( i = 0 ; i < n ; i++ ) { glArrayElement(mesh.triangles[i].verts[0]); glArrayElement(mesh.triangles[i].verts[1]); glArrayElement(mesh.triangles[i].verts[2]); } glEnd(); Rendering efficeincy – remove vertex redundecy

OpenGL and Vertex Indirection (v2) glEnableClientState(GL_VERTEX_ARRAY) glVertexPointer(3, GL_FLOAT, sizeof(struct Vertex), mesh.vertices); for ( i = 0 ; i < n ; i++ ) glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, mesh.triangles[i].verts); Minimizes amount of data sent to the renderer Fewer function calls Faster! Other tricks to accelerate using array, see Red book, Ch 2 on vertex arrays