Game Development Reference
In-Depth Information
(a)
(b)
Fig 1.10 Vectors with the same
direction but different magnitudes (a)
and vectors with the same magnitude
but different directions (b).
Vectors are a fundamental element in 3D games as they describe the direction
in which objects are orientated, how they are moving, how they are scaled,
and even how they are textured and lit. The basics of vectors are explored
further in Chapter Two.
1.3.5 Size
Size is the relationship of the amount of space objects take up with respect
to each other. In art and design it can be used to create balance, focal points,
or emphasis. In computer graphics, size is referred to as scale . An object can
be scaled uniformly or in any direction. Figure 1.11 shows a 3D object (a)
scaled uniformly by 2 (b), by 3 vertically (c), by 0.5 horizontally (d), and by 1
vertically (e).
Note in Figure 1.11d how scaling by a negative value flips them vertically.
They can also be achieved uniformly or horizontally using negative scaling
values.
Depending on coordinates of an object, scaling will also move it. For
example, if an object is centered around (0,0), it can be scaled remaining in
the same place. However, if the object is away from (0,0), it will move by an
amount proportional to the scale. This occurs as scaling values are multiplied
with vertex coordinates to resize objects. A vertex at (0,0) multiplied by 2,
for example, will remain at (0,0), whereas a vertex at (3,2) multiplied by 2 will
move to (6,4). This is illustrated in Figure 1.12 .
1.3.6 Texture
In art and design, texture relates to the surface quality of a shape or object. For
example, the surface could be rough, smooth, or highly polished. In computer
games, texture refers not only to the quality, but also to any photographs,
colors, or patterns on the surface where the surface is defined by a polygon.