CS 4731: Computer Graphics Lecture 10: 3D Modeling: Polygonal Meshes

Slides:



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

CMPE 466 COMPUTER GRAPHICS
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
3D Game Programming Geometric Transformations
Computer Graphics Programming: Matrices and Transformations CSE 3451 Matt Boggus.
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
CS 4731 Lecture 2: Intro to 2D, 3D, OpenGL and GLUT (Part I) Emmanuel Agu.
1 Computer Graphics Chapter 7 3D Object Modeling.
11-1 Space Figures and Cross Sections
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
Chapter 4 Digital Multimedia, 2nd edition Vector Graphics.
2.1 si SI31 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
Computer Graphics using OpenGL, 3 rd Edition F. S. Hill, Jr. and S. Kelley Chapter Modeling Shapes with Polygonal Meshes S. M. Lea University of.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 10: Mesh simplification Ravi Ramamoorthi Many slides courtesy.
Introduction to Modeling. What is CG Modeling? Combination of Sculpting, Architecture, Drafting, and Painting. The core component of computer animation.
CS 4731: Computer Graphics Lecture 9: Introduction to 3D Modeling Emmanuel Agu.
3D Concepts Coordinate Systems Coordinates specify points in space 3D coords commonly use X, Y, & Z A vertex is a 'corner' of an object Different coordinate.
Spatial data models (types)
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.
1 X file & Mesh Chapter 8. 2 What is X file? 1.X file is a file that is used to store D3D program's data. 2.Any X file has extension *.x. 3.X file could.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
Geometric Objects and Transformations Chapter 4. Points, Scalars and Vectors  Points - position in space  Scalars - real numbers, complex numbers obey.
Polygon Shading. Assigning color to a shape to make graphical scenes look realistic, or artistic, or whatever effect we’re attempting to achieve But first.
Zakrite ploskve. Problem outline Given a set of 3D objects and a viewing specification, we wish to determine which lines or surfaces are visible, so that.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
In the name of God Computer Graphics Modeling1. Today Introduction Modeling Polygon.
Polygon Lists & 3-D File Formats Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 18, 2002.
C O M P U T E R G R A P H I C S Stuff Jian Chen January 15, 2010 Transformations 1/10 Describing Shape By Andries van Dam.
Modeling Shapes with Polygonal Meshes. 3D Modeling Polygonal meshes capture the shape of complex 3D objects in simple data structures.
Graphics in 3D 1 By Dr. HANY ELSALAMONY.  With a solid understanding of the 2D math involved in this world, we are ready to venture into the world of.
Week 11 - Thursday.  What did we talk about last time?  Image processing  Blurring  Edge detection  Color correction  Tone mapping  Lens flare.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Object Representation Rama C Hoetzlein, 2010 Univ. of California Santa Barbara Lecture Notes.
1 Graphics CSCI 343, Fall 2015 Lecture 4 More on WebGL.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
1 Manage Mesh Data Chapter 8. 2 How to manage Mesh data The most important two objects of mesh are VertexBuffer and IndexBuffer, which can obtained by.
Introduction to Computer Graphics: Object Representation Rama C Hoetzlein, 2010 Univ. of California Santa Barbara Lecture Notes.
Computer Graphics Basic 3D Geometry CO2409 Computer Graphics Week 5-1.
Solid Modeling. Solid Modeling - Polyhedron A polyhedron is a connected mesh of simple planar polygons that encloses a finite amount of space. A polyhedron.
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 8 Ravi Ramamoorthi
Project 5 Lamp Shader Fri, Nov 7, 2003 Due Mon, Nov 17, 2003.
What are these shapes? squarecircletrianglerectangle How many sides do each have? How many points do each have?
1 Building Models Ed Angel Professor Emeritus of Computer Science University of New Mexico Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Computer Graphics Week8 – Graphics in 3D.
CS COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,
Introduction to Meshes Lecture 22 Mon, Oct 20, 2003.
Computer Graphics I, Fall 2010 Building Models.
11/16/04© University of Wisconsin, CS559 Fall 2004 Last Time Texture Anti-Aliasing Texture boundaries Modeling introduction.
Geometry Shapes Revision. Drawing Cubes How many cubes? Draw a front, side and top view.
University of North Carolina at Greensboro

Computer graphics 3D solid modeling.
POLYGON MESH Advance Computer Graphics
Lecture 33: Shape Modeling Li Zhang Spring 2008
Constructing Objects in Computer Graphics By Andries van Dam©
CSC461: Lecture 23 Shading Computation
Vectors, Normals, & Shading
Chapter III Modeling.
Introduction to Meshes
Guess the Shape!.
Introduction to Meshes
Presentation transcript:

CS 4731: Computer Graphics Lecture 10: 3D Modeling: Polygonal Meshes Emmanuel Agu

3D Modeling Previously Introduced 3D modeling Previously introduced GLUT models (wireframe/solid) and Scene Description Language (SDL): 3D file format Previously used GLUT calls Cylinder: glutWireCylinder( ), glutSolidCylinder( ) Cone: glutWireCone( ), glutSolidCone( ) Sphere: glutWireSphere( ), glutSolidSphere( ) Cube: glutWireCube( ), glutSolidCube( ) Newell Teapot, torus, etc

Polygonal Meshes Modeling with basic shapes (cube, cylinder, sphere, etc) too primitive Difficult to approach realism Polygonal meshes: Collection of polygons, or faces, that form “skin” of object Offer more flexibility Models complex surfaces better Examples: Human face Animal structures Furniture, etc

Polygonal Meshes Have become standard in CG OpenGL Good at drawing polygon Mesh = sequence of polygons Simple meshes exact. (e.g barn) Complex meshes approximate (e.g. human face) Later: use shading technique to smoothen

Non-solid Objects Examples: box, face Visualize as infinitely thin skin Meshes to approximate complex objects Shading used later to smoothen Non-trivial: creating mesh for complex objects (CAD)

What is a Polygonal Mesh Polygonal mesh given by: Polygon list Direction of each polygon Represent direction as normal vector Normal vector used in shading Normal vector/light vector determines shading

Vertex Normal Use vertex normal instead of face normal See advantages later: Facilitates clipping Shading of smoothly curved shapes Flat surfaces: all vertices associated with same n Smoothly curved surfaces: V1, V2 with common edge share n

Defining Polygonal Mesh Use barn example below:

Defining Polygonal Mesh Three lists: Vertex list: distinct vertices (vertex number, Vx, Vy, Vz) Normal list: Normals to faces (normalized nx, ny, nz) Face list: indexes into vertex and normal lists. i.e. vertices and normals associated with each face Face list convention: Traverse vertices counter-clockwise Interior on left, exterior on right

Newell Method for Normal Vectors Martin Newell at Utah (teapot guy) Normal vector: calculation difficult by hand Given formulae, suitable for computer Compute during mesh generation Simple approach used previously: Start with any three vertices V1, V2, V3 Form two vectors, say V1-V2, V3-V2 Normal: cross product (perp) of vectors

Newell Method for Normal Vectors Problems with simple approach: If two vectors are almost parallel, cross product is small Numerical inaccuracy may result Newell method: robust Formulae: Normal N = (mx, my, mz)

Newell Method Example Example: Find normal of polygon with vertices P0 = (6,1,4), P1=(7,0,9) and P2 = (1,1,2) Solution: Using simple cross product: ((7,0,9)-(6,1,4)) X ((1,1,2)-(6,1,4)) = (2,-23,-5) Using Newell method, plug in values result is the same: Normal is (2, -23, -5)

Meshes in Programs Class Mesh Helper classes Mesh Object: VertexID Face Mesh Object: Normal list Vertex list Face list Use arrays of pt, norm, face Dynamic allocation at runtime Array lengths: numVerts, numNormals, numFaces

Meshes in Programs Face: Example, vth vertex of fth face: Vertex list Normal vector associated with each face Array of index pairs Example, vth vertex of fth face: Position: pt[face[f].vert[v].vertIndex] Normal vector: norm[face[f].vert[v].normIndex] Organized approach, permits random access

Meshes in Programs Tetrahedron example

Meshes in Programs Data structure: // ############### Vertex ID ###################### class VertexID public: int vertIndex; // index of this vertex in the vertex list int normIndex; // index of this vertex’s normal } // ############### Face ###################### class Face int nVerts; // number of vertices in this face VertexID *vert; // the list of vertex and normal indices Face( ){nVerts = 0; vert = NULL;} // constructor -Face( ){delete[ ] vert; nVerts = 0; // destructor };

Meshes in Programs // ############### Mesh ###################### class Mesh{ private: int numVerts; // number of vertices in the mesh Point3 *pt; // array of 3D vertices int numNormals; // number of normal vertices for the mesh Vector3 *norm; // array of normals int numFaces; // number of faces in the mesh Face *face; // array of face data //… others to be added later public: Mesh( ); // constructor ~Mesh( ); // destructor int readFile(char *fileName); // to read in a filed mesh ….. other methods…. }

Drawing Meshes Using OpenGL Pseudo-code: for(each face f in Mesh) { glBegin(GL_POLYGON); for(each vertex v in face f) glNormal3f(normal at vertex v); glVertex3f(position of vertex v); } glEnd( );

Drawing Meshes Using OpenGL Actual code: Void Mesh::draw( ) // use openGL to draw this mesh { for(int f = 0;f < numFaces;f++) glBegin(GL_POLYGON); for(int v=0;v<face[f].nVerts;v++) // for each one int in = face[f].vert[v].normIndex; // index of this normal int iv = face[f].vert[v].vertIndex; // index of this vertex glNormal3f(norm[in].x, norm[in].y, norm[in].z); glVertex3f(pt[iv].x, pt[iv].y, pt[iv].z); } glEnd( );

Drawing Meshes Using SDL Scene class reads SDL files Accepts keyword Mesh Example: Pawn stored in mesh file pawn.3vn Add line: Push translate 3 5 4 scale 3 3 3 mesh pawn.3vn pop

More on Meshes Simple meshes easy by hand Complex meshes: Mathematical functions Algorithms Digitize real objects Libraries of meshes available Mesh trends: 3D scanning Mesh Simplification

3D Simplification Example Original: 424,000 triangles 60,000 triangles (14%). 1000 triangles (0.2%) (courtesy of Michael Garland and Data courtesy of Iris Development.)

References Hill, 6.1-6.2