9. Meshes
Brock University
COSC 3P98 Computer Graphics
Instructor: Brian J. Ross
Models
-
Modeling: the mathematical definition of graphical objects for rendering
-
Modeling objects is an art. Many different techniques have evolved for
creating more realistic objects.
-
CAD systems have been a major source of tools
-
CAD systems concerned with precision, and typically model rigid geometries
-
new interest in organic shapes employ new tools: fractals, metaclay
-
3D scanners: accurate digital modeling of real objects
-
Two interrelated aspects:
-
1. Tools: types of modeling tools, techniques for use, and their GUIs
-
success measured by their utility, practicality
-
examples: polygon editing, lathes, extrusions, 3D scanners, ...
-
2. Mathematical modeling: mathematical means for defining objects
-
success measured by the types of objects definable and editable, and their
efficiency
-
examples: polygonal models, 2D spline curves, 3D spline surfaces, fractals
Polygon models
-
basic modeling approach
-
given a solid object, we can define its geometry in terms of polygons
-
ie. points in 3D space, with edges connecting them
-
if we only draw the edges, we get a wireframe
-
if we draw solid polygon faces, we get solid surfaces
-
such objects have vertices, edges, and faces
-
planar simple convex polygons are used to draw surfaces
-
an advanced topic is the use of non-planar surfaces ie. surfaces with curves
and bumps
Polygon meshes
-
polygon mesh: a set of polygons with shared edges
-
connected mesh: every faces shares at least one edge with some other,
face
-
can move from one face to any other by traversing edges
-
simple polygon: no edges intersect except at endpoints
-
planar polygon: all vertices lie on a plane
-
triangles are only polygon guaranteed to be planar
-
polyhedron: connected mesh of simple polygons such that every edge
shared by exactly 2 faces --> closed
-
convex polyhedron: a volume is convex iff for any 2 vertices, the
line segment connecting them is within the volume
Examples of polygon meshes
Face list for the prism
Face number |
Vertices |
1 |
1, 3, 2 |
2 |
6, 2, 3, 4 |
3 |
1, 5, 4, 3 |
4 |
4, 5, 6 |
5 |
1, 2, 6, 5 |
- : Note that we can split the quadrilateral (4-vertex polygons) into triangles.
This simplifies the data structure definition, but then may result in duplicate
vertex definitions.
-
More examples:
Building meshes
-
meshes are a fundamental way of constructing 3D volumes in graphics
-
ways to build them:
-
1. Manually
-
define points table, and then define the faces composing mesh
-
polygons are often squares or triangles, but can be more complex
-
time consuming, but a very common method esp. for games
-
OpenGL: supports triangular meshes and quadrilateral strips
glBegin(GL_TRIANGLE_STRIP);
glVertex3fv(A);
glVertex3fv(B);
glVertex3fv(C);
glVertex3fv(D);
glVertex3fv(E);
...
glEnd();
- also GL_TRIANGLE_FAN, GL_QUAD_STRIP
- These are used to optimize the transferral of mesh vertices.
- Results in fewer calls to OpenGL, as well as faster rendering (lighting).
Building meshes
-
2. Automatically
-
i) Patches: use computed grids of triangles/squares
-
especially useful when surface can be defined mathematically
-
ii) point sampling + triangulation: using lasers or other devices, get
different (x,y,z) coordinates of random points on object
-
then you apply a 2d or 3d hull/triangulation algorithm, which creates triangular
mesh
Data structures for meshes
-
Your application model can use a variety of data structures and their implementations
(arrays, lists, trees, ...)
-
the crudest way is to define a sequential list of vertice coordinates
-
eg. square = { (0,0,0), (0,1,0), (1,1,0), (1,0,0)}
-
disadvantages:
-
coordinate values are duplicated, which wastes space
-
during processing, identical coordinates may become different due to roundoff
error
-
difficult to match different polygon's shared vertices & edges
-
better: table of points, then table of edges, faces, or both
-
depending on application, you can have data structure tell you as much
information as you need
- eg. edge list can indicate the polygons that use
it (at least 1, max of 2)
-
Composite objects important: defining hierarchical models
-
can use different tools for subcomponents
-
can copy/duplicate components
-
animation: components can be assigned separate movement characteristics
Meshes
Back
to COSC 3P98 index
COSC 3P98 Computer Graphics
Brock University
Dept of Computer Science
Copyright © 2020 Brian J.
Ross (Except noted figures).
http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/modeling/mesh.html
Last updated: February 1, 2023