Game Development Reference

In-Depth Information

1.3.3 Shape

A shape refers not only to primitive geometrics such as circles, squares, and

triangles, but also to freeform and nonstandard formations. In computer

graphics, polygons are treated as they are in geometry; a series of points

called
vertices
connected by straight
edges
. By storing the coordinates of the

vertices the edges can be reconstructed using straight line algorithms. A circle

is often represented by as a regular polygon with many edges. As the number

of edges increases, a regular polygon approaches the shape of a circle.

Freeform objects involve the use of curves. To be stored and manipulated

by the computer efficiently, these need to be stored in a mathematical

format. Two common types of curves used include Bezier and nonuniform

rational basis spline (NURBS).

A Bezier curve is constructed from a number of control points. The first and

last points specify the start and end of the curve and the other points act as

attractors, drawing the line toward them and forming a curve, as shown in

Figure 1.8
. A NURBS curve is similar to a Bezier curve in that it has a number

of control points; however, the control points can be weighted such that

some may attract more than others.

In computer graphics, a polygon is the basic building block for objects,

whether in 2D or 3D. A single polygon defines a flat surface onto which

texture can be applied. The most efficient way to define a flat surface is

through the use of three points; therefore, triangles are the polygon of choice

for constructing models, although sometimes you will find square polygons

used in some software packages. Fortunately for the artist, modeling software

such as Autodesk's 3DS Studio Max and Blender do not require models to be

handcrafted from triangles; instead they automatically construct any objects

using triangles as a base as shown in
Figure 1.9
.

Fig 1.8
A Bezier and a NURBS curve.

Bezier Curve

NURBS Curve

P3

P2

X

X

P3

X

P2

P4

X

X

P5

X

X

X

P4

P1

X

P1

X

P6