From BlenderWiki

Jump to: navigation, search

If you want to document Blender 2.5 features please edit pages under Doc:2.5/Manual.
If a "2.5" page doesn't exist please copy the text from 2.4x Manual and edit the new page (i.e. you should paste the wikitext from this 2.4x page to this new 2.5x page and then update the latter with 2.5 features)


[edit] 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.

[edit] Rigging

To add the rigging:

Adding the first bone, an elbowless arm.
  • 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 of the bone is selected (yellow).
  • Place the other end of the armature in Gus's hand by grabbing (G) and moving the end, (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 end, you will notice that the whole bone gets bigger; you really are scaling up the bone.


Adding the second and third bones, a leg bone chain.
  • 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 end of the new bone to the knee area.
  • Now "chain" a new bone from the knee to the foot by CtrlLMB File:Template-LMB.png 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). This variation creates the new bone and places you in grab mode automatically. Use the LMB File:Template-LMB.png to then place the bone.
Bone 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.

The complete armature after duplicating and flipping.
  • Now place the cursor in the center and select all bones with A. Duplicate them with ⇧ ShiftD and exit grab mode with Esc. Make sure the cursor is selected as the rotation/scaling pivot. Flip the 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 Edit Buttons window should show an Armature Panel and Armature Bones Panel which contains the Armature controls (Armature panel and Armature Bones panel).

Armature panel.
Armature Bones panel.

Press the Draw Names button to see the names of the bones in 3D View, then LMB File:Template-LMB.png click on the names in the Edit Button window to change them to something appropriate like Arm.R, Arm.L, UpLeg.R, LoLeg.R, UpLeg.L and LoLeg.L, see (The Edit Buttons window for an armature). Exit EditMode with (⇆ Tab).

Naming Bones
It is very important to name your bones with a trailing '.L' or '.R' to distinguish between left and right ones, so that the Action editor will be able to automatically flip your poses.


[edit] Skinning

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 former are subject to the latter's movements.

  • In ObjectMode, select Gus's body, then ⇧ Shift select the armature so that the body is magenta and the armature is light pink.
  • Press CtrlP to parent the body to the armature. The (Parenting menu) will appear. Select the Armature entry.
Armature parented.
Parenting menu.
Create Vertex Group menu.
  • A new menu appears, asking if you want Blender to do nothing, create empty vertex groups, or create and populate vertex groups (Create Vertex Group menu). The last option is considered automatic skinning.


  • We'll use the automatic skinning option. Go ahead and select Create From Closest Bones. Now select just Gus's body and switch to EditMode (⇆ Tab). Notice in the Edit Buttons Window (F9) the presence of the "Vertex Groups" menu and buttons in the Link and Materials Panel, (The vertex groups buttons in the Edit Buttons window).
Update Note
With Blender v2.46, the option Create From Closest Bones is no longer available, use Create From Bone Heat instead.


The vertex groups buttons in the Edit Buttons window
The menu with the vertex groups automatically created in the skinning process.

By pressing the Menu Button a menu, with all available vertex groups, pops up --six in our case. But a truly complex character, with hands and feet completely rigged, can have tens of them! See (The menu with the vertex groups automatically created in the skinning process). The buttons Select and Deselect show you which vertices belong to which group.

Gus in EditMode with all the vertices of group Arm.R selected.
Select the Right arm group (Arm.R) and, with all vertices de-selected (A, if needed) press Select. You should see something like (Gus in EditMode with all the vertices of group Arm.R selected).

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 EditMode 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 use MMB File:Template-MMB.png, not LMB File:Template-LMB.png, to define the box, so that all vertices within the box become deselected.

Once the 'undesired' vertices are selected, press the Remove button (The vertex groups buttons in the Edit Buttons window) to eliminate them from 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).
The six vertex groups.

[edit] 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.

Other details
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 or otherwise joining the various parts to the body to make a single mesh. (We'll describe all of these options in detail in later Chapters).

[edit] Posing

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.

Mode menu in the 3D Window header.
  • Select the armature only, then select Pose Mode from the "Mode" Menu (Mode menu in the 3D Window header). This option only appears if 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!
You are in pose mode now!

[edit] Original position

Blender remembers the original position of the bones. You can set your armature back by pressing AltR to clear the rotation and AltG to clear the location. Alternatively, the Rest Position button may be used to temporarily show the original position.

[edit] Inverse Kinematics

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.

[edit] Forward Kinematics

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.

The current frame Num Button in the Buttons window Toolbar.
  • First, verify that you are at frame 1 of the timeline. The frame number appears in a NumButton on the right of the Buttons Window Toolbar (The current frame Num Button in the Buttons window Toolbar.). 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 UpLeg.L and bend LoLeg.L backwards while raising Arm.R a little and lowering Arm.L a little, as shown in Our first pose..
Our first pose.
Storing the pose to the frame.
  • 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 NumButton or by pressing . Then move Gus to a different position, like (Our second pose). Start with with clearing the rotation on both arms using AltR as mentioned earlier. From the top view, rotate Arm.R slightly forward and Arm.L slightly back. Finish the pose with his left leg forward and right leg backward, both slightly bent. Gus is walking in place!
Our second pose.
Pose menu
  • Select all bones again and press I to store this pose at frame 11.
  • 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 in 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 button 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 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 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.


Checking the animation
To preview your Animation, set the current frame to 1 and press ALT-A in the 3D window.

[edit] Gus walks!

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 Rendering Buttons (F10) and in the Anim panel, below the PLAY button, set the start frame (Sta:) to 1 (it is usually set to 1 by default so you probably won't need to change it) and set the end frame (End:) to 40 (it is set to 250 by default) (Setting the Rendering Buttons for an animation). Because frame 41 is identical to frame 1, we only need to render frames from 1 to 40 to produce the full cycle.
Setting the Rendering Buttons for an animation.
  • Select AVI Raw as the file type in Format Panel (Setting the Rendering Buttons for an animation.). While this is generally not the best choice, mainly for file size issues (as will be explained later on), it is fast and it will run on any machine, so it suits our needs. (You can 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 the ESC key.


Our scene is pretty simple, and Blender will probably render each of the 40 images in a few seconds. Watch them as they appear.

Stills
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 tab inside the Scene panel (F10).

You can play this file directly within Blender by pressing the Play button beneath the ANIM button (Setting the Rendering Buttons for an animation). 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!