Game Development Reference
In-Depth Information
Animating 3D Graphics
We've now seen how to create a 3D model and display it on the screen, but we're
currently limited to non-animated models. Sure, we can rotate or scale to our heart's
content, but that really doesn't cut it when you want to animate something more
complex than a cube, say for example a human figure.
In this chapter we will be looking at the following topics:
• A quick overview of the concepts involved in 3D animation
• Exporting animations from a 3D modeling package
• Loading and rendering an exported 3D animation in a Marmalade project
A quick 3D animation primer
Let's start by looking at the ways in which animation of 3D models can be achieved.
Animating with model matrices
By far the simplest and most obvious way of animating a 3D model is to alter its
position, orientation, and size. All three of these properties can be specified using the
model matrix set at the time of rendering the model.
We could store a matrix in our game class, and for each frame multiply it by a second
matrix representing the change in position, rotation, and scale; but this approach is
generally not reliable. Over time the matrix starts to degrade due to the cumulative
effect of precision errors in the multiplications and additions involved. The matrix
will often end up becoming non-orthogonal (that is, its three axes are no longer at
right angles to each other), which yields a shearing effect on the 3D model. The scale
can also be affected by these precision errors, causing the 3D model to gradually
shrink in size!
Search WWH ::




Custom Search