Game Development Reference
In-Depth Information
on a particular frame. Such algorithms include binary spatial partitioning (BSP),
portals, and occlusion volumes, but are also well beyond the scope of this topic.
World Transform, Revisited
Although this chapter has covered enough to successfully render a 3D scene, there
are some outstanding issues with the world transform representation covered earli-
er in this chapter. The first problem is one of memory—if the translation, scale,
androtationmustbemodifiedindependently,eachmatrixneedstobestoredsepar-
ately, which is 16 floating point values per matrix, for a total of 48 floating points
for three matrices. It is easy enough to reduce the footprint of the translation and
scale—simply store the translation as a 3D vector and the scale as a single float
(assuming the game only supports uniform scales). Then these values can be con-
verted to the corresponding matrices only at the last possible moment, when it's
time to compute the final world transform matrix. But what about the rotation?
TherearesomebigissueswithrepresentingrotationsusingEulerangles,primarily
because they're not terribly flexible. Suppose a spaceship faces down the z-axis in
model space. We want to rotate the space ship so it points instead toward an arbit-
rary object at position P . In order to perform this rotation with Euler angles, you
need to determine the angles of rotation. But there isn't one single cardinal axis
the rotation can be performed about; it must be a combination of rotations. This is
fairly difficult to calculate.
Another issue is that if a 90° Euler rotation is performed about a coordinate axis,
the orientation of the other coordinate axes also changes. For example, if an object
is rotated 90° about the z-axis, the x- and y-axes will become one and the same,
and a degree of motion is lost. This is known as gimbal lock , as illustrated in Fig-
ure 4.18 , and it can get very confusing very quickly.
Search WWH ::




Custom Search