Graphics Reference
In-Depth Information
• be able to program simple intelligence in our 3D application where objects
can follow or orient toward any given position and/or direction.
It is interesting and encouraging that almost all of the concepts we have learned
from the earlier chapters concerning computer graphics in 2D space are valid in
3D space. The only notable exception is rotation, where rotation in 2D space is
really a highly restrictive special case of rotation in 3D. In this chapter, we will
iterate through all the relevant concepts we have learned in 2D and demonstrate
how to extend them into the third dimension. We will pay special attention to
rotations in 3D space.
Figure 16.1.
Approx-
imating
cone,
cube,
and
cylinder with triangles.
16.1
Graphical Primitives for the Third Dimension
So far we have worked with 2D primitives displayed in 3D space. We say 2D
primitives because the primitives only have areas but do not occupy volume. For
example, a circle and a rectangle are 2D primitives with length and width that
define areas. These primitives have zero measurements in the third dimension
(height) and thus do not occupy any volume. In the previous chapter, the tutorials
viewed these 2D primitives with a camera in 3D environments.
A true 3D primitive must have measurements in all three dimensions: width,
length, and height (e.g., spheres, cubes, cylinders). As discussed in Chapter 7, for
efficiency concerns all popular modern graphics hardware only support points,
lines, and triangles. This means that existing graphics hardware does not support
any 3D primitives directly. Instead, just as we have approximated circles with
triangles in 2D space, the graphics hardware expects programmers to approxi-
mate 3D primitives and objects with triangles. Figure 16.1 shows examples of
approximating a cone, a cube, and a cylinder with triangles.
Figure 16.2.
Mesh
model of a biplane.
16.1.1 Mesh Objects and Mesh Files
As discussed in Section 7.1.3 (on p. 161), for efficiency in computation and repre-
sentation, modern graphics hardware often defines intelligent collection structures
for grouping primitives. In the case of triangles, we have seen and have worked
with triangle fans and triangle strips. These collection structures are usually re-
Triangle strip/fan. See Sec-
tion 7.1.3 for the discussions
of these compound primitives.
ferred to as meshes, and geometric objects approximated by meshes are referred
to as mesh objects or mesh models. In general, a mesh can consist of polygons
with any number of sides. For example, it is possible to define a mesh object based
on quadrilaterals. These polygons will be triangulated by the graphics hardware
during rendering.
Search WWH ::




Custom Search