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

1
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

1

Modelling

  • The creation and manipulation of a system representation is

termed modelling

  • Any single representation is called a model of the system.
  • There are mainly two kinds (conventional):
  • Descriptive (e.g. a set of equations or rules to define parameter

relationships)

  • Graphical/volumetric (e.g. architectural and engineering system).

How to represent these objects in computer

Example Methods

Polygonal

Polygonal Models

  • The most common type of model used in 3D - store faces of the
  • bject as planar polygons
  • Each polygonal face may be represented by its vertices or edges
  • Physical properties of the object may also be held as part of the

representation, for example colour, light, texture

  • Representation methods such as this are called Boundary

Representations or B-reps.

  • 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

3D Modeling with Polygons

  • We construct 3D models using groups of polygons.
  • Each polygon is planar ⇒ we need a large number of

small polygons to give the impression of curved surfaces:

48 polygons 120 polygons 300 polygons 1000 polygons

Polygon Mesh

A polygon mesh approximates the surface shape of an object by specifying a set of points in space these points representing vertices of various polygonal faces.

we have 8 vertices and 6 (polygons) faces. A list of vertices for a polygon is created by 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)

slide-2
SLIDE 2

2

Polygon Mesh Example Methods

θ θ 2 4 cos sin = = y x

Parametric surface

Example Methods

2 2 2 2

r z y x = + +

Implict surface: F(x, y, z) = Constant

Example Methods

Voxels: Uniform grid of volumetric samples

Space Subdivision

  • This splits space into some

arrangement of cells that cover all of the space.

  • With each cell a note is kept as

to whether that cell is occupied by the model or not.

  • Obviously this method has

limited accuracy.

  • Typically methods are based
  • n quadtrees and octrees.

Sweep Objects

  • Define a polygon by its edges then sweep it along a

path

  • Special cases
  • Surface of revolution: rotate edges about an axis
  • Extrusion: Sweep along a straight line
slide-3
SLIDE 3

3

Geometric Models

  • Geometric models are collections of components with well

defined geometry and often interconnections between components, including engineering and architectural structures, and other chemical structures

  • 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

  • Generally represented as a tree, with transformations and

instances at any node

Geometric Models Geometric Modeling

  • Each node may have its own local coordinate

system

  • Most useful for animating polygonal meshes
  • Rendered by traversing the tree, applying

transformations, and rendering the instances

  • Consider a walking robot:
  • Does the entire robot move in the same way?
  • Does the position of one part of the robot

depend on other parts?

Constructive Solid Geometry

  • Constructive solid geometry (CSG) is a technique used in solid
  • modeling. CSG is often, but not always, a procedural modeling

technique used in 3D computer graphics and CAD.

  • Constructive solid geometry allows a modeler to create a complex

surface or object by using Boolean operators to combine objects.

  • Often CSG presents a model or surface that appears visually

complex, but is actually little more than cleverly combined or decombined objects.

  • In some cases, constructive solid geometry is performed on

polygonal meshes, and may or may not be procedural and/or parametric.

Constructive Solid Geometry

  • The simplest solid objects used for the representation are called

primitives.

  • Typically they are the objects of simple shape: cuboids, cylinders,

prisms, pyramids, spheres, cones.

  • The set of allowable primitives is limited by each software

package.

  • Some software packages allow CSG on curved objects while
  • ther packages do not.
  • 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.

Constructive Solid Geometry

Union Difference Intersection

slide-4
SLIDE 4

4

Constructive Solid Geometry Constructive Solid Geometry

  • This object could be produced by gluing two

rectangular blocks together and then drilling the hole

  • 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

  • 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

  • perations

Procedural Methods

  • The pattern is produced by the

code:

  • polyline(ns+1,verts);

for (i=0; i < nr; i++) { transverts(verts,ns,fc,fs); polyline(ns+1,verts); }

  • where ns is the number of sides in

the polygon, nr is the number of repetitions of the polygon and the array verts holds the vertices of the current polygon. The function transverts applies a scaling and a rotation to the vertices at each step

Smoke Particle System

  • Constantly create

particles

  • Particles move

upwards, with turbulence added

  • Draw them as

partially transparent circles that fade over time

Particle Systems

  • A particle has:
  • A position in the world
  • Rules for how it moves over time
  • Rules for how it is drawn
  • A particle system:
  • Controls when particles are created and destroyed
  • Makes sure that all the particles are updated

Basic Ocean

  • Ocean created with Computational Fluid Dynamics
slide-5
SLIDE 5

5

Procedural Approach Procedural Approach

  • 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 provides a set of routines (API) for 3D graphics
  • derived from Silicon Graphics GL
  • draws simple primitives (points, lines, polygons)
  • provides control over transformations, lighting, texture etc.
  • In OpenGL, all geometry is specified by stating the type of object and

then giving the vertices of the object

  • glBegin(…) …glEnd()
  • glVertex[34][fdv]
  • Three or four components (regular or homogeneous)
  • Float, double or vector (eg float[3])
  • Primitives are defined by vertices, for example to draw a triangle:

glBegin (GL_POLYGON); glVertex3v (0, 0, 0); glVertex3v (0, 1, 0); glVertex3v (1, 0, 1); glEnd();

OpenGL Command Formats

glVertex3fv( glVertex3fv( v v ) )

Number of Number of components components

2 2 -

  • (x,y)

(x,y) 3 3 -

  • (x,y,z)

(x,y,z) 4 4 -

  • (x,y,z,w)

(x,y,z,w)

Data Type Data Type

b b -

  • byte

byte ub ub -

  • unsigned byte

unsigned byte s s -

  • short

short us us -

  • unsigned short

unsigned short i i -

  • int

int ui ui -

  • unsigned int

unsigned int f f -

  • float

float d d -

  • double

double

Vector Vector

  • mit “v” for
  • mit “v” for

scalar form scalar form glVertex2f( x, y ) glVertex2f( x, y )

Geometric Primitives

  • All geometric objects in OpenGL are created from a

set of basic primitives

  • Certain primitives are provided to allow optimisation of

geometry for improved rendering speed

  • Line based primitives

GL_POINTS GL_LINES GL_LINE_STRIP GL_LINE_LOOP

v4 v1 v2 v3 v5 v6 v7 v8 v1 v2 v3 v5 v6 v7 v8 v1 v2 v3 v5 v6 v7 v8 v1 v2 v3 v5 v6 v7 v8 v4 v4 v4

Geometric Primitives

  • Polygon primitives

v4 v1 v2 v3 v5 v6 v7 v8 v1 v2 v3 v5 v6 v7 v8 v1 v2 v3 v5 v6 v7 v8

GL_TRIANGLES GL_QUADS GL_POLYGON GL_TRIANGLE_STRIP

v4 v4 v4 v1 v2 v3 v5 v6

GL_TRIANGLE_FAN

v4 v1 v2 v3 v5 v1 v2 v3 v5 v6 v7 v8 v4

GL_QUAD_STRIP