Now that you have a little more animation experience, you can get into some more involved animation practices and toolsets, exploring the principles covered in this book and its examples. Animation is a long journey, and you should use this book as a stepping-off point. For everything you’re being exposed to here, there are many more techniques to discover.
In your body, your muscles move the bones of your skeleton, and as your bones move, parts of your body move. In CG animation, a skeleton is an armature built into a 3D model that drives the geometry when the bones are moved. You insert a skeleton into a CG model and attach or bind it to the geometry. The skeleton’s bones are animated, which in turn move the parts of the geometry to which they’re attached. By using a skeleton, the Autodesk® Maya® software allows bending and deformation of the attached geometry at the skeleton’s joints. A skeleton is useful for character work, but skeletons have many other uses. Any time you need to drive the geometry of a model with an internal system, such as a fly-fishing line or a tree bending in the wind, you can use skeletons. You’ll use skeletons to drive locomotive wheels and a simple character later in this chapter.
Skeletons rely on hierarchies (see Figure 9-1). Bones are created in a hierarchical manner, resulting in a root joint that is the parent of all the joints beneath it in the hierarchy. For example, a hip joint can be the root joint of a leg skeleton system in which the knee joint is the leg’s child, the ankle joint belongs to the knee, and the five toe joints are the ankle’s children.
Geometry need not deform to be attached to a bone system; objects can be grouped with or under joints. They move under their parent joint and rotate around that joint’s pivot as opposed to their own pivot point.
A skeleton is really just a collection of grouped and properly positioned pivot points called joints that you use to move your geometry. A bone is the length between each joint; bones show you only the skeletal system.
Inverse kinematics (IK) and forward kinematics (FK) are the methods you use to animate a skeletal system. FK rotates the bones directly at their top joint to assume poses. This method resembles stop-motion animation, in which a puppet, along with its underlying armature, is posed frame by frame. With FK, the animator moves the character into position by rotating the joints that run the geometry.
The rotation of a joint affects the position of the bones and joints beneath it in the hierarchy (see Figure 9-2). If you rotate the hip up, the knee and ankle swing up as if the character is kicking.
IK uses a more complex, but often easier, system of IK handles that are attached to the tip of a joint system. The corresponding base of the IK system is attached farther up the skeleton hierarchy to a joint determined to be the root of that IK segment. It need not be the root joint of the entire skeleton, though.
The bones and joints in the IK chain are affected only by movement of the IK handle. When the handle moves, an IK solver figures out how to rotate all the joints to accommodate the new position of the IK handle.
The effect is as if someone grabbed your hand and moved it. The person holding your hand is similar to an IK handle. Moving your hand causes the bones in your arm to rotate around the shoulder, elbow, and wrist. As you can see in Figure 9-3, the animation flows up the hierarchy and is therefore called inverse kinematics.
To understand skeletal hierarchy, look at Figure 9-4, which shows a simple biped (two-legged) character made of primitive blocks. He’s called the Block Man. (Surprise!) Each block represents part of the body, with gaps between the blocks representing points where the body pivots.
The pivot of each block is placed to represent the appropriate joint location. For example, the shin’s pivot is located at the knee. Each block is grouped up the chain so that the foot moves with the shin, which moves with the thigh, which moves with the pelvis.
The hands are grouped under the arms, which are grouped under the shoulders, and so forth, down the spine to the pelvis. The head groups under the first neck block and so on down the spine to the pelvis. The pelvis is the center of the body, which is known as the root of the figure.
The way this figure is grouped (see Figure 9-5) represents how the hierarchy of a character works for the most part. Each body part is attached and becomes the child of the part above it in the chain.
Load the file block_man_v02.ma
from the Block_Man project folder on the
book’s web page, www.sybex.com/go/introducingmaya2015, for a good reference of the grouping
structure. This file shows you what a skeleton hierarchy does.
In the Hypergraph Hierarchy window, choose Options ⇒ Layout ⇒ Freeform Layout to position the nodes any way you want. To make selections easier, you can arrange the nodes as if they were on a body (see Figure 9-6). You can toggle between freeform and automatic, and your freeform layout will be retained.
The basis of how the Block Man is laid out and grouped is what skeletons are all about. Skeletons make character animation easier by automating, at the very least, the hierarchy and pivot placement described earlier.
You’ll use the Block Man to create a simple skeleton. Load
block_man_v01.ma
from the Block_Man project. This is the same as
block_man_v02.ma
, but this version isn’t grouped.
By pressing Shift as you click, you create a joint in a straight line from the last joint placement. A bone is created between the two joints as a visual guide to the skeleton. The placement of the joints depends on the active view.
You’re all done! You’ll
be adding to this later in the chapter as you create a more well-rounded rig for the
character, but for now, check your work against Figure
9-12 (right) and the block_man_skeleton_v01.ma
file from the
Block_Man project.
You now have a full skeleton for your character. To attach the geometry, all you need to do is parent the body parts under their appropriate joints. Before you get to that, take a few minutes and make sure all your joints are named in the Outliner to make the scene easier to manage. You can use Figure 9-13 as a naming reference.
You can also load the block_man_skeleton_v01.ma
file from the Block_Man
project to get to this point.
To parent the Block Man’s geometry to the skeleton, follow these steps:
The Block Man is now set up with a skeleton that you’ll use to make a simple walk cycle. This exercise will help get you more familiar and comfortable with animating a character. You will do more to this setup to make a better animation rig for the Block Man character later in the chapter.
A walk cycle is an animation that takes the character through a few steps that can be repeated many times so that the character seems to be taking numerous steps. In a cycle, make sure the position of the first frame matches the position of the last frame so that when the animation sequence is cycled, no “pop” occurs in the motion at that point.
Now, try animating this character’s walk cycle using FK on the skeleton. You’ll find the workflow straightforward, as if you were adjusting positions on a doll.
Load the block_man_skeleton_v02.ma
file from the Block_Man project from
the companion web page for the properly grouped and bound model and skeleton. In
this file, the right arm and leg have drawing overrides enabled: This makes their
wireframe display white to make it easier to distinguish between the right and left
sides while working.
Use the key poses in the following figures to guide you in animating the body as it walks. You’ll key at five-frame intervals to lay down the gross animation. You can go back and adjust the timing of the joint rotations in the Graph Editor to make the animation better later. The white leg and arm are behind the body, farther from the camera.
This animation is also called pose animation because you’re posing the character from keyframe to keyframe.
Figure 9-16 shows the character’s starting position. Here, you’ll set a key for this position and then begin the walk cycle by moving the joints into their second position and keyframing that.
If you don’t key everything every step of the way, some parts of the body won’t key with Auto Keyframe properly because the last time they moved may have been two steps previous. This may cause confusion, so it’s best to key every joint at every step until you feel more comfortable editing character animation.
Figure 9-18 shows the position you’ll keyframe at frame 10; it’s approximately midstride for the first leg.
Figure 9-19 shows the position you’ll keyframe at frame 15. At this point, the character begins to shift his weight to the front leg as it plants on the ground, and the character also begins lifting the back leg.
At frame 20, the man will shift all his weight onto the front leg and move his body over that leg, lifting his rear leg to begin its swing out front to finish the stride. Figure 9-20 shows the pose.
Follow these steps:
Now, the man will swing his whole body forward, pivoting on the left leg (the dark one) to put himself off center and ready to fall forward into the next step. Figure 9-21 shows the pose.
Here are the steps:
Use Figure 9-22 as a guide for creating the next pose. Notice that it’s similar to the pose at frame 10. As a matter of fact, the only major differences are which leg and arm are in front. Everything else should be about the same. You’ll want some variety in the exact positions to make the animation more interesting, but the poses are very similar.
You’ve finished a set of poses for the character’s first step. You animated the left leg taking a step forward in the first series of poses. The next series of poses has to do with the right leg. The pose at frame 35 corresponds to the pose at frame 15. Frame 40 matches frame 20. You will copy keyframes in the Graph Editor to make more steps, but first let’s retime these initial keys before continuing.
When a 30-frame section is complete, you need to return to the animation through the Graph Editor. Adjust all the keyframes that you initially set at these five-frame intervals to make the animation more realistic. Right now, you have only the gross keyframes in place, so the timing is off. Timing the frames properly is ultimately a matter of how the animation looks to you.
Logistically speaking, some poses take a little less time to achieve than the evenly spaced five frames you used. For example, achieving the second pose from the start position should take four frames. The third pose (see Figure 9-18, earlier in the chapter) from frame 5 to frame 10 should take four frames. The next frame section, originally from frame 10 to 15 (the fourth pose; see Figure 9-19, earlier in the chapter), should take only three frames. To accomplish this easily, follow these steps:
Load the file block_walk_v01.mov
or block_walk_v01.avi
of
this walk cycle from the Images folder of the Block_Man project on the companion web
page to see the animation in motion. It’s a rough cycle, and you have to keep
adjusting the character’s height to keep the feet on the ground. This is where IK
comes in handy, as you’ll see later in this chapter. Also, the file
block_man_skeleton_walk_v01.ma
in the Block_Man project has the
keyframed steps for you to play with and continue animating.
Now that you have a base to work with, you’ll copy and paste keyframes to extend the
animation. This can get a little tricky, so take this slow if you’re not comfortable
with the Graph Editor yet. Open the file block_man_skeleton_walk_v01.ma
to follow along with these steps:
rt_hip
joint.Open the file block_man_skeleton_walk_v02.ma
from the Block_Man project
to check your work to this point.
This walk cycle animation is more about getting comfortable with keyframing and skeletons than it is about creating great walk animation, so take some time to practice and get better. Character animation takes a lot of time and patience, and I encourage you to keep tweaking this animation and even create different walks of your own. Animating walk cycles is a good way to hone your skills. Several great books are devoted to character rigging and animation alone, and you can research the field for ways to become more proficient. But keep in mind that movement and timing are what make animation good, not the setup or the model.
For another foray into a skeletal system, you can give yourself a hand—literally. You’ll use a skeleton to deform the geometry and animate it as a hand would move.
Load the file poly_hand_skeleton_v01.ma
from the Poly_Hand_Anim project
from the companion web page. The hand is shown in Figure 9-26 (top).
You’ll use it to create a bone structure to make the hand animate. This process is called rigging.
To create the first bones of the hand, follow these steps:
Repeat this procedure to place joints for the remaining fingers, as shown in Figure 9-27. With these joints placed, you have a simple skeleton rig for the hand. This rig allows you quite a bit of hand and finger movement.
Check the other views (see Figure 9-28) to see where you need to tweak your joint positions to fit the hand. Ideally, you want the joints to be set inside your intended geometry in the same way that real bones are laid out.
To position the joints, you can use either of two Maya tools: Move or Move Pivot. First you’ll try the Move tool. Select the tip joint for the pinkie. It needs to be lowered into the pinkie itself. Select the Move tool (press W), and move it down into the tip of the pinkie. Now, move on to the top pinkie knuckle. Notice that if you move the knuckle, the tip moves as well. That’s not such a great idea.
Instead, it’s best to move joints as pivots. Because joints are nothing more than pivots, go into Move Pivot mode (hold down the D key to activate Move Pivot, or press the Ins key on Windows or the fn+Home key on a Mac) to move joints. Select the top pinkie-knuckle joint, and move it with Move Pivot instead. Only the joint moves, and the bones adjust to the new position. Set the positions on the remaining joints to be inside the hand properly, as shown in Figure 9-29 and Figure 9-30.
An integral part of rigging a character or an object with a skeleton is binding, also known as skinning. Binding is another way to attach geometry to a skeletal system. With the Block Man, you directly attached the whole pieces of geometry to the bones through parenting, whereas binding involves attaching clusters, or groups of vertices or CVs, of the geometry to the skeleton to allow the skeleton to deform the model. This is typically how skeletons are used in character animation work. (For more on grouping and parenting, refer to the solar system exercise in Chapter 2, “Jumping into Basic Animation Headfirst.”)
The basic technique of binding a character is easy. However, Maya gives you tremendous control over how your geometry deforms.
Binding is, in theory, identical to the Lattice deformer you saw in Chapter 5, “Modeling with NURBS Surfaces and Deformers.” A lattice attached to an object exerts influence over parts of the model according to the sections of the lattice. Each section affects the CVs of a NURBS surface or the vertices of a polygon surface within its borders—and as a section of the lattice moves, it takes those points of the model with it.
Skeletal binding does much the same thing. It attaches the model’s points to the bones, and as the bones pivot around their joints, the section of the model that is attached follows.
By attaching vertices or CVs (depending on your geometry) to a skeleton, you can bend or distort the geometry. When a bone moves or rotates about its joint, it pulls with it the points that are attached to it. The geometry then deforms to fit the new configuration of the bones bound to it.
You can bind geometry to a skeleton in two ways: using Smooth Bind or Interactive Bind. Figure 9-31 shows a cylinder with a smooth bind. An interactive skin bind will yield similar results to the smooth bind. The only real difference between the two methods is the editing capabilities once you have bound the skin. We’ll take a look at these differences later in the chapter.
With a Smooth Bind, we have two common binding methods that we’ll compare here, using Closest Distance and Heat Map. Create a polygon cylinder, with Height Divisions of 16. The more spans you have in the deformable model, the better it will bend. Scale the cylinder in Y to a scale of 5 to make it tall. Duplicate the cylinder, and move it over in your window in the X-Axis. Now, in the front view, create a four-bone (five-joint) skeleton that starts at the bottom of the first cylinder and goes straight up the middle, ending at the tip. Duplicate the skeleton, and move it to the center of the second cylinder (Figure 9-32).
To create a smooth bind, select the root of the first skeleton and its cylinder and choose Skin ⇒ Smooth Bind .
In the option box, you’ll find the Bind To parameter at the top set to the default of Joint Hierarchy (set it to Joint Hierarchy if it is different). You’ll also find, under the Bind Method drop-down menu, the options Closest Distance, Closest In Hierarchy, Heat Map, and Geodesic Voxel. Closest Distance disregards a joint’s position in the hierarchy of the skeleton and assigns influences according to how far the point is from the joint. The Heat Map method uses a “heat diffusion” technique to create influence falloff radiating out from the joint, and is arguably the most commonly used for character work as it assigns skin weights best suited for character movement, giving you creases at bending areas that are more believable than with the Closest Distance method.
Max Influences sets a limit on how many joints can affect a single point. Dropoff Rate determines how a joint’s influence diminishes on points farther from it. For example, with Smooth Bind, one shoulder joint can influence, to varying degrees, points stretching down the arm and into the chest and belly. By limiting these two parameters, you can control how much of your model is pulled along by a particular joint.
Set Bind Method to Heat Map and click Bind Skin in the option box to smooth-bind your first cylinder to the bones using Closest Distance (the default).
Now select the root of the second skeleton and the second cylinder and choose Skin ⇒ Smooth Bind . This time, set the Bind Method to Heat Map.
Bend both cylinders to get a feel for how each creases at the bending joints. Figure 9-33 shows the difference. The Heat Map binding on the right shows more defined creases at the joints, much like fingers, while the Closest Distance binding on the left creates a smoother arc over the entire cylinder.
Interactive Skin Bind is practically the same as Smooth Bind and yields similar results to the smooth binding using Closest Distance shown in Figure 9-33, but the editing of the influences is slightly different than for Smooth Bind. You will explore Interactive Skin Bind with the hand model later in this chapter.
If you want to do away with your binding, select the skeleton and its geometry, and choose Skin ⇒ Detach Skin. The model will snap to the shape it had before the bind was applied and the joints were rotated. It’s common to bind and detach skeletons several times on the same model as you try to figure out the exact configuration that works best for you and your animation.
If you need to go back to the initial position of the skeleton at the point of binding it to the model, you can automatically set the skeleton back to the bind pose after any rotations have been applied to any of its joints. Simply select the skeleton and choose Skin ⇒ Go To Bind Pose to snap the skeleton and model into the position they were when you bound them together. It’s also best to set your skeleton to the bind pose whenever you edit your binding weights.
Try skinning the hand with a Smooth Bind.
Load your own hand or the poly_hand_skeleton_v02.ma
file from the
Poly_Hand_Anim project from the web page. You can also access a video tutorial to
help you with this exercise from the book’s website. Now, follow these steps to
smooth-bind the hand:
You usually edit a smooth bind by painting skin weights. Because points on the model are influenced by multiple joints in a smooth bind, you need to adjust just how much influence is exerted by these joints on the same points.
joint9
, the index finger’s top knuckle, and make
sure the Paint Operation button under the Influence section is set to Replace.
Change the Value slider to 0. In the Stroke section, Radius(U) and Radius(L)
govern the size of your brush. In the Influence section, make sure the Opacity
slider is set to 1.
joint9
), as shown in Figure 9-37.
You can exit the Paint Skin Weights tool by selecting another tool (press W for Translate, for example), and your view will return to regular Shaded mode. Try bending the rest of the fingers and painting their influences; then, animate the hand, making gestures or grabbing an object using FK animation to set keys on the rotations.
The scene poly_hand_skeleton_v03.ma
from the Poly_Hand_Anim project from
the companion web page has the hand smooth-bound with painted weights on just the
index finger for your reference. Try painting the other knuckles as needed for your
animation.
Now let’s try the same exercise using a Heat Map binding method instead of Closest Distance.
Load your own hand model before it was bound or the
poly_hand_skeleton_v02.ma
file from the Poly_Hand_Anim project from
the web page. Now, follow these steps to smooth-bind the hand with the Heat Map
method to compare to the previous method we tried:
joint9
selected).The Heat Map method
gives you cleaner creases and bends at the knuckles, where Closest Point was a bit
more soft, often deforming parts of the hand that shouldn’t be affected much by a
bending finger. There’s still some painting to be done to make the fingers bend
perfectly even when using the Heat Map method. The
poly_hand_skeleton_v04.ma
file from the Poly_Hand_Anim project has
the hand with the index finger with painted weights as a reference for you.
Now, try skinning the hand with Interactive Bind.
Load your own hand or the poly_hand_skeleton_v02.ma
file from the
Poly_Hand_Anim project from the web page.
The Interactive Bind method is a bit easier to control when compared to the painting of the Smooth Bind weights.
joint9
). Figure 9-42 shows the influence. Select the red
circle at the end of the Volume manipulator and size it down to reduce the
influence on the middle finger, as shown in Figure 9-43.
Editing the interactive skin bind, as you can see, is easy using the Volume manipulators. If you exited the tool when you first created the bind and no longer see the Volume manipulators, you can access them by choosing Skin ⇒ Interactive Skin Bind Tool. When you access this tool, the Volume manipulators appear again, and you’re able to adjust your skin’s influences.
When you are happy with the proper level of influence, keep picking the other joints in the index finger to make sure your binding is proper. Then continue to the other fingers to set up the binding on the hand properly. This is easier than painting weights as before, though not as controllable. Test the bind by bending the joints. This is just a more interactive way to bind a mesh than Smooth Bind, and may be more or less effective depending on the model you are binding. It does, however, use the Closest Distance method by default, and Heat Map method is not available for the Interactive Bind. You can, however, paint skin weights when you use Interactive Bind, just as you did with the Smooth Bind.
In the case of this hand and skeleton setup, the most effective binding has been using a Smooth Bind with the Heat Map method, with some subsequent skin weight painting.
With IK, you have tools that let you plant a foot where it needs to be so you’re not always moving the skeleton or model to compensate and keep the heel in place.
For legs, IK is nothing short of a blessing. There is no clearly preferable workflow to suggest when dealing with rigging arms and hands, however. Many people use IK on hands as well, but it can be better to animate the legs with IK and animate every other part of the body with FK. IK is best used when parts of the body (such as the feet) need to be planted at times. Planting the hands isn’t necessary for a walk cycle, and having IK handles on the arms may create additional work while you are animating them. You will create a more well-rounded character rig that uses IK and easy-to-use character controls at the end of the chapter. First, let’s get familiar with how IK works.
Back to the Block Man. Switch to that project and load your version or the
block_man_skeleton_v02.ma
file from the Block_Man project from the
companion web page.
You’ll create an IK chain from the hip to the ankle on each foot. Creating the IK from the hip to the toe won’t work.
Because IK automatically bends the joints in its chain according to where its end effector, or IK handle, is located, it has to choose which way to bend at a particular joint. This is why you created the legs slightly bent in the Block Man rig earlier in the chapter.
If you did not do this or your setup has straight legs for whatever reason, select the two knee joints and, in Pivot mode (hold down the D key), move the knees forward a bit over the feet to create a slight crook in the legs. Don’t go too far; a slight amount is enough. This lets the IK solver know which way those joints are supposed to go.
Now, on to creating the IK:
If for some reason you can’t manage to pick a joint for the IK tool, make sure Show ⇒ Pivots is turned on in your view panel. Also, if you have difficulty seeing the handles, you can increase their size by choosing Display ⇒ Animation ⇒ IK Handle Size.
Because the Block Man’s feet will stick to the ground, creating a walk cycle with IK animation is far easier than using FK (why didn’t you tell us that before?). Making the animation look good is still a tough job that requires a lot of practice, though.
Load the scene file block_man_IK_v01.ma
from the Block_Man project from
the companion web page or use your own IK-rigged Block Man with handles at the
ankles and feet. The white leg and arm are, again, on the far side of the character.
You’ll set keys every five frames again for the gross animation. To keep this short,
I’ll just discuss setting poses with the feet. You can always return to the scene to add animation to
the upper body with FK, as you did earlier in this chapter. Follow these steps:
The next pose should match the pose in frame 10, although with the other leg. Continue the cycle, with each successive pose matching the one 15 frames before it on the opposite side.
At the end of this chapter, you’ll take this one step further and create a simple character animation rig for the entire Block Man so you can have a nicely functioning character for animation.
Many animators use IK chains more often in effects animation than in character work. IK chains can drive whips and ropes, flutter flags, bounce ponytails, and pump pistons as well as move legs and arms. For example, you can use a different type of IK chain, the spline IK chain, to control the shape of your bone chain with a NURBS spline. This IK chain is great for snakes and other long, deforming objects.
To create a spline IK chain, choose Skeleton ⇒ IK Spline Handle Tool and then select your top joint and end effector. Maya creates a spline running the length of the bone chain. Adjusting the curvature of the spline in turn drives the bones, which in turn drive the geometry bound to them. Figure 9-52 shows a spline curve affecting the curvature of the bones in its spline IK chain.
As you know, Maya is all about the relationships between object nodes. You can create animation on one object based on the animation of another object by setting up a relationship between the objects. The simplest way to do that (outside of grouping) is to create a constraint. For example, you can “glue” one object to another’s position or rotation through a constraint.
A constraint creates a direct relationship between the source and the target object’s Translate, Rotate, or Scale attributes. This section explores six types of constraints: point, orient, scale, aim, geometry, and normal.
To attach a source object to a target object but have the source follow only the position of the target, use a point constraint. A point constraint connects only the Translate attributes of the source to the target. To use this method, select the target object(s) and then Shift+click the source object. In the Animation menu set, choose Constrain ⇒ Point .
Constraints are based on the pivots of the objects, so a point constraint snaps the source at its pivot point to the pivot point of the target and keeps it there, even in animation. But the options allow you to set an offset that creates a gap between the source and the target.
You can constrain the same source to more than one target object. The source then takes up the average position between the multiple targets. By setting the Weight slider in the option box, you can create more of an influence on the source by any of the targets.
In Figure 9-53, a cone has been point-constrained to a sphere. Wherever the sphere goes, the cone follows. This is different from parenting the cone to the sphere in that only its translations are affected by the sphere. If you rotate or scale the sphere, the cone won’t rotate or scale with it.
Although you can blend keyframe animation with constraint animation, as a beginner to Maya, consider that after you set a point constraint like that shown in Figure 9-53, you’re unable to control the cone’s Translate attributes because they’re being driven by the sphere’s translations.
Point constraints are perfect to animate a character carrying a cane or a sword, for example. The rotations on the sword are still free to animate, but the sword is attached to the character’s belt and follows the character throughout the scene.
An orient constraint attaches the source’s Rotation attributes to the target’s Rotation attributes. Select the target object(s) first and then Shift+click the source object. In the Animation menu set, choose Constrain ⇒ Orient .
The Offset parameter allows you to set an offset in any axis. Otherwise, the source assumes the exact orientation of the target. In the case of multiple targets, the source uses the average of their orientations. Figure 9-54 shows the cone’s orientation following an elongated sphere (the target).
A rotation constraint saves a lot of hassle when you have to animate an object to keep rotating in the same direction as another object. For example, you can use the rotation of one wheel of a locomotive to drive the rotation of all the other wheels.
A point on poly constraint attaches a source object to a vertex of a mesh. Select the target object’s vertex first and then Shift+click the object you want to place at that point (Figure 9-55, left). In the Animation menu set, choose Constrain ⇒ Point On Poly .
The object is snapped to the vertex of the target at its pivot point. Even if the target object is animated and deforming, like a character, the object will stay on that vertex. Figure 9-55 (right) shows the sphere pinned to the branch at the selected vertex location.
The point on poly constraint is good for pinning objects together, such as leaves on a branch.
The aim constraint adjusts the source’s rotations so that the source always points to the target object. Select the target object(s) first and then Shift+click the source object. In the Animation menu set, choose Constrain ⇒ Aim .
The aim constraint has more options than the other constraints because you need to specify which axis of the source is to point to the target. You do so using the Aim Vector and Up Vector settings.
The Aim Vector setting specifies which axis of the source is the “front” and points to the target. In the cone and sphere examples, you set the Aim Vector option of the cone to (0,1,0) to make the Y-axis the front so that the cone’s point aims at the sphere. If Aim Vector is set to (1,0,0), for example, the cone’s side points to the sphere. Figure 9-56 shows the cone pointing to the sphere with an Aim Vector setting of (0,1,0).
The Offset values create an offset on the source’s Rotation attributes, tilting it one way or another. The Up Vector setting specifies which way the cone faces when it’s pointing to the sphere.
Aim constraints are perfect for animating cameras to follow a subject, such as a car at a racetrack.
The geometry and normal constraints constrain the source object to the surface of the target object (as long as it’s a NURBS or poly mesh).
With a geometry constraint, the source object attaches, at its pivot point, to the surface of the target. It tries to keep its own position as best it can, shifting as its target surface changes beneath it. Again, select the target, select the source object, and choose Constrain ⇒ Geometry.
A geometry constraint is useful when you want to keep an object on a deforming surface, such as a floating boat on a lake. Figure 9-57 shows the cone after it has been geometry-constrained to a NURBS plane that is being deformed by a Wave deformer (choose Create Deformers ⇒ Nonlinear ⇒ Wave). The cone sits on the surface as the waves ripple through, but it doesn’t rock back and forth to stay oriented with the surface.
To get the cone to orient itself so that it truly floats on the surface, you need to use a normal constraint. Using a normal constraint rotates the cone to follow the surface’s normals, keeping it perpendicular to the surface.
The normal constraint is similar to the aim constraint, and its options are similar. Using the Aim Vector setting, you specify which way is up for the object to define the orientation that the source should maintain. However, this setting doesn’t constrain the location of the source to the target. If you want a floating effect, use geometry and a normal constraint to get the cone to bob up and down and roll back and forth as the waves ripple along (see Figure 9-58).
Four more constraints are possible in Maya: the scale, parent, tangent, and pole vector constraints. Simply, a scale constraint attaches the source’s Scale attributes to the target’s Scale attributes. A parent constraint constrains an object’s translation and rotation to another object by mimicking a parent-child relationship without actually parenting the objects. This keeps objects aligned without worrying about any grouping issues. You’ll have a firsthand look at this in the exercise where you rig the locomotive later in this chapter. Lucky you!
A tangent constraint keeps an object’s orientation so that the object always points along a curve’s direction. This constraint is usually used with a geometry constraint or path animation to keep the object traveling along a curve pointed in the right direction, no matter the direction of the curve. A point on poly constraint allows you to select a vertex on a poly mesh and constrain an object to that vertex. Pole vector constraints are used extensively in character animation rigs to keep IK joints from flipping beyond 180 degrees of motion.
A favorite feature for animation riggers is the set-driven key (SDK). An SDK establishes a relationship for objects that lets you create controls that drive certain features of a character or an object in a scene.
Before you can use an SDK, you must create extra attributes and attach them to a character’s top node. These new attributes drive part of the character’s animation. The term character is used broadly here. For example, you can set up a vehicle so that an SDK turns its wheels.
Let’s start with a simple SDK relationship between two objects. You’ll create a relationship between a ball and a cone. As the ball moves up in the Y-axis, the cone spins in the X-axis. As the ball descends, the cone spins back. You’ll then revisit the hand and set up an SDK on the skeleton that animates the model.
To create a simple SDK to make a sphere control the animation of a cone’s rotation, follow these steps:
Automating some animations on a character is indispensable to an animator. This can’t be truer than when setting up an SDK for hand control. After you model and bind a hand to a skeleton, you’re ready for an SDK.
Open the scene poly_hand_skeleton_v05.ma
from the Poly_Hand_Anim project
from the companion web page or use your own file that has the hand and its skeleton
and is bound to the skin. Your file shouldn’t have animation, though. Set your hand
to the bind pose before you begin.
First you’ll create a new attribute called index_pull to control a contracting finger.
After you click OK, the Index_Pull slider appears in the Attribute Editor and the Channel Box when you select the handMesh object. This attribute alone will control the entire index finger.
To set up the relationships with the SDK, follow these steps:
joint11
in the web page file) and rotate
it in Y to 20. Select the next joint up the chain (the middle knuckle,
joint10
) and rotate it to 35 in the Y-axis.
Select the final index knuckle (joint9
) and rotate it in the
Y-axis to 5.joint11
) to rotate to 65 in Y. Set the middle knuckle
(joint10
) to 60. Set the last
knuckle (joint9
) to 50. Click the
Key button to see the result shown in Figure 9-63.Select the handMesh node and change the value of the index_pull
attribute to curl your index finger. All you need to do to animate the finger is to
set keys on that one attribute! Furthermore, you can set up a single SDK to control
the bending of all the fingers at once, or you can set up one SDK for each finger
for more control.
Open the scene poly_hand_skeleton_v06.ma
from the Poly_Hand_Anim project
available on the companion web page to see the hand with the SDK set up on the index
finger.
In this section, you’ll use a locomotive to put your new animation skills to use.
Download the file fancy_locomotive_anim_v1.mb
from the Scenes folder of
the Locomotive project from the book’s web page; this scene is shown in Figure 9-64. Notice in this scene,
there are small plus signs near the wheels. These are selection handles, allowing
you to more easily select objects or groups of objects. They have been enabled for
some of the objects on the locomotive to make it easier to work with. To toggle
selection handles on or off for any node in Maya, Display ⇒ Transform Display
⇒ Selection Handles.
After selection handles for the locomotive’s wheels and drive arms are turned on, only the objects that have selection handles will be selected when you make a marquee selection that covers the entire locomotive.
Your goal here is to rig the scene to animate all the secondary movements automatically based on some simple controls, such as you did for the hand earlier this chapter. In reality, the locomotive’s steam pump drives the arms that then turn the wheels on the locomotive. You’ll work backward, however, and use one wheel to drive the animation of everything else.
Because all the large wheels have the same diameter, they rotate the same as the locomotive moves. In this case, you’ll use the Connection Editor to attach the X Rotation on all the wheels to your main control wheel. You’ll pick the middle wheel to be the control. To set up the locomotive, follow these steps:
wheel_2_LT_side
), as shown in Figure 9-65. Open the Connection Editor (choose
Window ⇒ General Editors ⇒ Connection Editor). Click the Reload Left
button to load the attributes of the selected middle wheel. Now, select the
front wheel on the left side, and click the Reload Right button.wheel_3_LT_side
).
Click the Reload Right button in the Connection Editor. Connect the Rotate
attribute for the middle and back wheels. Close the Connection Editor, and
select just the middle wheel. When you rotate the wheel, all three wheels rotate
together.You’ve now automated the animation of the wheels. Next, you’ll figure out how to connect the wheel arms to the wheels and drive their motion as well. To do so, follow these steps:
Next, you need to attach the pump arm to the wheel arm so that it pumps back and forth as the control wheel turns. If you simply group the pump arm with the end joint of the wheel arm’s bone, the pump arm will float up and down as it pumps back and forth. You need to use a constraint to force the pump arm to move back and forth only in the Z-axis.
The scene file fancy_locomotive_anim_v2.mb
will catch you up to this
point. Compare it to your work.
All that remains is to control the animation of the back wheel and its wheel arm. To set up the wheel arm animation, follow these steps:
If you group the IK handle, as shown earlier in Figure 9-70, you’ll run into a problem when you animate. Let’s try it. Group the IK handle (ikHandle2) under the end back wheel, as shown in Figure 9-76, and then rotate the control wheel. The wheel arm pumps back and forth along with the back wheel, but every now and then the wheel arm geometry flips over backward. This isn’t good.
Fixing this is easy. The grouping of the IK handle to the back wheel is causing the issue. Although that is pretty much what you want to do, parenting the IK handle under the wheel is problematic. Here is where the parent constraint becomes extremely helpful. It gives you the desired result without the geometry flipping.
You can use fancy_locomotive_anim_v3.mb
to compare your work.
You’re almost home free with the locomotive wheel rigging. Everything works great when you rotate the control wheel. If you select the top node of the locomotive and translate the train back and forth, everything should work perfectly. Repeat the steps in the previous few sections to connect the wheel arms and wheels on the other side of the locomotive, and you’re finished! Figure 9-77 shows the completed and rigged locomotive.
In this section, you will revisit the Block Man setup to create a more well-rounded character rig with controls like professional animators use. This rig was created by Maks Naporowski, a fellow instructor at USC and CG animator/rigger as a fairly simple biped rig for animation. Bear in mind that character rigging is an involved process, and you are starting to scratch the surface here. When you are done with this rig, you will have a simple two-legged character that you can easily animate using the controls you will set up based on what you’ve already accomplished throughout this chapter.
Animators hardly ever manipulate and keyframe IK handles or joints directly when a good rig is available to them, and that’s what you should keep in mind for the following rig:
block_man_skeleton_v02.ma
from the
Block_Man project.These shapes will be the primary controllers for the animation of the character. They are easy to select and manipulate and make animation much easier.
Now comes the tough part of rigging it all to work! You’ll group the shapes and create relationships to the skeleton here:
Now let’s move on to creating some nice foot controls to allow the character to stand on his tiptoes or his heels easily. For that you will need to build a reverse joint chain to control the foot from the heel to supplement the existing leg joints.
lt_foot
). Hold down V for point snaps when you
create the joint so you can snap it exactly to that toe joint. Snap the third
joint to the existing lt_ballFoot joint; finally, snap the fourth joint to the
existing lt_ankle joint. Now let’s set up some fancy heel controls.
You need to set up a set-driven key (SDK) to raise or lower the heel based on the value of the Heel attribute.
Make sure you’re saving your progress as you go! When you’re done, your rig should have some pretty handy controls. You will move the entire character using the main_CNTRL node. You can move the body itself while keeping sticky IK hands and feet by using the body_CNTRL node. And, of course, you control the arms/hands and legs/feet using the respective arm_CNTRL and foot_CNTRL nodes. All keyframes and animation should happen on these nodes only; you should not have to manipulate the joints or the IK handles directly at all. And that, in a somewhat confusing and long-winded nutshell, is the purpose of a character rig.
You can load the file character_rig_v01.ma
from the Block_Man project to
check your work or just to use as a rigged character for some animation fun!
Animation is as much a sport as it is an art, meaning practice makes you better. Use the rigged character from the end of this chapter to redo the walk animations from the beginning of the chapter. Also try different types and moods of walk. Can you animate a simple walk that looks happy and enthusiastic? Can you make that walk sad and lonely? Being able to convey emotion in your movement is key, and the more you try, the better you get.
In this chapter, you extended your experience with animation and learned about rigging techniques and automation. Starting with the simple Block Man, you learned how to set up a hierarchy for forward kinematics animation to create a walk cycle. Then, you used a skeleton to rig a hand for animation. Next, you learned how to bind the geometry of the hand to the skeleton using two different methods of smooth bind and also the interactive bind, as well as how to edit the binding. You also learned how to create an IK system to drive the joints in the Block Man for an IK walk cycle animation. After that, you learned how constraints can be used in rigging and how to set up set-driven keys to create easy controls to animate the hand. Then, you put all these rigging tricks together to rig the wheels of the locomotive to automate the animation of that complex system with a single control based on the middle wheel. And finally, you tackled a pretty tough rigging assignment in rigging the Block Man even further to have some nice options for movement using controllers.
The true work in animation comes from recognizing what to do in the face of certain challenges and how to approach their solutions. Maya offers a large animation toolset, and the more familiar you become with the tools, the better you’ll be able to judge which tools to use in your work. Don’t stop with this chapter; experiment with the features not covered here to see what happens.
Animation is about observation and interpretation. The animator’s duty is to understand how and why something moves and to translate that into their medium without losing the movement’s fidelity, tenacity, or honesty.