1
play

1 Polygon Mesh Example Methods Parametric surface = sin 4 x - PDF document

Modelling How to represent these objects in computer o The creation and manipulation of a system representation is termed modelling o Any single representation is called a model of the system. o There are mainly two kinds (conventional): o


  1. Modelling How to represent these objects in computer o The creation and manipulation of a system representation is termed modelling o Any single representation is called a model of the system. o There are mainly two kinds (conventional): o Descriptive (e.g. a set of equations or rules to define parameter relationships) o Graphical/volumetric (e.g. architectural and engineering system). Example Methods Polygonal Models o The most common type of model used in 3D - store faces of the Polygonal object as planar polygons o Each polygonal face may be represented by its vertices or edges o Physical properties of the object may also be held as part of the representation, for example colour, light, texture o Representation methods such as this are called Boundary Representations or B-reps. o This type of representation may also be used to represent an approximation to a curved surface, where the curved surface is approximated by planar polygonal patches Polygon Mesh 3D Modeling with Polygons o We construct 3D models using groups of polygons. A polygon mesh approximates the surface shape of an object by specifying a set of points in space these points representing o Each polygon is planar ⇒ we need a large number of vertices of various polygonal faces. small polygons to give the impression of curved we have 8 vertices and 6 (polygons) faces . surfaces: A list of vertices for a polygon is created by 48 polygons 120 polygons 300 polygons 1000 polygons looking at the polygon from the outside, listing the vertices in a counter-clockwise direction until a complete circle is made. Poly1 = {v1, v2, v3, v4} (front face) Poly2 = {v4, v3, v6, v5} (right face) 1

  2. Polygon Mesh Example Methods Parametric surface = θ sin 4 x = θ cos 2 y Example Methods Example Methods Voxels: Uniform grid of volumetric samples Implict surface: F(x, y, z) = Constant + + = 2 2 2 2 x y z r Sweep Objects Space Subdivision o This splits space into some o Define a polygon by its edges then sweep it along a arrangement of cells that cover path all of the space. o With each cell a note is kept as o Special cases to whether that cell is occupied by the model or not. o Surface of revolution: rotate edges about an axis o Obviously this method has o Extrusion: Sweep along a straight line limited accuracy. o Typically methods are based on quadtrees and octrees. 2

  3. Geometric Models Geometric Models o Geometric models are collections of components with well defined geometry and often interconnections between components, including engineering and architectural structures, and other chemical structures o Geometric models often have a hierarchical structure included by a bottom up construction process. Components are used as building blocks to create higher levels entities, which in turn serve as building blocks for yet higher level entities, and so on o Generally represented as a tree, with transformations and instances at any node Geometric Modeling Constructive Solid Geometry o Each node may have its own local coordinate o Constructive solid geometry (CSG) is a technique used in solid system modeling. CSG is often, but not always, a procedural modeling technique used in 3D computer graphics and CAD. o Most useful for animating polygonal meshes o Constructive solid geometry allows a modeler to create a complex surface or object by using Boolean operators to combine objects. o Rendered by traversing the tree, applying transformations, and rendering the instances o Often CSG presents a model or surface that appears visually complex, but is actually little more than cleverly combined or o Consider a walking robot: decombined objects. o Does the entire robot move in the same way? o In some cases, constructive solid geometry is performed on polygonal meshes, and may or may not be procedural and/or o Does the position of one part of the robot parametric. depend on other parts? Constructive Solid Geometry Constructive Solid Geometry o The simplest solid objects used for the representation are called primitives. o Typically they are the objects of simple shape: cuboids, cylinders, prisms, pyramids, spheres, cones. o The set of allowable primitives is limited by each software package. o Some software packages allow CSG on curved objects while Union Difference Intersection other packages do not. o It is said that an object is constructed from primitives by means of allowable operations, which are typically Boolean operations on sets: union, intersection and difference. 3

  4. Constructive Solid Geometry Constructive Solid Geometry o This object could be produced by gluing two rectangular blocks together and then drilling the hole o in CSG terms the the union of two blocks is taken and then the difference of the resultant solid and a cylinder is carried out o The basic primitive objects, the blocks and the cylinder, may have to be scaled to the correct size, possibly oriented and then placed in the correct positions relative to each other before the logical operations Procedural Methods Smoke Particle System o Constantly create o The pattern is produced by the particles code: o polyline(ns+1,verts); o Particles move for (i=0; i < nr; i++) upwards, with { turbulence added transverts(verts,ns,fc,fs); polyline(ns+1,verts); o Draw them as } partially transparent o where ns is the number of sides in circles that fade over the polygon, nr is the number of repetitions of the polygon and the time array verts holds the vertices of the current polygon. The function transverts applies a scaling and a rotation to the vertices at each step Particle Systems Basic Ocean o A particle has: o Ocean created with Computational Fluid Dynamics o A position in the world o Rules for how it moves over time o Rules for how it is drawn o A particle system: o Controls when particles are created and destroyed o Makes sure that all the particles are updated 4

  5. Procedural Approach Procedural Approach o Whilst being far from a solved problem, techniques have been developed for algorithmically generating convincing computer graphics models of landscapes, sea scapes, cloudscapes, forests, urban environment Substrate http://www.bartlett.ucl.ac.uk/ve/weblog/2004/10/procedural-urban-modelling.html Modeling in OpenGL OpenGL Command Formats o OpenGL provides a set of routines (API) for 3D graphics o derived from Silicon Graphics GL glVertex3fv( v v ) ) glVertex3fv( o draws simple primitives (points, lines, polygons) o provides control over transformations, lighting, texture etc. o In OpenGL, all geometry is specified by stating the type of object and then giving the vertices of the object o glBegin(…) …glEnd() o glVertex[34][fdv] Data Type Vector o Three or four components (regular or homogeneous) Number of Number of Data Type Vector o Float, double or vector (eg float[3]) components components b b - - byte byte omit “v” for omit “v” for o Primitives are defined by vertices, for example to draw a triangle: ub - ub - unsigned byte unsigned byte 2 - - (x,y) (x,y) scalar form scalar form 2 glBegin (GL_POLYGON); s - s - short short 3 - 3 - (x,y,z) (x,y,z) us us - - unsigned short unsigned short glVertex3v (0, 0, 0); 4 4 - - (x,y,z,w) (x,y,z,w) glVertex2f( x, y ) glVertex2f( x, y ) i i - - int int glVertex3v (0, 1, 0); ui ui - - unsigned int unsigned int glVertex3v (1, 0, 1); f f - - float float glEnd(); d - d - double double Geometric Primitives Geometric Primitives o All geometric objects in OpenGL are created from a o Polygon primitives set of basic primitives v 4 v 4 v 4 v 3 v 5 v 3 v 5 v 3 v 5 o Certain primitives are provided to allow optimisation of v 2 v 6 v 2 v 6 v 2 v 6 geometry for improved rendering speed o Line based primitives v 1 v 7 v 1 v 7 v 1 v 7 v 8 v 8 v 8 v 4 v 4 v 4 v 4 GL_TRIANGLES GL_QUADS GL_POLYGON v 3 v 5 v 3 v 5 v 3 v 5 v 3 v 5 v 3 v 4 v 2 v 8 v 2 v 6 v 2 v 6 v 2 v 6 v 2 v 6 v 5 v 4 v 3 v 6 v 2 v 5 v 1 v 7 v 1 v 7 v 1 v 7 v 1 v 7 v 2 v 8 v 8 v 8 v 8 v 1 GL_LINES GL_LINE_STRIP GL_LINE_LOOP GL_POINTS v 4 v 6 v 1 v 3 v 5 v 7 v 1 GL_TRIANGLE_STRIP GL_TRIANGLE_FAN GL_QUAD_STRIP 5

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