DirectX 8 and VB Development: Animation Techniques
- Animation Techniques
- DirectX Objects
- DirectX Techniques
Many of us grew up watching cartoon characters every Saturday morning, but we never really appreciated the work that went into making them. In this section of the book, you'll be looking at animation techniques that have been around for many years. These techniques gave birth to talking rabbits, wacky ducks, and a mouse named Mickey.
Animation is the art of creating the illusion of movement from inanimate objects. Before we had full-motion moving pictures, there was animation. Flipbooks were small books with pages where small caricatures were drawn. As you flipped the books from front to back, the drawings looked as though they were animated. Some flipbooks came empty, and you could add your own drawings. Flipbooks gave the illusion that the cartoon character in the pages was actually moving before our eyes. This illusion is the cornerstone of animation. With some simple animation techniques, you can add impressive flare or sex appeal to your multimedia applications.
In this section, you'll be looking at the basics of traditional animationhow animators have been able to achieve lifelike expressions of many different objects. This is by no means a thorough explanation of animation, only an introduction to make DirectX easier to understand.
The Model Sheet
If you're going to create a character to animate, it usually helps to have a model sheet, which is a series of poses of the character to refer to when you're animating. The sheet could include poses of the character standing still, bouncing a ball, smiling, jumping, and running, for example. The idea is to draw the emotions and actions that would be expected from the character. If your animations are going to be much simpler than an animated person or animal, however, a model sheet might not be necessary.
A frame is a snapshot in time. If you were to take your favorite animated movie and pause the playback for a split second, you would see one frame of animation. Imagine a bird in flight. If you could stop this bird while it was flying along its course, you might see the wings folded slightly. Maybe its eyelids are opening or closing, and maybe the beak is slightly open. If you paused the playback a second later, the next frame would look different. Figure 3.1 shows a single frame of animation in which a spinning donut is frozen in time.
Figure 3.1 A frame of animation.
Animation moves in cycles, and a cycle is a series of frames that make up an action. For example, the cycle of walking can be made up of about eight frames. This cycle begins with the character picking up his right foot with his right shoulder raised slightly. The cycle continues until frame 4, where the right foot is back on the ground. Then the same process happens with the left foot. Finally, frame 8 ends with the left foot being put back on the ground. Cycles can be repeated, if necessary, thus reducing the need for creating the animated frames from scratch. When frame 8 of the walking cycle is finished, for example, just start over with frame 1. The character can walk on forever, if you want.
A complex animation, such as those seen in cartoons, is made up of many individual cycles. For example, the character moves to a specific spot (cycle 1). The character stands and acts as though he or she is thinking about something (cycle 2). The character suddenly does an about-face (cycle 3). Finally, the character walks back the way he or she came (cycle 4). Figure 3.2 shows four cycles of a character walking in four different directions. Each cycle in the figure is made up of three frames.
Figure 3.2 An animation cycle.
I've talked about how to go from an individual split second in time into a cycle. Now comes the question "How do I decide what I need and how it's organized?" This is where the storyboard comes in. Storyboards are a series of small panels showing major scenes of action in the animation. Storyboards were brought into the mainstream of animation with the Walt Disney studios, which perfected their use. Through the use of a storyboard, lead animators could create sample drawings of the scenes as they imagined them and write in the dialogue just below the storyboard panes. Today developers of multimedia applications use similar processes to organize the action before they begin actual development. Figure 3.3 shows a section of a much larger storyboard used to explain the action of a scene.
Figure 3.3 A storyboard.
Lead animators would then take these storyboard scenes and create individual frames of the animation at specific pivot points in the action. These points are called keyframes. Keyframes are drawn where parts of the character's body reach their full range of motion. For example, an arm can bend only so far back before it breaks. If the character has reached that point in the animation, then that frame of animation should be a keyframe. The same goes for head movements and any body appendages. These drawings create the templates from which other animators can create the finished frames of the cartoon.
So you've created an animation. It looks fantastic, but it's just bouncing around on a blank screen. Now you need to create a background, which is the environment you want to add to your scene that helps set the mood for the animation. Backgrounds were painted in most earlier animated cartoons, but more and more of them have moved to using computer-generated backgrounds. This type of background is very similar to what you'll be working with in DirectX. You can create backgrounds with many different paint programs because DirectX can use almost any popular graphics format.