Your First Animation in 30 plus 30 Minutes Part II
If we were going for a still picture, our work up to this point would be enough, but we want Gus to move! The next step is to give him a skeleton, or armature, which will move him. This is called the fine art of rigging. Gus will have a very simple rigging: four limbs (two arms and two legs) and a few joints (no elbows, only knees), but no feet or hands.
To add the rigging:
- In Object mode, set your 3D cursor where Gus’s shoulder is, and press Space » Add » Armature. A rhomboidal object will appear, which is a bone of the armature system. Enter Edit mode. The end, or tip, of the bone is selected (yellow).
- Now in Edit mode, place the tip of the bone in Gus’s hand by grabbing (G) and moving it, (Adding the first bone, an elbowless arm). We don’t need any other bones right now. You should now have one bone running from the shoulder to the hand area. As you move the tip, you will notice that the whole bone gets bigger – you really are scaling up the bone.
To make the process more successful, please periodically look at the Gingerbread man and armature from many different viewpoints to make sure the armature is inside the gingerbread man, just as bones are inside a human body. Skinning will fail if the bones are for example in front or in back of the body. Inspection from many different viewpoints is a common 3D model creation technique.
About Bones’ Ends
Bones’ ends can have different names. In Blender, currently they are called “head”/“tail” (the first being the “large” end, and the second the “thin” end). However, historically, they have been named “root”/“tip”, which is often considered somewhat less confusing…
- Stay in Edit mode, then move the cursor to where the hip joint will be and add a new bone (Space » Add » Bone).
- Grab (G) and move the yellow tip of the new bone to the knee area.
- Now “chain” a new bone from the knee to the foot by CtrlLMB clicking in the area of the foot. A new chained bone will appear automatically linked with the knee and ending at the foot, (Adding the second and third bones, a leg bone chain). Another way of chaining the new bone would be to extrude using the E shortcut. This variation creates the new bone and places you in grab mode automatically. Click LMB to validate the current bone’s tip position.
The bones we are adding will deform Gus’s body mesh. To produce a neat result, try to place the bone joints as shown in the illustrations.
We now have three bones that make up Gus’s armature.
- Now place the cursor in the center and select all bones with A. Duplicate them with ⇧ ShiftD and immediately exit grab mode with Esc. Make sure the cursor is selected as the rotation/scaling pivot (Pivot drop-down list in the 3D window header). Flip the duplicated bones along the X axis relative to the cursor with CtrlM and then X. You end up with (The complete armature after duplicating and flipping).
Once you’ve selected all of the bones (A), the Editing context of the Buttons window should show Armature and Armature Bones panels, which contain the armature controls (Armature panel and Armature Bones panel).
Press the Draw Names button (Armature panel) to see the names of the bones in 3D views, then LMB click on the names in the Armature Bones panel to change them to something appropriate like
LoLeg.L, see (Armature Bones panel). Exit Edit mode with ⇆ Tab.
It is very important to name your bones with a trailing “
Now we must make it such that a deformation in the armature causes a matching deformation in the body. We do this with skinning, which assigns vertices to bones so that the formers are subject to the latter’s movements.
- In Object mode, select Gus’s body, then ⇧ Shift select the armature so that the body is magenta and the armature is light pink.
- Now we need to parent the body to the armature. That is achieved by doing Space » Object » Parent » Make Parent... (or, alternatively, CtrlP). The (Parenting menu) will appear. Select the Armature entry.
- A new menu appears, asking if you want Blender to do nothing, create empty vertex groups, or create and populate vertex groups (the two last options, using different algorithms… see Create Vertex Groups menu). These two last options are considered automatic skinning.
- We’ll use Create From Bone Heat automatic skinning option. Now select just Gus’s body and switch to Edit mode (⇆ Tab). Notice in the Editing context (F9) the presence of the Vertex Groups group of controls in the Link and Materials panel (The vertex groups controls in the Editing context).
By pressing the “drop-down” button, a list with all available vertex groups appears – six in our case. But a truly complex character, with hands and feet completely rigged, will have tens of them! See (The menu with the vertex groups automatically created by the skinning process). The buttons Select and Deselect (de)select all vertices of the current selected group, which allows you to see which vertices belong to which group.
Select the right arm group (
Arm.R) and, with all vertices deselected (A, if needed), press Select. You should see something like (Gus in Edit mode with all the vertices of group
If you don’t see the same thing then you probably placed the bones in just the right place such that the auto skinning process did a better job of matching vertices with bones. It is highly unlikely that the skinning process matched the vertices to the bones as exactly as you may expect. This requires that you begin to manually adjust the grouping as described in the following sections.
The vertices marked with yellow circles in (Gus in Edit mode with all the vertices of group
Arm.R selected) belong to the deformation group, however, they should not.
The auto skinning process found that they were very close to the bone so it added them to the deformation group. We don’t want them in this group since some are in the head and some are in the chest, adding them to the deformation group would deform those body parts as well.
To remove them from the group, deselect all the other vertices, those which should remain in the group, using box selection (B), but with MMB , not LMB , to define the box, so that all vertices within the box become deselected.
Once only the “undesired” vertices are selected, press the Remove button (The vertex groups controls in the Editing context), to eliminate them from the group
Arm.R. Deselect all (A) then check another group. Check them all and be sure that they look like those in (The six vertex groups).
Be very careful when assigning or removing vertices from vertex groups. If later on you see unexpected deformations, you might have forgotten some vertices, or placed too many in the group. You can modify your vertex groups at any time.
Our deformations will affect only Gus’s body, not his eyes, mouth, or buttons, which are separate objects. While this is not an issue to consider in this simple animation, it’s one that must be taken into account for more complex projects, for example by parenting (to vertices) or otherwise joining the various parts to the body to make a single mesh (all these options are detailed in the manual).
Once you have a rigged and skinned Gus you can start playing with him as if he were a doll, moving his bones and viewing the results.
- Select the armature only, then select Pose Mode from the Mode menu (Mode menu in the 3D window header) – or simply hit Ctrl⇆ Tab. This option is only available when an armature is selected.
- The armature will turn blue. You are now in Pose mode. If you now select a bone it will turn cyan, not pink, and if you move it (G), or rotate it (R), the body will deform accordingly!
Blender remembers the original position of the bones. You can set your armature back by pressing AltR to clear the bones’ rotation, and AltG to clear their location. Alternatively, the Rest Position button may be used to temporarily show the original position.
Inverse Kinematics (IK) is where you actually define the position of the last bone in the chain, often called an “end effector”. All the other bones assume an algorithmic position, automatically computed by the IK solver, to keep the chain without gaps (i.e. IK will mathematically solve the chain positions for us). This allows a much easier and precise positioning of hands and feet using IK.
While handling bones in Pose mode, notice that they act as rigid, inextensible bodies with spherical joints at the end. You can grab only the first bone of a chain and all the others will follow it. All subsequent bones in the chain cannot be grabbed and moved, you can only rotate them, so that the selected bone rotates with respect to the previous bone in the chain while all the subsequent bones of the chain follow its rotation.
This procedure, called Forward Kinematics (FK), is easy to follow but it makes precise location of the last bone in the chain difficult.
We’ll make Gus walk, using FK, by defining four different poses relative to four different stages of a stride. Blender will do the work of creating a fluid animation.
- First, verify that you are at frame 1 of the timeline. The frame number appears in a numeric field on the right of the Buttons window header (The current frame numeric field in the Buttons window header). If it is not set to 1, set it to 1 now.
- Now, by rotating only one bone at a time (R), we’ll raise
LoLeg.Lbackwards while raising
Arm.Ra little and lowering
Arm.La little, as shown in (Our first pose).
- Select all bones with A. With the mouse pointer on the 3D window, press I. A menu pops up (Storing the pose to the frame). Select LocRot from this menu. This will get the position and orientation of all bones and store them as a pose at frame 1. This pose represents Gus in the middle of his stride, while moving his left leg forward and above the ground.
- Now move to frame 11 either by entering the number in the numeric field or by pressing ↑. Then move Gus to a different position, like (Our second pose). Start with clearing the rotation on both arms using AltR as mentioned earlier. From the top view, rotate
Arm.Rslightly forward and
Arm.Lslightly back. Finish the pose with his left leg forward and right leg backward, both slightly bent. Gus is walking in place!
- Select all bones again and press I to store this pose at frame 11, and select Rot.
- We now need a third pose at frame 21, with the right leg up, because we are in the middle of the other half of the stride. This pose is the mirror of the one we defined at frame 1. Therefore, return to frame 1 and, with all the bones selected, in the Pose menu of the 3D window header, select the Copy Current Pose entry, see (Pose menu). You have now copied the current pose to the buffer.
- Go to frame 21 and paste the pose with the Paste Flipped Pose option in the Pose menu, see (Pose menu). This will paste the cut pose, exchanging the positions of bones with suffix “
.L” with those of bones with suffix “
.R”, effectively flipping it!
The pose is there but it has not been stored yet! You must press I » Rot with all bones selected.
- Now apply the same procedure to copy the pose at frame 11 to frame 31, also flipping it.
- To complete the cycle, we need to copy the pose at frame 1, without flipping it, to frame 41. Do so by copying it as usual, and by using the Paste Pose entry. End the sequence by storing the pose with I » Rot.
Checking the animation
To preview your animation, set the current frame to 1 and press AltA in the 3D window.
The single step in-place is the core of a walk, and once you have defined one there are techniques to make a character walk along a complex path. But, for the purpose of our Quick Start, this single step in-place is enough.
- Change to the Scene context, Render sub-context (F10), and in the Anim panel, below the PLAY button, set the start frame (Sta) to 1 (it should already be at 1 by default) and set the end frame (End) to 40 (it is set to 250 by default, see Settings for an animation in the Render sub-context). Because frame 41 is identical to frame 1, we only need to render frames from 1 to 40 to produce the full cycle.
- Select AVI Raw as the file type in the Format panel (Settings for an animation in the Render sub-context). While this is generally not the best choice, mainly for file size issues, it is fast and it will run on any machine, so it suits our needs. You could also select AVI Jpeg to produce a more compact file. However, it uses lossy JPEG compression and will produce a movie that some external players might not be able to play.
Finally, press the ANIM button in Anim panel. Remember that all the layers that you want to use in the animation must be shown! In our case, these are layers 1 and 10.
Stopping a Rendering
If you make a mistake, like forgetting to turn layer 10 on, you can stop the rendering process with Esc.
Our scene is pretty simple, and Blender will probably render each of the forty images in a few seconds. Watch them as they appear.
Of course you can always render each of your animation frames as a still by selecting the frame you wish to render and pressing the RENDER button.
Once the rendering is complete you should have a file named
0001_0040.avi in a
render subdirectory of your current directory – the one containing your
.blend file. The directory can be changed from the Output panel.
You can play this file directly within Blender by pressing the PLAY button beneath the ANIM one (Settings for an animation in the Render sub-context). The animation will automatically cycle. To stop it press Esc. We have produced only a very basic walk cycle. There is much more in Blender, as you’ll soon discover reading its whole manual!