When it comes to character animation, a character is often a single ww seamless mesh. As a single seamless mesh, it's virtually impossible to animate that character with any detailed movement using the object animation techniques in Chapter 10. I mean, you can move the whole character mesh at once from one location to another, but you can't make the character smile or wiggle her toes or even bend her arms. You can break the mesh apart and use a complex set of parenting and constraints, but then you lose its nice seamlessness.
What you really want to do is find ways to animate specific parts of the mesh in a controlled manner without tearing the mesh apart. To do so, you need to create a rig for your character. A rig is an underlying structure for your mesh that allows you to control how it moves. Rigs are an integral part of modern computer animation, and if done well, they make the life of an animator monumentally easier. Think about it like turning your 3D mesh into a remote-control puppet. This chapter explains the various tools and techniques used to create more complex rigs. Then you can create a rig for nearly any object in Blender and have a blast animating it. The website www.blenderbasics.com
has an example tutorial that takes you from beginning to end on rigging a simple character.
Whether you have to animate a character or a tree or a basketball with any detail, it has to deform from its original shape to a new one. If you know what this new shape looks like, you can model it ahead of time.
As an example, say that you have a cartoony character — maybe the head of a certain Blender monkey. You know that you're going to need her eyes to bulge out because, that happens to all cartoon characters' eyes. One way to create this effect in Blender is by creating a shape key, sometimes called a morph target or a blend shape in other programs. A rough outline of the process goes something like this (the next section in this chapter goes into more detail):
In the cartoony character example, you'd model the character's eyes all bulgy. (Yes, bulgy is a real word. I think.)
Assuming that you selected an object that supports shape keys (meshes, curves, surfaces, and lattices), you can start adding shape keys in the Shape Keys panel of Object Data Properties (Object Data Properties is the generic name for Mesh Properties, and Curve Properties).
Figure 11-1 shows three different states for the Shape Keys panel. By default, this panel looks pretty innocent and empty with just a list box and a few buttons to the right of it. However, when you left-click the Plus (+) button, a basis shape, or the original shape that other shape keys relate to, is added to the list. Left-clicking the Plus (+) button a second time gives you an additional set of options that control the change from the basis shape to a new one, named Key 1
.
The best way to see how to create new shapes is to go through a practical example. Staying with the bug-eyed monkey theme, use Suzanne as your test subject, and follow these steps:
Your basis shape is created. The other shapes that you create will be relative to this one.
The Shape Keys panel looks like the last one in Figure 11-1. You've created Key 1
. If you want, you can rename it by double-clicking its name field. I named mine Eye Bulge
.
Make sure that your Eye Bulge shape key is active in the Shape Keys panel before making adjustments. As you modify the mode, be sure that you do not add or remove any geometry in the mesh. You should define the shape by moving around the vertices, edges, and faces you already have. A quick way to make Suzanne's eyes bulge is to move your mouse cursor over each eye and press L to select just the vertices there. Then with proportional editing (O) turned on, scale (S) the eyes.
Figure 11-2 illustrates this process.
This process creates two shape keys: Basis
and Eye Bulge
. With the Eye Bulge
shape key selected in the Shape Keys panel, you can use the Value slider to smoothly transition from the Basis
shape to the Eye Bulge
shape. A value of 0 means that Eye Bulge
has no influence and you just have the Basis
, whereas a value of 1 means that you're fully at the Eye Bulge
shape.
But here's where things get really cool. Notice the Min and Max values at the bottom of the panel, labeled Range. The Min is set to 0.000, and the Max is set to 1.000. Just for kicks, change the Max value to 2.000 and pull the slider all the way to the right. Your bulged eyes grow larger than your actual shape key made them. Now change the Min value to −1.000 and pull the slider to the left. Now Suzanne's eyes pinch in to a point smaller than the Basis
pose. Figure 11-3 shows the results of these changes. Adjusting the Min and Max Range values is a great way to provide even more extreme shapes for your characters without having to do any additional shape key modeling. How's that for cool?
From this point, you can create additional shape keys for the mesh. Say that you want to have a shape key of Suzanne's mouth getting bigger, like she's screaming because her eyes have gotten so huge. The process is about the same as when creating your initial shapes:
Feel free to name this key whatever you want. I called mine Scream
.
Make sure that you're not touching Suzanne's eyes. You're just editing the mouth to get bigger.
Figure 11-4 shows the results of this process.
After you have the Scream
shape key created, you can freely mix it with the Eye Bulge
shape key, or you can have Suzanne screaming with her regular, bulge-free eyes. The choice is yours. You have the flexibility here to mix and match your shape keys as it pleases you. And animating the mesh to use these keys is really easy.
In Blender, “(almost) everything is animatable,” so animating shape keys is as easy as inserting keyframes on the Value slider in the Shape Keys panel. (Right-click the Value fieldInsert Keyframe or hover your mouse over that field and press I.) Now you can scrub the timeline cursor forward in time and watch Suzanne bulge and scream to your complete delight.
To see another nice little bonus, split off a Graph Editor from your 3D View. If you enable the Show Sliders feature in the Graph Editor (ViewShow Sliders), you can see the numeric values for your shape keys' influences and even key them right there.
Now, you could do an entire animation using shape keys. But do I recommend it? No. You can control your meshes in other ways that may give you more natural movement for things like animating arms and legs.
That said, shape keys are the perfect choice for things that you can't do with these other means (or, at least, that are very difficult). A big one is facial animation. The way parts of the face wrinkle up and move around is pretty difficult to re-create without modeling those deformations. Furrowed brows, squinty eyes, natural-looking smiles, and phonemes, or mouth shapes for lip-syncing, are where shape keys shine. You can also team them with other controls discussed throughout this chapter to achieve cool effects like cartoon stretchiness, muscle bulges, and morphing objects from one shape to another.
Shape keys work well for getting specific predefined deformations, but they can be pretty limiting if you want to have a little bit looser control over your mesh or if you're animating things that move in arcs. For these sorts of situations, you have another control mechanism: hooks. Hooks are a special kind of modifier that takes a set of vertices or control points and binds them to be controlled by another object, usually an Empty.
The workflow for adding a hook is pretty straightforward. You tab into Edit mode and select at least one vertex or control point. Then you press Ctrl+HHook to New Object. An Empty is created at a location that's the median point of all your selected vertices or control points. You also get a new modifier added to in Modifier Properties, as shown in Figure 11-5.
Tab back into Object mode and transform the hook. All the vertices or control points that you assigned to the hook move with it. And using the options in the Hook modifier, you can control how much influence the hook has over these vertices or control points. The following example gives you a clearer understanding of adding and modifying the influence of hooks:
All the cube's vertices are selected by default. If not, press A until the vertices are selected.
At this point, behavior is as expected. If you select and move the Empty, all the vertices that hooked to it move as if they're parented to it.
Now when you select and transform the Empty, the way the vertices follow it is much smoother, kind of like when you're modeling with proportional editing (O). For additional kicks, do the next step.
Now the transition is even smoother, as shown in Figure 11-6.
Vertices aren't just bound to their hook's location. They're also controlled by the hook's scale and rotation. You can really get some wild and complex deformations using this deceptively simple feature.
The best use for hooks is for large organic deformations. Like shape keys, hooks are nice for creating muscle bulges and cartoony stretching. You can even use them along with shape keys. Because shape keys always use the same shape as the basis for deformation, adding a hook can bring a bit more variety. For example, in the bug-eyed Suzanne example from the “Creating Shape Keys” section, you can add a hook for one of the eyes to make it bulge asymmetrically. These touches give more character to your 3D characters.
Another great use for hooks is in animating curves in the 3D View. All the steps in the previous examples of this section work for curves and surfaces as well as meshes. If you have a curve that you're using as a character's tail, you can add a hook at each control point. Then you can animate that tail moving around.
Shape keys and hooks are great ways to deform a mesh, but the problem with them is that both are lacking a good underlying structure. They're great for big, cartoony stretching and deformation, but for a more structured deformation, like an arm bending at the elbow joint, the motion that they produce is pretty unnatural looking. To solve this problem, 3D computer animation took a page from one of its meatspace contemporaries, stop-motion animation. Stop-motion animation involves small sculptures that typically feature a metal skeleton underneath them, referred to as an armature. The armature gives the model both structure and a mechanism for making and holding poses. Blender has an object that provides a similar structure for CG characters. It, too, is called an armature. Armatures form the basis of nearly all Blender rigs.
To add an armature to your scene, go to the 3D View and press Shift+AArmatureSingle Bone. As Figure 11-7 shows, adding an armature creates a single object with a weird shape called an octahedron. Continuing to use the skeleton analogy, that octahedron is referred to as a bone in the armature. The wide end of the bone is referred to as the bone's head or root, and its narrow end is referred to as the bone's tail or tip. Typically, a bone pivots at the head.
You can take a rather inauspicious single bone armature and do something more interesting with it. Like nearly every other object in Blender, you can edit the armature in more detail by selecting it (right-click) and tabbing into Edit mode. In Edit mode, you can select the sphere at the bone's head, the sphere at the bone's tail, as well as the bone itself. (Selecting the bone body actually selects both the head and tail spheres as well.) You can add a new bone to your armature in five ways:
Armatures can get very complex very quickly, so you should name your bones as you add them. Let me say that again: Name your bones as you add them.
The fastest way to name your bones is from the Item panel in the 3D View's Properties region (N). From there, you edit the names of your bones the same way you edit names of other Blender objects. Left-click the name in the Bone field and type the name of a bone that makes sense. Alternatively, you can go to Bone Properties and change the name of your bone from the text field at the top. As an example, if you have a two-bone chain to control a character's arm, you may name one bone arm_upper
and the other arm_lower
.
Unfortunately, both these techniques can be really slow if you're trying to name a lot of bones at once (because maybe, ahem, you forgot to name your bones as you were adding them). For this hopefully rare case, the Outliner is the best tool for the job. Expand the Armature object to reveal the hierarchy of bones within it. Double-click the name of any bone (or any object, for that matter), and you can rename it right there. Figure 11-8 shows the three places where you can name your bones.
Blender has a pretty cool way of understanding symmetric rigs, or rigs that have a left side that's identical to the right. For these cases, use a .L
and .R
suffix on your bone names. So in the previous example, if you're rigging a character with two arms, the bones in the left arm would be named arm_upper.L
and arm_lower.L
. The right arm bones would be named arm_upper.R
and arm_lower.R
. This naming convention gives you a couple of advantages, but the one that's most apparent when modeling your rig is the X-Axis Mirror feature.
To understand how symmetric rigs and X-axis mirroring work better, create a new armature at the origin (Shift+SCursor to Center, Shift+AArmatureSingle Bone) and follow these steps:
root
.
It's common convention in rigging to use this name for the main parent bone in the rig.
Bone.R.
Bone.L
.Bone.R
and grab it to move it around (G).
Now, wherever you move the tail of this bone, the tail of Bone.L
matches that movement on the other side of the X-axis. You can even extrude (E) a new bone, and a new bone is extruded on both sides of the axis. In this way, X-axis mirroring can speed up the rigging process immensely.
When editing bones, it's a good idea to make visible the mesh for which your rig is intended. This way, you get your proportions correct. A good general rule for placing bones is to think about where the character's real anatomical bones would be located and then use that as a guideline.
One important thing that makes armatures helpful is the notion of how its bones relate to one another. The most important of these relationships is the parent-child relationships between bones. The same hotkeys for parenting and unparenting objects also work with bones, but with a couple additional features. To illustrate the additional features when parenting bones, start a new scene (Ctrl+N), delete the default cube (X), add a new armature object (Shift+AArmatureSingle Bone), and then tab into Edit mode. Then follow these steps:
You're given two options:
You have another pair of options:
Figure 11-9 shows how two bones in an armature can be related.
Even with bones parented — connected or otherwise — if you rotate the parent bone, the child doesn't rotate with it as you might expect in a typical parent-child relationship. That's because you're still in Edit mode, which is designed mostly for building and modifying the armature's structure. The parent-child relationship actually works in a special mode for armatures called Pose mode. You access this mode by either pressing Ctrl+Tab or choosing Pose Mode from the Mode menu in the 3D View's header. (If you have the Pie Menus add-on enabled, Pose mode is an option from the pie that appears when you press Tab.)
When you're in Pose mode, if you select individual bones and rotate them, their children rotate with them, as you might expect. From there, you can swap back out to Object mode by pressing Ctrl+Tab again, or you can jump back into Edit mode by just pressing Tab. Chapter 12 has more on working in Pose mode.
When working with armatures, the Properties editor has some sections specific to armatures with options and controls that are incredibly helpful. Select your armature (right-click) and have a look at the Properties editor. In particular, note that in addition to Armature Properties, there are two more sets of properties: Bone Properties and Bone Constraints Properties. Figure 11-10 shows the contents of these panels.
As you may have guessed, Armature Properties provide options for the armature overall, while Bone Properties provide options for the currently selected bone. Looking first at Bone Properties, some options and controls are immediately helpful. The text field at the top lets you rename your bone. The Transform panel gives you precise numeric control over the location of the head and tail of the selected bone, as well as its roll angle, or the orientation of the octahedron between the head and the tail, while in Edit mode. These controls are exactly the same as the transform controls in the 3D View's Properties region (N).
In the Relations panel, you can define how the selected bone relates to other bones in the armature. In particular, the Parent field displays the selected bone's current parent, if it has one, and allows you to choose another existing bone as its parent. If you have a parent defined here, the Connected check box beneath it allows you to tell Blender whether it's connected to its parent.
If you enable the Connected check box, the selected bone's head snaps to the location of its parent's tail. However, your selected bone's tail won't move. This is a key difference between setting up a parent-child relationship in Bone Properties and using Ctrl+P in the 3D View.
On the left side of the Relations panel are a series of buttons, known as bone layers, which look like the layers buttons in the 3D View's header. Just as you can place objects on layers in Object mode, Blender's armatures have a special set of layers to themselves. The reason is that character rigs can get pretty involved. Using bone layers is a good way to keep the rig logical and organized. Left-click a layer button to assign the bone to it. If you'd like the bone to live on more than one layer, you can Shift+left-click the buttons for those layers. To add your bone to a lot of layers all at once, Shift+left-click and drag your mouse cursor over the bone layers.
The options in the various armature-related sections of the Properties editor change a bit between Edit mode (Tab), Object mode, and Pose mode (Ctrl+Tab). What I cover is available in Edit mode and Pose mode.
Two other important sets of controls are in Bone Properties. The first is the Deform panel. Simply put, the check box for this panel is a toggle that tells Blender whether the selected bone can be mapped to the geometry of your mesh. If the mesh's geometry is mapped, or weighted, to the bone, then that bone is considered a deformer. Deformers should have the Deform check box in Bone Properties enabled.
Besides deformers, you can also have bones whose purpose is to control the behavior of the deformer bones. These bones are often referred to as control bones. To prevent the control bones from inadvertently influencing your mesh's geometry, you want to make sure that the Deform check box is disabled in Bone Properties.
Back in Armature Properties, there are two sets of layer buttons in the Skeleton panel. These buttons correspond to the bone layers in Bone Properties. The layer buttons under the Layers label control which layers the armature is actually displaying in the 3D View. The layer buttons under the Protected Layers label have an effect only if you're linking your rig into a separate scene file. That topic is a bit more advanced than what this book covers, so I leave it at that for now.
The Display panel contains a set of buttons for controlling how bones in the armature are displayed:
Armatures and bones are pretty interesting, but they do you no good if they don't actually deform your mesh. When you create your own rig, and Ctrl+Tab to Pose mode, you can grab, rotate, and scale bones, but the moving bones have no influence whatsoever on your mesh. What you need to do is bind the vertices of the mesh to specific bones in your armature. This binding process is commonly referred to as skinning. Blender has two primary ways of skinning: envelopes and vertex groups.
Envelopes are the quickest way to get a mesh's vertices to be controlled by the armature. You don't have to create anything extra: It's just a simple parenting operation that seals the deal. To use envelopes to control your mesh, use the following steps:
Choose Armature Deform from the menu that appears. Upon completion, your mesh is a child of the armature object, and it also now has an Armature modifier applied. The modifier is what allows the armature to deform your mesh. Without the modifier, it's just a simple parenting.
When you Ctrl+Tab into Pose mode on your armature, you may notice that the mesh still doesn't appear to be influenced by your armature. You need to make a small change in the Armature modifier. Select your mesh again and proceed to the next step.
You can also disable the Vertex Groups check box, if you'd like.
This step reveals exactly where the influence of your envelopes lies.
(Actually, if you just want to edit the influence, you can do so directly with the Ctrl+Alt+S hotkey combination.)
Figure 11-12 illustrates envelopes in action.
Envelopes are great for quickly roughing out a rig and testing it on your mesh, but for detailed deformations, they aren't ideal. Where the influence of multiple envelopes overlap can be particularly problematic, and there's a good tendency for envelope-based rigs to have characters pinch a bit at their joints. For these cases, a more detailed approach is necessary.
That said, using envelopes in your armature does give you one distinct control that you can't have with armatures otherwise. You can actually use an armature with envelopes to control the deformation of curves and surfaces. So long as a control point is within the influence space of a bone's envelope, you can modify it and therefore animate it with the armature.
So if envelopes are the imprecise way of controlling your mesh, what's the precise way? The answer is vertex groups. A vertex group is basically what it sounds like — a set of vertices that have been assigned to a named group.
In many ways, a vertex group is a lot like a material slot (see Chapter 7). Besides the fact that vertex groups don't deal with materials, vertex groups have a couple of distinctions that set them apart from material slots. First of all, vertex groups aren't mutually exclusive. Any vertex may belong to any number of vertex groups that you define.
A side effect of being able to be a member of multiple groups is another distinction: You can give a vertex a weight, or a numerical value that indicates how much that particular vertex is influenced or dedicated to a specific vertex group. A weight of 1.0 means that the vertex is fully dedicated to that group, whereas a weight of 0 means that although the vertex is technically part of the group, it may as well not be.
One thing to note: Vertex groups need to have the exact name of the bones that control them. So if you have a bone called pelvis
, you need a corresponding vertex group with the same name. The vertices assigned to that group then have their position influenced by the location, rotation, and scale of the pelvis bone, tempered by the vertices' individual weights.
To adjust the assignments and weights of vertices in their respective vertex groups, you can use the Vertex Groups panel in Mesh Properties for your selected mesh. You create a new group with the Plus (+) button to the right of the list box. To select the vertices that you want to assign to the group, you need to tab into Edit mode. With the vertices selected in Edit mode, you can adjust the value in the Weight slider and then assign them to the vertex group by left-clicking the Assign button.
If you don't see the Assign button or Weight slider in the Vertex Groups panel, then you're not in Edit mode. Tab into Edit mode and those controls should appear for you.
Something to note about vertex weights is that, when used for armatures, they are normalized to 1.000. That is, a vertex can be a member of two vertex groups and have a weight of 1.000 for both. In these cases, Blender adjusts the weights internally so that they add up to 1.000. So in my example, that double-grouped vertex behaves like it has a weight of 0.500 on both groups.
Of course, on a complex armature, this process of creating vertex groups and painstakingly assigning weights to each vertex can get excessively tedious. Fortunately, Blender has a couple tools to make things less painful. First of all, you don't have to create all the vertex groups by yourself. Refer to the preceding section on the process of skinning with envelopes. By parenting the mesh to the armature there, you're presented with a few options. For using envelopes only, you choose Ctrl+PArmature Deform. However, the other options give you a lot of power when you use vertex groups:
Regardless of which option you choose for generating your vertex weights, you'll probably still have to go in and manually tweak the weights of the vertices in each vertex group (unless the object you're trying to rig is incredibly simple). Trying to do those tweaks just from the Vertex Groups panel can be pretty painful. Fortunately, there is Weight Paint mode. This mode is almost exactly like Vertex Paint mode (see Chapter 7), except that rather than painting color on the mesh, you're painting the weight assignment to a specified vertex group.
To access Weight Paint mode from Object mode, select the mesh (right-click) and press Ctrl+Tab. Alternatively, you can choose Weight Paint mode from the Mode menu in the 3D View's header. If you have the Pie Menus add-on enabled, Weight Paint mode is a pie menu option when you press Tab. Even if you don't intend to paint weights, Weight Paint mode is a great way to see how the weights were assigned by Blender if you used the automatic method.
The way that weights are visualized is kind of like a thermal map, where red is the hottest value and blue is the coldest value. Extending this logic to work with bone weights, vertices that are painted red have a weight of 1.0, whereas vertices painted blue are either not assigned to the vertex group or have a weight of zero. The 50 percent weight color is bright green.
If the thermal map color styling isn't your thing (as can be the case if you're colorblind), you can define your own weight paint color range using the ramp editor in the bottom right of the System section of Blender's User Preferences (Ctrl+Alt+U).
When in Weight Paint mode, you get a bunch of painting panels in the Tool Shelf, as shown in Figure 11-13. With a few minor exceptions, these controls are identical to the ones used in Vertex Paint mode.
When weight painting, it's often useful to enable the Wire check box in the Display panel of Object Properties. Enabling this check box overlays the mesh's wireframe on it. Seeing the wireframe is especially helpful when weight painting because it helps you see where the actual vertices on the mesh are. That way, you're not just painting in empty space where no vertices exist. The only slight hiccup is if you're painting planar vertices, or vertices that all share the same plane. In this particular case, Blender tries to simplify the wireframe overlay. While that simplification may be nice in general, it can be problematic when painting. To get around that obstacle, enable the Draw All Edges check box in the same Display panel of Object Properties.
A handy feature in the Tool Shelf while weight painting is the X-Mirror check box in the Options panel (it's located in the Options tab). X-Mirror can literally cut your weight painting time in half. When you enable this check box, Blender takes advantage of the left/right naming convention discussed earlier in the “Editing armatures” section of this chapter. So if you're tweaking the vertex weights on the left leg, Blender automatically updates the weights for the corresponding bone on the right leg so that they match. If that ain't cool, I don't know what is.
The actual process of weight painting is nearly identical to using vertex paint. However, you need to pay attention to one more thing with weight painting: the need to tell Blender which vertex group you're painting. You can do so in two ways. The slow way, you already know: Select the group from the list box in the Vertex Groups panel in Mesh Properties.
Of course, the kind Blender developers have provided a faster way: you can select (right-click) the bone that you want to paint weights for, even while in Weight Paint mode on your mesh. When you right-click a bone, Blender automatically activates the corresponding vertex group and allows you to paint. As an added bonus, you can test your weights on the fly by grabbing, rotating, or scaling the selected bone while you're still in Weight Paint mode.
To select bones while in Weight Paint mode, be sure that your armature is in Pose mode before selecting your mesh object.
Because weight paint relies so much on color, I highly recommend you look on the Web (perhaps on this book's website) for full-color version meshes in Weight Paint mode.
If you choose to use vertex groups, have a look at the Armature modifier on your mesh. Under the Bind To label are two check boxes: Vertex Groups and Bone Envelopes. By default, only the Vertex Groups check box is enabled. However, both options can be enabled. With both enabled, the mesh is influenced by vertex groups as well as the bone envelopes from your armature. This double influence can be useful in some instances, but most riggers tend to prefer to work with just one or the other. This way, you know that the only reason a vertex is deforming improperly is because its weight isn't assigned properly. You don't have to concern myself with the influence of the bone's envelope.