290 likes | 684 Views
Concept of 3D Modeling. Model The representation of the object or system Modeling The creation and manipulation of an object or system representation. Issue. How to represent the “world”? Efficiency to Modeler Efficiency to Renderer. Model Types. Model -> Render -> Display
E N D
Concept of 3D Modeling • Model • The representation of the object or system • Modeling • The creation and manipulation of an object or system representation.
Issue • How to represent the “world”? • Efficiency to Modeler • Efficiency to Renderer
Model Types • Model -> Render -> Display • Types of Models: • Graphical model (geometric model) • Using geometric entities to describe the object, • Eg. Lines, polygons, curves , etc • Descriptive model • Mathematical or conceptual representation • Eg. Equations and attributes description.
Pmc*M = Pwc + + Model representation and modeling • Line / Curve / Curve / Polygon / Surface • Constructive solid-geometry and hierarchical modeling • Hierarchical modeling • The graphical model is composed by a number of individual models. • The modeling will involve the transformation process. • Transform individual local coordinate (model coordinates) to world coordinates. • The graphical object are constructed by transforming (eg. Translate, rotate) the local individual object from local coordinates to the world coordinates.
Model representation and modeling • Hierarchical modeling with structure • A hierarchical model can be created with structures by nesting the structures into one another to form a tree organization.
3D Object Representation • Boundary Representation • Surface representation • Eg. Polygon facets, splines surfaces, which can be converted into polygon mesh.
3D Object Representation • Solid representation (space-partitioning) • Represent the object by a set of small solids (eg. Cubes), so that the interior property is described (eg. Octree structure).
Vertices and Polygons Representation • All objects can be represented by: • A set of vertices (points) • A set of lines • A set of polygons
Vertex Representation • Point in a Frame • Possible Characteristics • Location (x,y,z) • Color • Normal Vector • Discussed Later
Polygon Representation • Polygon Data • Include geometric data and attribute data • Geometric Data : - Spatial Information (location) • Polygon List Edge List Vertex List • Attribute data : - Surface property • Eg. Texture property, transparency property , reflectance property
Polygon Data • Geometric data • ( Vertex – edge - polygon format) • Vertex list Edge list Polygon list structure structure structure Vertices Edges Polygons { { { V1: x1, y1, z1; e1: V1,V2; P1: e1,e2,e3 V2: x2, y2, z2; e2: V2, V3; P2: e2, e4, e5 … … ….. Vn: xn, yn, zn en: Vi, Vj PK: ei ,ej ,ek } } }
Object Representation – Vertices vs Polygons • Shared Vertices between Polygons • Cube Example
Polygon • Normally a convex polygon on a single plane • Possible Characteristics • Ordered Set of Vertices • Outward Facing Side (Normal) • Right Hand Rule about Vertex Order • Color • Transparency vs Opaque • Example: • Triangles, Squares, Rectangles, Irregular Polygons
Objects • Surfaces Only • Composed of Polygons (Facets)
Shared Vertices • Each facet (polygon) is a set of vertices • Adjacent polygons share vertices • A single vertex is common between adjacent polygons Shared Vertex
Object and Object Hierarchies • Additional Properties • Animation or Behavior • Objects can be made up of Objects • Sub-objects may have independent properties
Normals • Normal is a vector perpendicular to the surface at a given point
The normal is the same for a flat surface The normal is different at different points on a curved surface Normals (Contiued)
Polygon Normals • Normal Characteristics: • Indicates “outward face” • Magnitude is irrelevant so often the normal vector is a unit vector (magnitude 1)
Vertex Normals • Many APIs just use normals at vertices • Multiple Normal Approaches: • Set of Normals of adjacent polygons
Vertex Normals Continued • Single Vertex Normal Approaches: • Averages of all adjacent polygon normals • Set by user • Surface Curvature Normal
Calculating the Normal • For a curved surface: • Perpendicular to the Tangent of a surface • For a flat surface: • Perpendicular to the surface plane
Calculating a Normal for a Flat Polygon • Assume a triangle: • Vectors: • Normal:
Vertex Normals • Many APIs just use normals at vertices • Multiple Normal Approaches: • Set of Normals of adjacent polygons
Vertex Normals Continued • Single Vertex Normal Approaches: • Averages of all adjacent polygon normals • Set by user • Surface Curvature Normal
Vertex Normals • Vertex Normal • Calculated from adjacent polygon normals • Typically averaged: • Vertices shared between polygons will have the same vertex normal, and hence the same intensity.
Use of Vertex Normals: Shading • Curved surfaces are rendered as faceted approximations. • OpenGL supports smooth shading of faceted objects. • Smoother shading uses normal vectors. • At a point on the ideal surface, the normal vector points straight out.
Vertex Normals • An OpenGL vertex can have a vertex normal vector. • It should match the ideal surface’s normal vector at that location. • OpenGL smoothes the shading at the vertex, as if it were shading the ideal surface. • Calling sets the current vertex normal: glNormal3f(nx, ny, nz) • It applies to subsequent vertices until it is changed. • (nx, ny, nz) should have unit length. • transformations may change normals length
GL_POINTS GL_LINES GL_LINE_STRIP GL_LINE_LOOP GL_TRIANGLES GL_TRIANGLE_STIP GL_TRIANGLE_FAN GL_QUADS GL_QUAD_STRIP GL_POLYGON GL_LINES GL_POLYGON GL_LINE_STRIP GL_LINE_LOOP GL_POINTS GL_TRIANGLES GL_QUADS GL_TRIANGLE_STRIP GL_QUAD_STRIP OpenGL Model Representation