As with regular key-framed animation that stores multiple copies of the vertices, skeletal animation systems also have keyframes. Recall that keyframes are snapshots of a model’s position.
However, instead of each keyframe containing its own copy of the vertices, a skeletal animation keyframe or boneframe contains a transformation, both rotation and translation, generally in the form of an X, Y,Z value for translation, and three values containing rotation around the X, Y, and Z axes, respectively. Just as with regular vertex keyframes, these boneframes must be interpolated to provide a smooth result.
The position or translation values can be linearly interpolated between, just as you have been doing with the vertices in traditional animation. The rotations pose a problem. Simply interpolating between them as you do with the translation values can cause strange effects. The rotation will not be smooth; it will speed up and slow down depending on its location. If the rotation differences are great, the model may appear to “ooze” like a lump of gelatin. This is because when using linear interpolation, everything gets interpolated along a straight line. This can cause strange effects when performed with rotations because rotations are meant to be interpolated along an arc rather than a line. Cutting straight across the arc rather than following it causes the “ooze” effect.
The best way to get around this is to use quaternions. As you learned in Chapter 2, “ Introduction to Quaternions,” one of the biggest advantages of quaternions is that they can be interpolated easily. Not only can they be easily interpolated; they can be easily spherically linearly interpolated.
Spherical linear interpolation interpolates between two points on the surface of the sphere. However, instead of cutting straight from one to the other, spherical linear interpolation follows the surface of the sphere. You can visualize this by picking up a round ball, such as a basketball, and marking two points on it. Then, using your finger, find the shortest path between the two points. Because your finger cannot go inside the ball, the resulting path between the two points will be an arc. This is what SLERP does. Using the SLERP function, the rotations can be interpolated along an arc, creating a nice smooth, eye-pleasing effect.