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 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 your locomotive to life.
Topics in this chapter include:
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.
Animating a bouncing ball is a good exercise in real-world physical motion as well as in cartoon movement. 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 in the ultra-fabulous Chapter 1, “Introduction to Computer Graphics and 3D.”
First, you need to create the ball, as well as the project for this exercise. Follow these steps:
To make life easier, 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, and stretching, and moving forward in space.
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 itself.
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. First, 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-Key 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.
For the Auto Keyframe feature to work, you have to set an initial keyframe manually for each of the attributes you want to animate.
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. Here's a summary of the keystrokes for setting keyframes:
Shift+W Sets a keyframe for the selection's position in all three axes at the current time
Shift+E Sets a keyframe for the selection's rotation in all three axes at the current time
Shift+R Sets a keyframe for the selection's scale in all three axes at the current time
You'll resume this exercise after a look at the Graph Editor.
To use Maya's 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. The Graph Editor gives you direct access to the curves generated by your animation, which means you have unparalleled access to editing and 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. The concept of the Graph Editor, and the process of editing animation using graph curves, may seem daunting at first, especially if you aren't mathematically inclined. However, this window is truly an animator's best friend. Using its graph view of where in space and time each keyframe lies, you can conveniently control your animation. Move a keyframe in time to the right, for example, to slow the action. Move the same keyframe to the left in time to speed up the action.
The Graph Editor is divided into two sections. The left portion, 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.
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. The ability to see a curve and translate it into what your object is doing comes with time and practice. 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. Instead of CVs on a NURBS curve controlling the curvature, points directly on an animation curve represent keyframes and 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 curve.
Second, the graph is a representation of an object attribute's position (vertical) over time (horizontal). Every place on the curve represents where the object is in that axis; there needn't be a keyframe on the curve. 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 Z 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 Z 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.
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.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.
The object in Figure 8.9 begins moving immediately and comes to a slow stop by frame 27, where the curve first becomes flat.
Now, let's apply what you've learned about the Graph Editor to the bouncing ball. Follow these steps:
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.)
To move a key in the Graph Editor, press W to open the Move tool, MMB+click, and drag the cursor in the Graph Editor window. Press the Shift key, and drag the cursor left and right or up and down to lock the movement to either horizontal or vertical to make it easier to control.
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. The more you animate, the better your timing will be, which is why the bouncing ball is such a popular exercise.
Download the file ball_v01.mb from the Bouncing_Ball project on the companion web page, www.sybex.com/go/intromaya2012, to get to this point.
When you play back the animation, it should look more natural. But it still looks fake, as if it's rising and falling on a wave as opposed to really bouncing. You need to edit the timing of the ball. 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.
Because of the smooth animation curve, the ball doesn't look natural in its timing. 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:
The concept of squash and stretch has been an animation staple for as long as there has been animation. 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.
In Maya, you use the Scale tool to squash and stretch your object—in this case, your ball, using only the scale node, not the sphere or translate node.
Download the file ball_v02.mb from the Bouncing_Ball project on the book's web page, and follow these steps:
Download the file ball_v03.mb from the Bouncing_Ball project on the book's web page to get to this point. And now, let's rotate the ball as it bounces.
Let's add some roll to the ball in these steps:
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 how the ball bounces and rolls. For example, it could continue rolling with no bouncing for another 20 frames or so.
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.
To begin the animation right away, you'll create a basic axe, focusing on the animation and the technique. You'll also need to create a simple bull's-eye target at which to throw your axe, so look for some references for a target as well.
Create a new project; choose File Project New. Place this project in the same folder or drive as your other projects, and call it Axe. Click the Use Defaults button to fill in the rest, and click Accept. Click the Animation Preferences button, and set the frames per second to 30fps. Later, you'll replace this simple axe with a finer axe model to learn how to replace objects and transfer animation.
To get started, model the axe and target from primitives, and set up their grouping and pivots. When your scene is set up properly, you'll animate. It's important to a healthy workflow that you make sure the scene is set up well before you begin animating.
The axe will be made of two polygon primitives: a cylinder and a cube. Follow these steps:
Most animation work doesn't depend on precise measurements. The key is using proportions and relative sizes. You can almost always use Maya's generic units (which are set to centimeters by default). The scope of your project will determine if greater precision is necessary.
Identifying the center of balance for this axe will give you the pivot point. Because the heaviest part of this axe is the head, the center of balance is toward the top and forward of the handle.
Your scene should now look like the file axe_v1.mb in the Scenes folder of the Axe project from the companion web page.
Move the axe about 40 units in the negative X-axis away from the origin to make some room for the throw, and move it about 15 units up in the Y-axis. Now, you need to create a simple target for your axe to hit. Follow these steps:
You also need to create a simple stand on which to rest the target. Follow these steps:
You place the pivot point at that location because the target will jerk up and back a little bit when the axe hits it. This is the best point for you to rotate around to lift the front of the base up a little to make it look like the axe is really hitting it. Save your file as your next version number. The scene is now ready for animation.
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, albeit subliminal, impression on you. As it pertains to animation, that essence is simply called weight, and its observation is called motion study.
Unfortunately, merely knowing how something should look while moving isn't all you need to animate it properly. Giving the axe believable weight is your primary job as an animator. Motion can make or break an animation.
A good feeling of weight in animation depends on timing and follow-through, which require practice.
It's a good idea first to try out 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. Now put the cap on the pen, lob it again, and notice the subtle yet instrumental differences in motion caused by the cap's mass.
As an animator, this experimentation is part of your preproduction and motion study. It's important to have as thorough an understanding of your subject matter as possible. 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. This is good information to know, because it will shape your animation and come in handy if you're ever cornered in a hatchet shop.
The next step is to keyframe the positions of the axe, starting with the gross animation—that is, the movement from one end of the axe's trajectory to the other.
You can start in your current scene or load the unanimated, premade axe and target from the companion web page (axe_v2.mb in the Scenes folder of the Axe project). Follow these steps:
As you'll see later, in this chapter's catapult exercise, you can use selection handles to select the children of a group as well as the top node.
Because this node is the parent node of the axe, the selection handle displays as a hollow cross at the node's current pivot point.
You can turn on selection handles for practically any object in Maya—no matter where it is in a group's hierarchy—whether it's a child or a parent. If it isn't the top node, the selection handle appears as a regular cross ().
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 only moved the axe back in the X-axis and made the rotation on the Z-axis, Auto Keyframe sets keyframes only for Translate X and Rotate Z. The other position and rotation axes aren't keyframed because their values didn't change.
Auto Keyframe inserts a keyframe at the current time for the selected object's changed attributes only.
Notice that you have to move the axe in the X- and Y- axes, whereas before you only had to move it back in the X-axis to create anticipation. This is because the axis of motion for the axe rotates along with the axe. This is called 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_v3.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.
This is because of the Auto Keyframe feature. At frame 1, you set an initial keyframe for all 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).
TROUBLESHOOTING AND AGGRAVATION
Why should you intentionally go through steps that create a problem, such as the axe's movement back? Understanding how to troubleshoot is the biggest challenge in learning a CG program. A good CG artist needs to know how to diagnose issues with their scene and be able to find a way to fix them. Your first forays into CG may be highly frustrating—riddled with simple troubles and issues that you just don't understand. When you can't figure out why things went wrong, you may turn red with aggravation and want to walk away. This is where you start molding yourself as a CG artist. Instead of giving up, ponder the steps you've taken, and see if you can spot where your CG has taken a weird turn. You'll probably find yourself in such spots several times as you study this book. Instead of throwing the baby out with the bathwater, stay patient and try, try again. You'll learn more from your mistakes and missteps in the exercises in this book than you will if you follow everything to the letter.
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. As you saw in the Bouncing_Ball project, using the Graph Editor is crucial, and the more practice you get with it, the better.
When you open the Graph Editor for this scene, 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.20.
The curves in the Graph Editor represent the values of the axe's position and rotation at any given time. The three 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.
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, with all their values in check. Click the Enable Normalized Curve Display icon in the top icon bar of the Graph Editor (). Doing so normalizes the view of all the curves within a scale of −1 to 1 to allow you to see the relative movement of all the curves at once.
Figure 8.21 shows the Graph Editor from Figure 8.19 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 (). Normalizing your view is particularly helpful in busy scenes when you want to adjust the smallest scale of values alongside the largest scale of values without having to zoom in and out of the Graph Editor constantly to see the appropriate curves.
Notice that the Scale attributes on the axe aren't shown in this window; only animated attributes appear here.
Also 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 as 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 as it did before. You might have prevented this problem by manually setting your keyframes for the axe instead of using Auto Keyframe. The more you work with Maya, the more valuable you'll find Auto Keyframe (although plenty of people get by without it just fine).
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.
If you hold down Shift as you MMB+click and drag the keyframe to move it in the Graph Editor, the keyframe will move in only one axis (up or down, left or right).
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, as long as the options in the Animation Preferences window are set to play back properly at 30fps. Even at 30fps, the scene should play back slowly, and this means the animation of the axe timing is too slow.
Changing the playback speed of an animation through the Animation Preferences window doesn't alter the timing of your animation. It only changes the speed at which Maya plays the animation back to you in its windows. To change the playback speed, choose Window Setting/Preferences Preferences to open the Preferences window, choose Settings Working Units, and select the proper setting.
Load the axe_v4.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. 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.
When you set keyframes, you create animation curves in the Graph Editor for the axe. These curves are Bézier splines, which 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.22, to keep the whole curve as smooth as possible.
SECONDARY MOTION AND FOLLOW-THROUGH
Secondary motion in animation comprises all the little things in a scene that move because something else in the scene is moving. For example, when a superhero jumps from a tall building and his or her cape flutters in the wind, the cape's undulation is secondary motion.
Follow-through is the action in animation that immediately follows an object's or a character's main action. For example, after the superhero lands from their jump, his or her knees buckle a little, and the superhero bends at the waist, essentially squashing down a bit. That squashing motion is follow-through. The more follow-throughs, the more cartoon-like the animation appears.
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.23.
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.25.
Now, you need to polish things up more.
Load axe_v5.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 much 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. The axe will be left behind to float in midair if you animate the target's parent node without grouping the axe under it. By grouping the axe under the target, you'll move the target to recoil while keeping the axe lodged in it. The animation on the axe won't change when you group the axe and target under a new node. We 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.27). 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.
First you need to set the target node's Translate and Rotate attributes back to 0 and its Scale attributes back to 1:
If you don't freeze the transforms on the target's parent node before grouping the axe under it, the axe's animation will change and yield undesirable results.
The preceding steps should give you an animation similar to axe_v6.mb in the Axe project from the companion web page.
You can see a moving object's trajectory, or motion trail—that is, its path of motion. Follow these steps:
The motion trail is useful for fine-tuning motion. Editing the animation curves in the Graph Editor and watching the motion trail adjust in the work panels shows you the precise trajectory of the axe throughout its movement. Play back your animation a few times to get a good sense of how the scene looks.
Notice that the axe seems a little more solid than before. The extra height in the trajectory helps give the axe more substance. Figure 8.30 shows the axe and its motion trail after more height is added to its arc.
You can toggle the frame-number display on/off and change the display type of the motion trail from curve to points or locators through the motion trail's Attribute Editor. To get rid of the motion trail, select it and press Delete.
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_v7.mb from the Axe project from the companion web page. This is the finished axe animation. You'll delete most of your hard work by removing the translation animation on the axe, but you'll keep the rotation and everything else. You'll replace the translation keyframes you set up with a motion path instead. Follow these steps:
The Follow feature orients the object on the path so that its front always points in the direction of travel. Because the axe moves backward in anticipation before it's thrown forward, Follow would cause it to turn around twice, so turn this option off.
Now the axe will follow the curve end to end from frame 1 to frame 60. Of course, you have to adjust the timing to fit it, as before.
The file axe_path_v1.mb in the Axe project will bring you up to this point.
The file axe_path_v2.mb in the Axe project will bring you up to this point.
Path animation is extremely useful for a number of tasks, but especially for animating an object along a particular course. By adjusting the resulting animation curve in the Graph Editor, you can readjust the timing of the path animation easily.
A good path-animation exercise is to reanimate the Solar_System exercise with paths instead of the keyframes you set on the rotations.
GHOSTING
To see the position of an animated object a few frames before and after its current position, you can enable ghosting in Maya. For example, select the animated axe in your scene and, in the Animation menu set, choose Animate Ghost Selected. Maya will display the axe's three frames before and after the current time. To turn off ghosting, choose Animate Unghost Selected.
In the Axe example, you furthered your use of layered animation by beginning with the gross animation to cover the basic movements of the axe. After those timings were set, you completed most of the remaining work in the Graph Editor by moving keyframes here and there to add detail to the motion. You added more keyframes to create follow-through and secondary movement to insinuate weight into the axe and target.
Without secondary movement in the target, the axe would seem to weigh nothing. With too much movement, however, the axe would seem too heavy, and the scene wouldn't look right. Subtle nuances can make stunning differences in the simplest of animations. You also went back into the animation and replaced the animation method entirely with path animation. This illustrates the multiple ways to accomplish a task in Maya; finding your own comfort zone with a workflow is one of the goals in learning Maya.
Aside from the need to model objects and texture them, there is the task of animation setup. Check your pivots, your geometry, and your grouping to make sure your scene will hold up when you animate it.
It's also common practice in setup 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 the fully textured NURBS axe from the previous chapter and how to copy an animation from one object to another.
Load your completed, keyframed axe-animation scene (not the one using path animation), or switch to the Axe project and load the scene file axe_v7.mb from the book's web page. Now, follow these steps:
Assuming all the properties and actions of the original axe requires some setup. Follow these steps:
When you copy and paste curves in the Graph Editor, make sure you're on the first frame of the animation. Pasting curves places them at the current frame. Because the animation of the original axe started at frame 1, make sure you're at frame 1 when you paste the curves to the new axe.
Scrub the animation, and notice that the new axe has the same animation except at the end when it hits the target. It doesn't have the same follow-through as the original axe. Remember that you grouped the original axe under the target node for follow-through animation. Place the new axe under this node as well.
The file axe_v8.mb in the Axe project from the book's web page has the new axe imported and all the animation copied. It will get you caught up to this point.
It's inevitable. Sooner or later, someone will ask you to animate a flying logo or flying text for something or other. As late-1980s as that may sound, animating flying text—at least, the way you'll do it here—can teach you a thing or two about path animation and lattice deformers. You can use the following steps to animate pretty much anything that has to twist, wind, and bend along a path; this technique isn't just for text.
First, you'll need to create the text. To do so, follow these steps:
Setting the Type attribute to Poly for your text creates curve outlines for the text and planar faces for the letters, for a flat-text effect. Setting the Type Creation option to Curves gives you just the curve outlines. Finally, using Trim to create your text makes the letters out of flat planar NURBS surfaces. However, no surface history is created with text. To allow you to edit the text later, you must re-create the text and/or font type as needed.
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. Notice that history is created with the path animation, so you can adjust the axes' attributes after the fact to see how they work on the curve you have.
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.42.)
In this section, you'll return to the locomotive you modeled in Chapter 4, “Beginning Polygonal Modeling,” and put your new animation skills to use.
Download the file locomotive_model_v4.mb from the book's web page, which is the completed model of the locomotive from the Polygon Modeling exercise in Chapter 4. You can find it in the Scenes folder of the Locomotive project from the book's web page.
It's important to keep animation in mind as you build a model; hierarchy is crucial to getting a smooth animation workflow going. Now you're going back in to the locomotive from Chapter 4 to make sure you have good organization before beginning the task of rigging this thing for animation.
Figure 8.43 shows the organization of the locomotive as it stands from Chapter 4. Later, you'll use a more finely detailed and prettier locomotive model to rig that is already grouped properly, using the intentions outlined here. You have to identify the parts of the locomotive that you need to rig, determine how they will move, and decide what is the best hierarchy for the model from there.
The major moving parts of the engine are the wheels and the steam pump drive mechanism. The wheels, of course, need to rotate, as wheels do, and the steam pump drives the wheel arms back and forth, which is what drives the main wheels to rotate. Aside from animating some steam pumping out of parts of the engine, which we'll cover in Chapter 12, “Maya Dynamics and Effects,” this is the basic rigging for the locomotive. First, you need to make sure the hierarchies are settled well and the pivot points are in their proper places.
The locomotive_model_v4.mb scene file has a well-organized hierarchy, but it needs some help to make rigging easier. Be sure all the individual wheel arms have their pivots at the base, as shown in Figure 8.44. Use Insert (or the Home key on a Mac—MacBook users also need to press the fn [function] key to access the Home function using the arrow key) to move the pivots as needed. You'll rig these wheel arms using inverse kinematics (IK) bones in the next chapter.
Be sure all the elements that make up a wheel are grouped and that the group's pivot point is centered for all the wheel groups, as shown in Figure 8.45.
Finally, for this simple rig, make sure the steam pump arm elements are properly grouped and that the pivot is placed as shown in Figure 8.46.
If your locomotive is in organizational disarray, identify all the moving parts first, and then begin grouping them logically. Place pivots appropriately, and you're all set. The scene file locomotive_anim_v1.mb in the Locomotive project from the companion web page has the locomotive scene file with the pivots and grouping already finished, as discussed earlier.
If the pivots and groupings are off, you'll notice as soon as you begin to animate; things just won't rotate on the correct axis, and pieces won't follow properly. The wheels, for example, may wobble around their axle.
For more practice in grouping and hierarchies, you can load locomotive_anim_v1.mb from the web page, ungroup everything in the scene, and piece it all back together. To ungroup everything, select the top node of the locomotive, and choose Edit Ungroup. Doing so ungroups the major parts of the locomotive. With those groups selected, ungroup again to flush out individual geometry. You can also load locomotive_anim_v1_B.mb from the web page; it has all the major groupings removed. Then, regroup and repivot everything. This will be great practice and boatloads of fun!
Using selection handles makes selection easier and work flow faster, so turn on selection handles for each of the groups you're animating. Select the wheel groups in the Outliner, and then choose Display Transform Display Selection Handles. Select the wheel arm groups, and turn on their selection handles as well. Figure 8.47 shows the selection handles enabled for the wheel, pump arm, and wheel arm.
How selection handles work depends on Maya's selection order. Selection order, which you can customize, sets the priority of one type of object over another when you try to select in a work window. After the selection handles for the locomotive's wheels and drive arms are turned on, only the handles will be selected (and not the whole locomotive) when you make a marquee selection that covers the entire locomotive. Handles have a high selection priority by default, so they're selected above anything else.
Animating most of the locomotive is straightforward. Simple rotations will make the wheels turn. Translating the locomotive's top node will move the entire object. This, however, leaves out the drive mechanism with the steam pump and the wheel and pump arms. You'll rig these to animate automatically in the next chapter, using IK handles and connections.
As an exercise in animating a system of parts of a model, before you continue to animate the locomotive in the next chapter, you'll now animate a catapult. 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.
First, 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.48 shows the catapult with its winch selected and ready to animate.
Get a timing put down for the winch first, and use that to pull back the arm to fire. Follow these steps:
Obviously, you're missing the rope between the winch and the arm. Because animating a rope is a fairly advanced task, the catapult is animated without its rope; but the principle of an imaginary rope pulling the arm down to create tension in the arm drives the animation.
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, “Modeling with NURBS, Subdivisions, and Deformers”—but this time, you'll animate the deformer to create the bending of the catapult arm. Follow these steps:
The Low Bound and High Bound attributes control how far up and down the deformer the object is affected. The Envelope attribute for a deformer governs how much the object is affected overall, with 0 not affecting the geometry at all.
The file catapult_anim_v2.mb will give you a good reference to check out the timing of the arm bend and rotation.
Without getting into a lot more detail, try your hand at animating the catapult on your own. 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, showed you how to set up a scene for animation, expanded on your experience in 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 adjust animation using motion trails and 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. Going back to the locomotive from Chapter 4, you began to set up the scene for rigging in the next chapter by setting proper pivots and hierarchy. Finally, you used a catapult to animate with deformers and further your experience in the Graph Editor.
Animating a complex system, such as a catapult or a locomotive, 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 the 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. Finally, the art of timing brought the entire effort into a cohesive whole.
Even when animation is already applied, it's simple to change how the animation is accomplished, as you did with path animation, or even to replace the animated object entirely.
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.