The best way to learn about animation is to start animating, so you’ll begin this chapter with the classic exercise of bouncing a ball. You’ll then take a closer look at the animation tools the Autodesk® Maya® software provides and how they work for your scene. You’ll do that by throwing an axe. Finally, you’ll tackle animating a more complex system of parts when you bring a locomotive to life.
No matter where you study animation, you’ll always find the classic animation exercise of creating a bouncing ball. Although it’s a straightforward exercise and you’ve probably seen it a hundred times on the Web and in other books, the bouncing ball is a perfect exercise with which to begin animating. You can imbue the ball with so much character that the possibilities are almost endless, so try to run this exercise as many times as you can handle. You’ll improve with every attempt.
First, you’ll create a rubber ball and create a proper animation hierarchy for it. Then, you’ll add cartoonish movement to accentuate some principles of the animation techniques discussed at the end of the ultra-fabulous Chapter 1, “Introduction to Computer Graphics and 3D.”
Visit the book’s web page for a video tutorial on this ball animation exercise.
First you need to create the ball, as well as the project for this exercise. Follow these steps:
Figure 8-1: Place the ball on the ground.
First you’ll set up the ball with three null nodes above it, listed here from the top parent node down: translate, scale, rotate. All the animation will be placed on these three nodes and not the sphere itself. This will allow you to easily animate the ball bouncing, squashing, stretching, and moving forward in space.
Figure 8-2: The ball’s hierarchy
As you animate, you’ll quickly see why you’ve set up a hierarchy for the ball, instead of just putting keys on the sphere.
Your next step is to keyframe the positions of the ball using the nodes above the sphere. You’ll start with the gross animation, which is the overall movement scheme, a.k.a. blocking. You’ll move the ball up and down to begin its choreography in these steps:
Press Shift+W to set keyframes on Translate X, Translate
Y, and Translate Z at frame 1 for the top node of the ball (named
translate). To make sure your scene is set up properly, set your animation
speed to 30fps by choosing Window ⇒ Settings/Preferences ⇒
Preferences to open the Preferences window or by clicking the Animation
Preferences button () next to the Auto Keyframe button. In the Settings
category of the Preferences window, set Time to NTSC (30fps). A frame range
of 1 to 120 is good for now. Figure 8-3 shows the ball’s start position.
Figure 8-3: Start the ball here and set a keyframe on the translate node.
Figure 8-4: The Graph Editor curves for the ball’s translate node
By holding down the Shift key as you pressed W in step 2, you set a keyframe for Translate. Likewise, you can keyframe Rotation and Scale with hotkeys. Here’s a summary of the keystrokes for setting keyframes:
You’ll resume this exercise after a look at the Graph Editor.
To use the Maya Graph Editor, select Window ⇒ Animation Editors ⇒ Graph Editor. It’s an unbelievably powerful tool for the animator (see Figure 8-5) to edit keyframes in animation.
Every movement that is set in Maya generates a graph of value versus time, and the Graph Editor gives you direct access to those curves for fine-tuning your animation. The Graph Editor displays animation curves as value versus time, with value running vertically and time horizontally. Keyframes are represented on the curves as points that can be freely moved to adjust timing or value. This window is truly an animator’s best friend. Move a keyframe in time to the right (to be later in the timeline), for example, to slow the action. Move the same keyframe to the left (to be earlier in the timeline) to speed up the action.
The Graph Editor is divided into two sections. The left column, which is much like the Outliner, displays the selected objects and their hierarchy with a listing of their animated channels or attributes. By default, all of an object’s keyframed channels are displayed as colored curves in the display to the right of the list. However, by selecting an object or an object’s channel in the list, you can isolate only those curves that you want to see.
Figure 8-5: The Graph Editor
Using the Graph Editor to read animation curves, you can judge an object’s direction, speed, acceleration, and timing. You’ll invariably come across problems and issues with your animation that require a careful review of their curves. Here are a couple of key concepts to keep in mind.
First, the curves in the Graph Editor are like the NURBS curves you’ve modeled with so far. This time, points on an animation curve represent keyframes, and you can control the curvature with their tangency handles. By grabbing one end of a key’s handle and dragging it up or down, you adjust the curvature.
Second, the graph is a representation of an object attribute’s position (vertical) over time (horizontal). So, not only does the placement of the keys on the curve make a big difference, so does the shape of the curve itself. Here is a quick primer on how to read a curve in the Graph Editor and, hence, how to edit it.
In Figure 8-6, the object’s Translate X attribute is being animated. At the beginning, the curve quickly begins to move positively (that is, to the right) in the Z-axis. The object shoots off to the right and comes to an ease-out, where it decelerates to a stop. The stop is signified by the flat part of the curve at the first keyframe at frame 41. The object then quickly accelerates in the negative X direction (left) and maintains a fairly even speed until it hits frame 62, where it suddenly changes direction and goes back right for about 45 frames. It then slowly decelerates to a full stop in an ease-out.
Figure 8-6: An animation curve
Consider a single object in motion. The shape of the curve in the Graph Editor defines how the object moves. The object shown in Figure 8-7 is moving in a steady manner in one direction.
Figure 8-7: Linear movement
Figure 8-8 shows the object slowly accelerating toward frame 30, where it suddenly comes to a stop. If there is nothing beyond the end of the curve, there is no motion. The one exception deals with the infinity of curves, which is discussed shortly.
Figure 8-8: Acceleration (ease-in)
The object in Figure 8-9 begins moving immediately and comes to a slow stop by frame 27, where the curve first becomes flat.
Figure 8-9: Deceleration (ease-out)
Now, let’s apply what you’ve learned about the Graph Editor to the bouncing ball. Follow these steps:
Figure 8-10: Move all the keyframes for both curves to the right to slow the initial fall by two frames, but leave the timing the same for the rest.
As the ball’s bounce decays over time, it goes up less but still takes the same amount of time (10 frames) to go up the lesser distance. For better timing, adjust the last few bounces to occur faster. Select the keys on the last three bounces and move them, one by one, a frame or two to the left to decrease the time on the last short bounces. (See Figure 8-11.)
Figure 8-11: Move the keys to make the final short bounces quicker and the bounce height feel right.
In animation, timing is all about getting the keyframes in the proper order. Judging
the speed of an object in animation is critical to getting it to look right, and
that comes down to timing. Download the file ball_v01.mb
from the
Bouncing_Ball project on the companion web page, www.sybex.com/go/introducingmaya2015, to get to this point.
When you play back the animation, it seems a bit unrealistic, as if it’s rising and falling on a wave as opposed to really hitting the ground and bouncing back. The problem with the animation is that the ball eases in and out as it rises and falls. By default, setting a key in Maya sets the keyframes to have an ease-in and ease-out in their curves, meaning their curves are smooth like a NURBS curve. For a more natural motion, you need to accelerate the ball as it falls with a sharp valley in the curve, and you need to decelerate it as it rises with smooth peaks. Follow these steps:
Figure 8-12: The adjusted timing of the bounce
The concept of squash and stretch has been an animation staple for as long as animation has existed. It’s a way to convey the weight of an object by deforming it to react (usually in an exaggerated way) to gravity and motion. You can do this by scaling your object.
Download the file ball_v02.mb
from the Bouncing_Ball project on the
book’s web page and follow these steps:
Figure 8-13: Squashing and stretching the ball to react to bouncing on the floor
Download the file ball_v03.mb
from the Bouncing_Ball project on the
book’s web page to get to this point.
Let’s add some roll to the ball in these steps:
Figure 8-14: Setting a roll for the ball
Load the file
ball_v04.mb
from the Bouncing_Ball project from the companion web
page to see an example of the finished bouncing ball. Although the bouncing of this
ball looks okay, it could definitely use some finesse, a little timing change, and
so on. Open the file, open the Graph Editor, and edit the file to get a feel for
animating it in your own style.
This next project will exercise your use of hierarchies and introduce you to creating and refining motion to achieve proper animation for a more complex scene than the bouncing ball. The workflow is simple but standard for properly setting up a scene for animation, also known as rigging. First you’ll model an axe and a target, and then you’ll set up the grouping and pivots for how you want to animate. Then you’ll throw your axe!
Why won’t you throw the NURBS axe you’ve already created and textured? Because later in this chapter, you’ll need it for an exercise on importing and replacing an object in Maya while keeping the animation intact. You’ll see a video tutorial on the book’s website for the axe throwing exercise.
To begin the animation right away, you’ll use a basic axe and bull’s-eye target to focus on animation and technique.
Create a new project: Choose File ⇒ Project Window and click the New button. Place this project in the same folder or drive as your other projects, call it Axe, and click Accept. Click the Animation Preferences button, and set the frames per second to 30fps.
What separates good animation from bad animation is the feeling of weight that the audience infers from the animation. People instinctively understand how nature works in motion. You see an object in motion, how it moves, and how it affects its surroundings. From that, you can feel the essence of its motion, with its weight making a distinct impression on you. As it pertains to animation, that essence is simply called weight. A good feeling of weight in animation depends on timing and follow-through, which require practice.
It’s a good idea first to try an action you want to animate. It may upset the cat if you grab a real axe and start throwing it around your house, but you can take a pen, remove its cap, and lob it across the room. Notice how it arcs through the air, how it spins around its center of balance, and how it hits its mark. Just try not to take out anyone’s eye with the pen. According to some Internet research, the perfect axe throw should contain as few spins as possible.
The first step is to keyframe the positions of the axe, starting with its gross animation—that is, the movement from one end of the axe’s trajectory to the other.
Load the scene file axe_v1.mb
in the Scenes folder of the Axe project
from the companion web page and follow these steps:
Instead of the axe just flying through the air toward the target, you’ll animate the axe moving back first to create anticipation, as if an invisible arm were pulling the axe back before throwing it. Follow these steps:
Because you’ve moved the axe back only in the X-axis and made the rotation only on the Z-axis, Auto Keyframe sets keyframes only for Translate X and Rotate Z. The other position and rotation axes aren’t auto-keyframed because their values didn’t change. Take note of this fact.
Notice that you have to move the axe in the X- and Y-axes, whereas before you had to move it back only in the X-axis to create anticipation. This is because the axis of motion for the axe rotates along with the axe. This is an example of the Local axis. The Local axis for any given object shifts according to the object’s orientation. Because you angled the axe back about 45 degrees, its Local axis rotated back the same amount.
The file axe_v2.mb
in the Scenes folder of the Axe project from the
companion web page will catch you up to this point in the animation.
This last step reveals a problem with the animation. If you scrub your animation now, you’ll notice that the axe’s movement back is different from before, setting a keyframe at frame 40. Why intentionally create a problem like this? Troubleshooting problems in a scene is vital to getting good as a CG animator, so the more you learn how to diagnose problems, the easier production will become.
This is because of the Auto Keyframe feature. At frame 1, you set an initial keyframe for the X-, Y-, and Z-axes of translation and rotation. Then, at frame 15, you moved the axe back in the X-axis only (in addition to rotating it in the Z-axis only).
Auto Keyframe set a keyframe for Translate X at frame 15. At frame 40, you moved the axe in both the X- and Y-axes to strike the target. Auto Keyframe set a keyframe at 40 for Translate X and Translate Y. Because the last keyframe for Translate Y was set at 1 and not at 15 as in the case of Translate X, there is now a bobble in the Y position of the axe between frames 1 and 15.
With the axe selected, open the Graph Editor (choose Window ⇒ Animation Editors ⇒ Graph Editor) to see what’s happening. You should see red, green, and blue line segments running up and down and left and right. You’ll probably have to zoom your view to something more intelligible. By using the Alt key (or the Alt/Option key on a Mac) and mouse-button combinations, you can navigate the Graph Editor much as you can any of the modeling windows.
The hotkeys A and F also work in the Graph Editor. Click anywhere in the Graph Editor window to make sure it’s the active window and press A to zoom all your curves into view. Your window should look something like Figure 8-15.
The curves in the Graph Editor represent the values of the axe’s position and rotation at any given time. The X-, Y-, Z-axes are in their representative red, green, or blue color, and the specific attributes are listed much as they are in the Outliner in the left column. Selecting an object or an attribute on the left displays its curves on the right.
Figure 8-15: The Graph Editor displays the axe’s animation curves.
You should also notice that the curves are all at different scales. The three rotate curves range in value from about –45 to 45, the Translate Y curve ranges from about 15 to 5, and Translate Z looks flat in the Graph Editor. It’s tough to edit a curve with low values and still be able to see the timings of a larger value curve.
You can select the specific attribute and zoom in on its curve to see it better, or
you can normalize the curves so that you can see them all in one view.
Click the Enable Normalized Curve Display icon in the top icon bar of the Graph
Editor (). The values
don’t change, but the curves now display in a better scale in relation to each other
so you can see them all together.
Figure 8-16 shows the Graph Editor
from Figure 8-15 after the curves have been normalized.
Keep in mind that this doesn’t change the animation in the slightest. All it does is
allow you to see all the curves and their relative motion. You can denormalize the
view by clicking the Disable Normalized Curve Display icon in the Graph Editor ().
Figure 8-16: The normalized view in the Graph Editor lets you see all the curves of an animation together in the same scale.
Notice that the curve for Translate Y has keyframes only at frames 1 and 40. The animation dips in the first 15 frames because there is no keyframe at frame 15 like there is for Translate Z. That dip wasn’t there before you set the end keyframe at frame 40.
Continue the exercise by fixing this issue:
Scrub your animation, and the backward movement looks like it did before.
The axe now needs an arc on its way to the target.
If the axe is slightly rotated in frame, Auto Keyframe can set a key for both Translate Y and Translate X, although you were perhaps expecting only a key in Translate Y. Because the Move tool is on the axe’s Local axis and because the axe was slightly rotated at frame 27, there is a change in the Y and X positions in the World axis, which is the axis represented in the Graph Editor.
By moving the keyframe down, you change the Rotate Z value to a lower number, which spins the axe clockwise. Before you try that, though, move your Graph Editor window so you can see the axe in the Perspective window. As you move the Rotate Z keyframe down in the Graph Editor, you see the axe rotate interactively. Move the keyframe down until the axe does a full spin.
Now, when you play back the animation, it should look slow. Maya is playing the scene back in real time, but even at 30fps, the scene plays back slowly, and this means that the animation of the axe is too slow.
Load the axe_v3.mb
file from the Axe project on the book’s web page or
continue with your own file.
The axe is missing weight. You can add some finesse to the scene using follow-through and secondary motion to give more weight to the scene.
In the axe scene, follow-through motion is the axe blade driving farther into the target a little beyond its initial impact. Secondary motion is the recoil in the target as the momentum of the axe transfers into it. As you increase the amount of follow-through and secondary motion, you increase the axe’s implied weight. You must, however, walk a fine line; you don’t want to go too far with follow-through or secondary motion. Follow these steps:
If you play back the animation, the follow-through doesn’t look good. The axe hits the target and then digs into it as if the action were done in two separate moves by two different animators who never talked to each other. You need to smooth out the transition from the axe strike and its follow-through in the Graph Editor.
Figure 8-17: The normalized Rotate Z curve of the axe after the follow-through animation
When you set keyframes for the axe, you create Bézier splines animation curves in the Graph Editor. These curves stay as smooth as possible from beginning to end. When you set the new keyframe, rotating the axe about 1.5 more degrees for follow-through, the animation curve responds by creating a dip, as shown in Figure 8-17, to keep the whole curve as smooth as possible.
The axe needs to hit the target with force and dig its way in, slowly coming to a stop. You need to adjust the curvature of the keyframes at frame 25 by using the keyframe’s tangents. Tangents are handles that change the amount of curvature influence of a point on a b-spline (Bézier spline). Selecting the keyframe in question reveals its tangents, as shown in Figure 8-18.
Figure 8-18: The tangent handles of a keyframe. The handle to the left of the keyframe is the In tangent, and the handle to the right is its Out tangent.
Figure 8-19: Zoomed into the end segment of the Rotate Z animation curve after the dip is fixed
Now, to get the axe to stop slowly as it digs into the target, you need to curve that end segment of the Rotate Z curve to flatten it out.
The curve’s final segment for Rotate Z should now look like Figure 8-20.
Figure 8-20: Zoomed into the end segment of the Rotate Z animation curve. Notice how the curve now smoothly comes to a stop by flattening out.
Figure 8-21: Smoothed translate curves to ease out the motion
Now, you need to polish things up more.
Load axe_v4.mb
from the Axe project from the book’s web page, or
continue with your own scene file. For secondary motion, you’ll move the target in
reaction to the impact from the axe’s momentum.
An object in motion has momentum. Momentum is calculated by multiplying the mass of an object by its velocity. So, the heavier and faster an object is, the more momentum it has. When two objects collide, some or all momentum transfers from one object to the other.
In the axe scene’s impact, the axe lodges in the target, and its momentum is almost fully transferred to the target. But because the target is more massive than the axe, the target moves only slightly in reaction. The more you make the target recoil, the heavier the axe will seem.
First, group the axe’s parent node under the target’s parent node by grouping the axe under the target; when you move the target to recoil, it will keep the axe lodged in it. You will use the Hypergraph instead of the Outliner, so let’s take a quick look at its interface first.
The Hypergraph: Hierarchy (referred to as just the Hypergraph in this book) displays all the objects in your scene in a graphical layout similar to a flowchart (see Figure 8-22). Select Window ⇒ Hypergraph: Hierarchy to see the relationships between objects in your scene more directly. This window will perhaps be somewhat more difficult for a novice to decipher, but it affords you great control over object interconnectivity, hierarchy, and input and output connections. The Hypergraph: Connections window is technically called the Hypergraph window, but it shows you the interconnections of attributes among nodes as opposed to the node hierarchy in the scene.
Navigating the Hypergraph is the same as navigating any Modeling window, using the familiar Alt key and mouse combinations for tracking and zooming.
Figure 8-22: The Hypergraph interface
First you need to reset the target node’s Translate and Rotate attributes to 0 and its Scale attributes to 1.
Figure 8-23: The front-panel display of the target reacting to the impact of the axe
The preceding steps should give you an animation similar to axe_v5.mb
in
the Axe project from the companion web page.
As an alternative to keyframing the position of the axe, you can animate it on a path. Path animation allows you to assign an object to move along the course of a curve, called a path.
Load axe_v6.mb
from the Axe project from the companion web page. This is
the finished axe animation, but the translation keys have been deleted, though the
rotation keys and everything else are intact. You’ll replace the translation
keyframes with a motion path instead. There is an arched curve in this scene called
pathCurve that was already created for you using the CV curve tool. Look how nice I
am to you!
axe_v06.mb
), scrub the animation
and you’ll see that the axe spins around; it and the target recoil at the moment
of impact, but the axe doesn’t actually move. There is also a curve in the scene
that represents the eventual motion of the axe.Figure 8-24: Select the Axe project’s group node.
The Follow feature orients the object on the path so that its front always points in the direction of travel. This will interfere with the axe’s motion, so you’ll leave it off. Click Apply, and now the axe will follow the line from end to end between frame 1 and frame 60. Of course, you have to adjust the timing to fit better, as with the original axe animation.
The file axe_path_v1.mb
in the Axe project
will bring you up to this point.
Figure 8-25: Set the last key to frame 25 and reshape the curve at the end.
The file axe_path_v2.mb
in the Axe project will bring you up to this
point.
Path animation is extremely useful, especially for animating an object along a particular course. By adjusting the resulting animation curve in the Graph Editor, you can easily readjust the timing of the path animation, and you can always adjust the shape of the path curve itself to change the motion of the object. A good path animation exercise is to reanimate the Solar_System exercise with paths instead of the keyframes you set on the rotations.
It’s common practice to animate a proxy object—a simple stand-in model that you later replace. The next exercise will show you how to replace the axe you already animated with a fancier NURBS model and how to copy an animation from one object to another.
Load the scene file axe_v5.mb
from the book’s web page. Now, follow
these steps:
Axe_Replace.ma
scene file from the Scenes folder of
the Axe project from the companion web page. The new axe appears at the origin
in your scene.Transferring all the properties and actions of the original axe to a new axe requires some setup. Follow these steps:
Figure 8-26: Place the pivot point on the new axe here.
Figure 8-27: The new axe placed next to the original
The file
axe_v7.mb
in the Axe project from the book’s web page has
the new axe imported and all the animation copied to get you caught up to
this point.
It’s inevitable. Sooner or later, you will need to animate a flying logo or flying text. Animating flying text—at least, the way you’ll do it here—can show you how to animate pretty much anything that has to twist, wind, and bend along a path; this technique isn’t just for text.
You’ll need to create the text, so follow these steps:
Figure 8-28: The Text Curves Options box
Figure 8-29: Create a curve path for the text to follow.
Figure 8-30: The Attach To Motion Path Options box
Depending on how you create your curve and text, you may need to experiment with the Front Axis and Up Axis attributes to get the text to fly the way you want.
Scrub your animation to check the frame range and how well the text flies through the lattice. When the lattice and its base are large enough to handle the text along all of the path’s corners and turns, voilà—Cheesy Flying Logo! (See Figure 8-34.)
Figure 8-31: The text is on the path.
Figure 8-32: The geometry doesn’t fit the lattice well. Ouch!
Figure 8-33: Scale the lattice and its base node to accommodate the flying text.
Figure 8-34: Cheesy Flying Logo! makes a nice turn.
As an exercise in animating a system of parts of a model, you’ll now animate the catapult from Chapter 4, “Beginning Polygonal Modeling.” You’ll turn its winch to bend back the catapult arm, which shoots the projectiles, and then you’ll fire and watch the arm fly up.
Let’s get acquainted with the scene file and make sure its pivots and hierarchies are
set up properly. The scene file catapult_anim_v1.mb
in the
Catapult_Anim project from the companion web page has everything in order, although
it’s always good to make sure. Figure
8-35 shows the catapult with its winch selected and ready to animate.
Get a sense of timing put down for the winch first and use that to pull back the arm to fire. Follow these steps:
Figure 8-35: The catapult’s winch is ready to animate.
Because animating a rope is a fairly advanced task, the catapult is animated without its rope; however, the principle of an imaginary rope pulling the arm down to create tension in the arm drives the animation.
Figure 8-36: Insert a keyframe at frame 42.
Figure 8-37: Creating a greater ease-out and adding a little recoil at the end
It’s time to animate the arm coiling back, using the winch’s timing as it’s driving the arm. Because the catapult’s arm is supported by a brace and the whole idea of a catapult is based on tension, you have to bend the arm back as the winch pulls it.
You’ll use a nonlinear deformer, just as you did in the axe head exercise in Chapter 5, but this time, you’ll animate the deformer to create the bending of the catapult arm. Follow these steps:
Figure 8-38: Align the Bend deformer with the catapult arm.
Figure 8-39: Orient the Bend deformer to bend the arm back and down.
Figure 8-40: Bend the arm back at frame 60 and set a keyframe.
Figure 8-41: Try to match the relative curvature of the winch’s animation curve with the Bend deformer’s animation curve.
Figure 8-42: Group the deformer node under the Arm1 group node.
Figure 8-43: The animation curve for the arm’s vibration back and forth as it comes to a rest
Figure 8-44: The animation curve for the arm’s rotation as it heaves up and falls back down, coming to an easy rest on the brace
The file catapult_anim_v2.mb
will give you a good reference to check out
the timing of the arm bend and rotation. Here are some items you can animate to make
this a complete animation:
In this chapter, you began to learn the fundamentals of animating a scene. Starting with a bouncing ball, you learned how to work in the Graph Editor to set up and adjust timing as well as how to add squash and stretch to the animation. The next exercise, throwing an axe, expanded on your experience of creating timing in the Graph Editor and showed you how to add anticipation, follow-through, and secondary motion to your scene. You then learned how to animate the axe throw using path animation. You went on to learn how to replace a proxy object that is already animated with a different finished model and how to transfer the animation. Finally, you used the catapult to animate with deformers and further your experience in the Graph Editor.
Animating a “complex” system, such as a catapult, involves creating layers of animation based on facets of the mechanics of the system’s movement. With the catapult, you tackled the individual parts separately and then worked to unify the animations. You’ll use rigging concepts in the next chapter to automate some of that process for a locomotive. The same is true of the Bouncing_Ball and Axe_Throwing exercises. The different needs of the animation were addressed one by one, starting with the gross animation and ending with finishing touches to add weight.
Animation is the art of observation, interpretation, and implementation. Learning to see how things move, deciphering why they move as they do, and then applying all that to your Maya scene is what animation is all about.