|Read more about this book|
(For more resources on Blender, see here.)
This article is about our character's torso: we're going to see how to create hips, a spine, and a neck.
Aside from what you'll learn from here, it's important for you to take a look at how some of those rigs were built. You'll see some similarities, but also some new ideas to apply to your own characters. It's pretty rare to see two rigs built the exact same way.
How to create a stretchy spine
A human spine, also called vertebral column, is a bony structure that consists of several vertebrae (24 or 33, if you consider the pelvic region). It acts as our main axis and allows us a lot of flexibility to bend forward, sideways, and backward. And why is this important to know?
That number of vertebrae is something useful for us riggers. Not that we're going to create all those tiny bones to make our character's spine look real, but that information can be used within Blender. You can subdivide one physical bone for up to 32 logical segments (that can be seen in the B-Bone visualization mode), and this bone will make a curved deformation based on its parent and child bones. That allows us to get pretty good deformations on our character's spine while keeping the number of bones to a minimum.
This is good to get a realistic deformation, but in animation we often need the liberty to squash and stretch our character: and this is needed not only in cartoony animations, but to emphasize realistic poses too. We're going to see how to use some constraints to achieve that. We're going to talk about just the spine, without the pelvic region. The latter needs a different setup which is out of the scope of this article.
How to do it...
- Open the file 002-SpineStretch.blend from support files. It's a mesh with some bones already set for the limbs, as you can see in the next screenshot. There's no weight painting yet, because it's waiting for you to create the stretchy spine.
- Select the armature and enter into its Edit Mode (Tab). Go to side view (Numpad 3); make sure the 3D cursor is located near the character's back, in the line of what would be his belly button. Press Shift + A to add a new bone. Move its tip to a place near the character's eyes.
- Go to the Properties window, under the Object Data tab, and switch the armature's display mode to B-Bone. You'll see that this bone you just created is a bit fat, let's make it thinner using the B-Bone scale tool (Ctrl + Alt + S). With the bone still selected, press (W) and select Subdivide.
Do the same to the remaining bones so we end up with five bones. Still in side view, you can select and move (G) the individual joints to best fit the mesh, building that curved shape common in a human spine, ending with a bone to serve as the head, as seen in the next screenshot:
- Name these bones as D_Spine1, D_Spine2, D_Spine3, D_Neck, and D_Head.
- You may think just five bones aren't enough to build a good spine. And here's when the great rigging tools in Blender come to help us. Select the D_Neck bone, go to the Properties window, under the Bone tab and increase the value of Segments in the Deform section to 6. You will not notice any difference yet.
Below the Segments field there are the Ease In and Ease Out sliders. These control the amount of curved deformation on the bone at its base and its tip, respectively, and can range from 0 (no curve) to 2.
- Select the next bone below in the chain (D_Spine3) and change its Segments value to 8. Do the same to the remaining bones below, with values of 8 and 6, respectively. To see the results, go out of Edit Mode (Tab). You should end up with a nice curvy spine as seen in the following screenshot:
Since these bones are already set to deform the mesh, we could just add some shapes to them and move our character's torso to get a nice spine movement. But that's not enough for us, since we also want the ability to make this character stretch.
- Go back into Edit Mode, select the bones in this chain, press Shift + W, and select No Scale. This will make sure that the stretching of the parent bone will not be transferred to its children. This can also be accomplished under the Properties window, by disabling the Inherit Scale option of each bone.
- Still in Edit Mode, select all the spine bones and duplicate (Shift + D) them. Press Esc to make them stay at the same location of the original chain, followed by Ctrl + Alt + S to make them fatter (to allow us to distinguish both chains). When in Pose Mode, these bones would also appear subdivided, which can make our view quite cluttered. Change back the Segments property of each bone to 1 and disable their deform property on the same panel under the Properties Window. Name these new bones as Spine1, Spine2, Spine3, Neck, and Head, go out of Edit Mode (Tab) and you should have something that looks similar to the next screenshot:
- Now let's create the appropriate constraints. Enter in Pose Mode (Ctrl + Tab), select the bone Spine1, hold Shift, and select D_Spine1. Press Shift + Ctrl + C to bring up the Constraints menu. Select the Copy Location constraint. This will make the deformation chain move when you move the Spine_1 bone.
The Copy Location constraint here is added because there is no pelvic bone in this example, since it's creation involves a different approach which we'll see in the next recipe, Rigging the pelvis. With the pelvic bone below the first spinal bone, its location will drive the location of the rest of the chain, since it will be the chain's root bone. Thus, this constraint won't be needed with the addition of the pelvis. Make sure that you check out our next recipe, dedicated to creating the pelvic bone.
- With those bones still selected, bring up the Constraints menu again and select the Stretch To constraint. You'll see that the deformation chain will seem to disappear, but don't panic.
- Go to the Properties Panel, under the Bone Constraints tab and look for the Stretch To constraint you have just created. Change the value of the Head or Tail slider to 1, so the constraint would be evaluated considering the tip of the Spine_1 bone instead of its base. Things will look different now, but not yet correct. Press the Reset button to recalculate the constraints and make things look normal again. This constraint will cause the first deformation bone to be stretched when you scale (S) the Spine_1 bone. Try it and see the results. The following screenshot shows the constraint values:
This constraint should be enough for stretching, and we may think it could replace the Copy Rotation constraint. That's not true, since the StretchTo constraint does not apply rotations on the bone's longitudinal Y axis. So, let's add a Copy Rotation constraint.
- On the 3D View, with the Spine1 and D_Spine1 selected (in that order, that's important!), press Ctrl + Shift + C and choose the Copy Rotation constraint. Since the two bones have the exact same size and position in 3D space, you don't need to change any of the constraint's settings.
- You should add the Stretch To and Copy Rotation constraints to the remaining controller bones exactly the same way you did with the D_Spine1 bone in steps 9 to 12.
- As the icing on the cake, disable the X and Z scaling transformation on the controller bones. Select each, go to the Transform Panel (N), and press the lock button near the X and Z sliders under Scale. Now, when you select any of these controller bones and press S, the scale is just applied on their Y axis, making the deforming ones stretch properly. Remember that the controller bones also work as expected when rotated (R). The next screenshot shows the locking applied:
- Enter into Edit Mode (Tab), select the Shoulder.L bone, hold Shift, and select both Shoulder.R and Spine3 (in this order; that's important). Press Ctrl + P and choose Keep Offset to make both shoulder controllers children of the Spine3 bone and disable its scale inheriting either through Shift + W or the Bone tab on the Properties panel.
When you finish setting these constraints and applying the rig to the mesh through weight painting, you can achieve something stretchy, as you can see in the next screenshot:
The file 002-SpineStretch-complete.blend has this complete recipe, for your reference in case of doubts.
How it works...
When creating spine rigs in Blender, there's no need to create lots of bones, since Blender allows us to logically subdivide each one to get soft and curved deformations. The amount of curved deformation can also be controlled through the Ease In and Ease Out sliders, and it also works well with stretching.
When you scale a bone on its local Y axis in Pose Mode, it doesn't retain its volume, thus the mesh deformed by it would be scaled without the stretching feeling. You must create controller bones to act as targets to the Stretch To constraint, so when they're scaled, the constrained bones will stretch and deform the mesh with its volume preserved.
You should notice that the spine controllers will be hidden inside the character's body when you turn off the armature's X-Ray property. Therefore, you need to create some custom shapes for these controller bones in order to make your rig more usable.
|Read more about this book|
(For more resources on Blender, see here.)
Rigging the pelvis
If you want your character to move like Elvis, you'd better pay attention to its pelvis. The technique we're going to see in this recipe is often called "inverted pelvis", and you'll understand why when you go through the next few paragraphs.
This approach is very useful to achieve more relaxed poses with your characters. The pelvis is usually the first bone in the spine chain and, because of the nature of the bone structure, its pivot point for transformation is not at the ideal position for the twist movement that we can do with the pelvis. That's because our actual center of gravity is closer to our belly button than it is to the base of the bone.
The next screenshot shows a balanced pose that is easier to achieve with this kind of setup:
How to do it...
- Open the file 002-Pelvis.blend from the support files. You'll see the character Otto with a basic deformation rig already applied as our starting point. If you select the D_Pelvis bone and rotate (R) it, you'll notice that the entire character moves along according to this transformation. That's because the pelvic bone is the parent of all other bones. What can we do to make him twist his pelvis to a more relaxed pose?
Since the armature's visualization mode is set to B-Bone, you'll see that all the spine bones are divided in segments in order to achieve a desirable curved deformation.
- Go to the armature's Edit Mode (Tab), select the D_Pelvis bone, press W, and choose Switch Direction. Go back to Pose Mode and try to rotate R and move G it again. Besides having a good pivot point for this bone's rotation, some problems arose from it: the deformations are ugly, the legs and other spinal bones are no longer its children, and most importantly, the nice curved B-Bone deformation between the pelvis and spine bone is gone! That's not what we want.
This second "wrong" step was intentional so that you can clearly understand what we need and what we must avoid.
What we need is: the pelvis pivot point must be on its joint to the D_Spine1 bone; a rotation on the pelvis or the spine must give the curved B-Bone deformations; the pelvis should be the parent of the legs and spine.
- Now you should reopen the source file (or hit Ctrl + Z a couple of times until you revert to the original file) so we can start over and make it the right way.
- With the original setup, enter the armature's Edit Mode (Tab), select the D_Pelvis bone, duplicate (Shift + D) it, and press Esc so it remains in its original position.
- Change its width (Ctrl + Alt + S) so we can see both bones and name it just Pelvis.
- Bring up the Specials Menu (W) and choose Switch Direction. Since this bone will act as a controller (thus not deforming the mesh directly), go to the Properties Window, under the Bone tab, change this bone's number of segments to 1 and disable its Deform property, as seen in the following screenshot:
- Still in Edit Mode, select the D_Pelvis bone, hold Shift, and select the Pelvis that you've just created. Press Ctrl + P to make it parent and choose Keep Offset.
- Now, you must select the D_Spine1 bone , go to the Properties Window, under the Bone tab, and disable both the Inherit Rotation and Inherit Scale option s.
- Go back to Pose Mode and rotate the Pelvis bone. Now you'll see that the spine doesn't rotate along, the center of gravity for rotation is near the belly button region and the soft curved B-Bones work as expected!
If you have already set up a stretchy spine as described in a previous recipe, you should now make the Pelvis bone parent of Spine1. You should also turn off Inherit Rotation for the bone Spine1, so the Pelvis bone acts like the torso's root bone for translation and still works correctly for the twist rotation.
You may wonder why the legs rotate along the pelvis, when they should remain still. This is because this pelvis setup needs an Inverse Kinematics (IK) constraint for the legs.
The file 002-Pelvis-complete.blend has this complete recipe for your reference.
How it works...
By using an inverted copy of the pelvic bone as a controller, we can set the pivot center of a rig around the belly button region. By inverting a copy, and not the original deformation bone, we can make sure that the soft curved deformations from Blender's B-Bones are applied as expected.
If you've just read the previous recipe, maybe you're wondering: what about stretching the pelvis?
Stretching the pelvis
Although our pelvic region doesn't stretch, it can be useful for cartoony rigs to have this option available. In order to do that, you must select the Pelvis bone, hold Shift, select D_Pelvis, press Ctrl + Shift + C, and select the Stretch To constraint, just like the process described in the previous recipe. You also need to disable the Inherit Scale property from the D_Pelvis and leg bones in the Bone tab under the Properties Window.
For a better view of the rig, you should also lock the X and Z scaling for the Pelvis bone under the Transform panel (N). This setup allows you to achieve distortions similar to what you see in the next screenshot:
The file 002-Pelvis-complete.blend is also set up for stretching. Try scaling the Pelvis bone and see for yourself!
Making your character breathe
When you animate a character, the main goal is to make it look alive, isn't it? All techniques involved in the art of animation, regardless of the medium (paper, computers, clay...) have the same goal: help you make the audience believe that your character is a living being.
It can be very useful to add a controller to make your character look like its breathing. Although the breathing by itself isn't going to make your character believable, it can be added as a layer of visual complexity, contributing to the mood of a scene. If your character is nervous, scared, or has just finished a sprint for instance, you should probably make the breathing more noticeable.
How to do it...
- Open the file 002-Breathe.blend. You'll see a character with a very basic rig and weight painting, and with a bone shaped like a pair of lungs, as seen in the next screenshot. This is our room to work, since adding bones and shapes is not our focus here.
- Select the Lungs bone, hold Shift, and select the D_Ribcage bone. Bring the constraints menu with Shift + Ctrl + C and select the Copy Scale constraint.
- Go to the Properties Window, under the Bone Constraints tab. You'll see that there are two constraints assigned to that bone: the first is a Stretch To constraint , which allows the bone to be scaled while maintaining its volume. The second constraint is the one you have just created, and allows this deformation bone to be scaled following the transformation applied to the Lungs bone. Now let's just change its values in order to get a proper controller.
- Disable the Y option, since our character's imaginary lungs are just going to inflate and deflate, and the scaling would be applied only in the horizontal plane.
- Make sure you also set the two values of Space to Local Space, and bring down the influence slider to a value like 0.3. This will allow you to make bigger changes in the Lungs scale and still get subtle results. The following screenshot shows the constraint setup:
- Repeat this process from steps 2 to 5 on the bone called D_Spine2, but use a lower value for the Influence slider , like 0.1. These values may be different on your own characters, but the principle here is that the distortion on the mesh would be bigger on the ribs part of the mesh, and smaller on the belly. But you should feel free to even invert this, if you seek a funnier effect.
Now, scaling (S) up and down the Lungs controller will make your character look like it's breathing. The file 002-Breathe-complete.blend has this finished recipe for your reference.
How it works...
The breathing controller is nothing more than a bone which sets horizontal scaling on the ribs and belly bones. The secret is to have different (and low) Influence values for the constrained bones. When you scale the controller up, the character looks like it's breathing in. You should use this controller as a secondary one, just for adding details on top of an existing animation.
In this recipe we saw something simple but important: more than one constraint can be applied to a bone at the same time. Not only that, but a bone can have multiple targets for its different constraints, making a rig considerably more complex as you add new constraints.
This example is based on a rig with more than one constraint applied to the spine bones, showing that a single bone can have its properties changed by different controllers. You must notice that the constraints are stacked, and this means that the order in which they are applied is important. In our example, the breathing would be applied after the stretching. Fortunately the order isn't important in this unique example, but you may be wary of stacking too many constraints, since the results can be hard to predict.
Controlling the neck and head
Our head movement can be broken down to basically two controllers: the head bone itself and the neck. It is possible to rotate the neck while keeping the head straight and vice-versa. For example, to move your head forward you have three options:
- You rotate just your head (like when you nod affirmatively to someone else's question).
- You rotate just your neck and keep your head up (like when you try to read those very tiny letters on a computer screen).
- You rotate both your neck and head (when you look to your belly button). You see these three positions in the following screenshot:
It is very useful in rigs to have the freedom to choose how your neck and head should behave when transforming their parent bones. You should be able, for example, bend your character's torso forward while keeping its neck and head looking forward, without inheriting their parents' rotation. This is often called hinge control. In this recipe we'll learn how to properly control the "hinge" property of the neck and head.
How to do it...
- Open the file 002-Neck.blend from the support files. You'll see the character Otto with a deformation already set and controller bones for its spine and pelvis, with support for stretching. There is also an interface called Hinge, with two controller bones already created. Everything up until here is covered in previous recipes, so you should take a look at them if you have any doubts on how to create the interface, pelvis, spine, or stretch controls.
The next screenshot shows our initial scene:
- The first thing we would do is set the hinge controller for the Neck bone. Select the Neck bone and go to the Properties Window, under the Bone tab. Right-click over its Inherit Rotation property and choose Add Driver. The checkbox field will get a pinkish hue.
As you noticed on the previous step, in Blender, even checkbox values can have drivers applied or have its on or off state animated through a keyframe. This is achieved by right-clicking over them and selecting the appropriate option. Since checkboxes can have only True or False values, Blender translates driver values as True=1 and every other value as False.
- Open a Graph Editor window and pick the Drivers mode on its header. Click over the Inherit Rotation (Neck) driver on the left-hand side panel to view its details on the Properties Panel (N) on the right-hand side. Find the Drivers section on the Properties Panel. Leave the driver type as Scripted Expression, but change the Expr field value from True to 1-var.
- On the box below the Add Variable button , set the Ob/Bone fields as Armature_Otto and Hinge_Neck. Leave the Type value as X Location and enable the Local Space checkbox. The next screenshot shows the driver and its values:
The Expr field has the value of 1-var, used to invert the mapping of the bone driver. That's useful here, where our default behavior is to have the bones to inherit the rotation of their parents. Having these default behaviors properly planned is important when you just want to reset your UI sliders with Alt + G and have the rig working on its default state.
- Repeat the process of steps 2 to 4 for the Head bone, making the driver for its Inherit Rotation property driven by the Hinge_Head bone .
- In front view, rotate the Rib bone to the side. Move the sliders for the hinge controls, and you'll have three possible situations, demonstrated in the next screenshot:
- Both head and neck follow the torso
- The head doesn't follow the neck and torso (it's "hinged")
- The neck (and consequently the head) is "hinged"
The file 002-Neck-complete.blend has this finished recipe for your reference.
How it works...
By adding drivers to the Inherit Rotation property of single bones, we can animate the "hinge" feature of the neck and head bones, allowing the animators to pose the characters with more freedom and flexibility. Blender 2.5 allows us to add drivers to user interface fields such as checkboxes, making it easier to animate the on/off state of virtually any feature in our rigs.
The ability to animate and drive checkboxes in Blender 2.5 makes it easier to control features that only have on/off states. In previous versions, that wasn't possible and the rigger would have to try emulating that particular feature with fairly complex constraint setups.
Not just the neck and head
You can use the same principle shown here to make hinge controllers for other parts of the body, notably the shoulders. When animating limbs with Forward Kinematics, it's often desirable a hinge setting in order to have more freedom when posing your characters.
In this article we learnt how to control things such as the pelvis, the neck, and how to stretch them in a cartoony way.
- Mastering the Blender 2.5 Basics [article]
- Introduction to Blender 2.5: Color Grading [article]
- Getting Started with Blender’s Particle System [article]
- Advanced Effects using Blender Particle System [article]
- Blender 2.5: Detailed Render of the Earth from Space [article]