Game Development Reference
In-Depth Information
If we want to play back this animation, we could just draw the relevant 3D model at
the correct time, but this would yield very jerky results akin to 2D bitmap animation.
Instead, we can calculate an Interpolated Frame for any time index between 0 and 2
seconds to give a much smoother result.
Calculating the interpolated frame is simple enough. We work out a delta vector
from each vertex in the first key frame to the corresponding vertex in the second
key frame. We then scale the delta vector by the ratio of the time index we want to
calculate for, divided by the total time between the two key frames, and add the
scaled result on to the position of the vertex in the first key frame.
In the diagram, we want to calculate an interpolated frame at time index 1 second, so
we would scale the delta vectors by a factor of half. The end result will be the frame
shown where the arm is half raised.
This approach may be easy to implement, but ultimately we find that there are a few
problems with it, as follows:
• Accuracy of resultant animation: Take a good look at the interpolated frame
of the stick man in the previous diagram and you will see that the stick man's
arm has actually shrunk. This is because we are interpolating the vertex
positions in a straight line, whereas we really need the end vertices to be
rotated around the shoulder point.
• Number of key frames required: In order to produce a good quality
animation we need to store a good number of key frames. In the example
of our stick man animation, we could provide additional key frames that
would then minimize the arm shortening effect. However, since we need
to store the position of every vertex in the model, whether it has moved
or not, this soon becomes a large amount of data.
 
Search WWH ::




Custom Search