Wednesday, May 14, 2014

Rigging tutorial 1

I have been teaching analytical geometry and low-poly modeling in local art school for three years now.
This is the english translation of the first part of a rigging tutorial I wrote. Other parts will follow as soon as I have time to translate them.

Introduction


This tutorial shows how to build very simple animation rig of humanoid character. The rig allows easy creation of walkcycle, articulating hands and fingers and adjusting eyes. Much more advanced rigs are normally used in serious animation, but we keep things simple so the general ideas and methods can be understood more clearly. Hopefully everyone is able to build on top of this tutorial to make the rig more powerful.
We start with a normal humanoid skeleton that is attached from COG. I.e. the rootmost bone is the center of gravity of the character, placed inside the body somewhere near belly button. Immediately from COG upper and lower body branch – the lower body starts from pelvis and upper from backbone.

Terms


  • Forward kinematics (FK) – an animation method were each bone is rotated (moved, scaled) individually by animator. Associated mesh then is deformed according to the weights. Forward kinematics is inconvenient for animating bone chains (e.g. limbs) because one has to adjust the rotation of each constituent bone in keyframes to keep the chain moving properly (for example keeping feet attached to ground).
  • Inverse kinematics (IK) – an animation method where additonal bones and constraints are added to skeleton so that instead of rotationg individual bones one can animate intuitive "handles" or "targets". Special constraints are added to a skeleton so other bones track the locations and rotations of "handles". When a target bone of a limb is moved all constituent bones of the limb bend so that the end is always automatically placed to the point specified by handle.
  • IK in narrow sense involves only automatic calculation of bone angles to keep an end at the place certain target. In wide sense it is often use synonymously to rigging thus including other rules and constraints. For example, a way to bend all fingers together by moving a single handle so that a hand of a model grabs certain object.

Rigging a skeleton


Rigging rules are added to skeleton by creating additional "virtual" bones and defining bone constraints. The latter can be specified individually to each bone from Bone constraints panel.

Bone constraints panel

Constraints used in this tutorial

  • Copy Location – the location (the origin of local coordinate system) of a bone is automatically moved to the location of some other bone (or object). If location offset is enabled the bone can still be moved by user – in such case the relative (animated) offset from the origin is preserved.
  • Copy Rotation – the rotation (the direction of the base vectors of local coordinate system) of a bone is automatically adjusted to coincide with the rotation of some other bone (or object). If offset rotation is enabled the bone can still be rotated by user.
  • Track To – the direction of a bone (the Y basis vector of local coordinate system) is directed to point to some other target bone (or object). In addition to the bone itself the up direction (the direction of Z basis vector) can be specified.
  • Inverse Kinematics – allows one to specify a chain of bones so that all it's bones rotate automatically to keep the end of the chain at specified target. Additionally the direction of bends (joints) can be specified by additional bone (or object).


Handles and targets of simple rig

Additional bones


To rig a skeleton we have to create several additional "bones" that are not bound to the mesh by weights. Instead some of them function as "handles" that intuitively define the movement of other skeletal bones. Others are only used internally by IK algorithms as specific targets of certain bones or chains.
The handles in our rig are:
  • Movement – specifies the horizontal placement of body in walkcycle
  • Base – allows on to switch on/off whether the body tracks Movement or not
  • IK Foot – specifiy the placement and direction of feet
  • IK Toe – rotate toes
  • IK Knee – specify the direction of knees
  • IK Hand – specify the location and direction of palms
  • IK Fingers – bends all fingers together
  • IK Elbow – specify the direction of elbows
  • IK Eyes – specifies the direction of both eyes

Movement and Base


Movement is a "virtual bone" that is used to give horizontal movement to walkcycle. I.e. if the length of the double-step is 1,5m and the character makes one double-step per second, Movement moves forward with uniform speed one meter per second. In starting and stopping animations Movement correspondingly accelerates or decelerates.
Moving character ahead in walkcycle is needed to ensure that the feet "stick" to ground and do not slide forward or backwards.
It is possible to create more advanced rigs where the "sticking" of feet is achieved by special constraints but in given tutorial we keep things simple.

Select the armature, enter Edit Mode, make all skeleton layers visible and make the display mode of bones to be octahedron.

Skeleton in Edit Mode

Armature panel

Movement will be the "handle" that changes the location of the whole skeleton. Thus we have to make it root bone (without parent).
Select the start of COG, switch to side view (NumPad 3) and create new bone (E), extruding it horizontally 1m to the back of the character. In my example it is coincident with COG.
Select the new bone (it's default name is  COG.001) and rename it to Movement.

Movement

Move it to the origin of coordinate system (Shift-S -> Cursor to Center, Shift-S -> Selection to Cursor)

Correctly placed Movement bone

This bone will move the whole character. To make it's role intuitively clear and to distinguish it from other bones we assign it a special shape.
Switch to Object Mode and activate some empty layer (for example the last one). Create a new cube (Add -> Mesh -> Cube).
If object is used as she shape of a bone, the virtual start of the bone is at the origin and the end is 1m along Y axis.
Enter Edit Mode and model the cube into 3D arrow that is placed exactly below XY plane.
NB! Do not move, scale or rotate the object in Object Mode. Only the mesh datablock is used as bone shape and thus transformations in Object Mode have no effect (but they make understanding the actual shape harder).

The shape of movement bone

Rename the object to Shape_Movement.
It is a good idea to rename "helper objects" according to some schema so they can easily be found in lists. In given tutorials the names of all shape objects start with Shape_, animation handles starts with IK_ (except Movement and Base) and IK targets start with Target_.
Switch to Object Mode, enable the layer where the armature is, select the armature and switch to Pose Mode. Now select Movement.

Bone Display panel

From the Display subpanel of Bone Properties panel chose the created object (Shape_Movement) in Custom Shape menu and enable Wireframe display mode.
Now Movement has the same shape as the created object in Pose Mode (in Edit Mode all bones are always shown using default shapes).

A new shape of Movement

The first animation handle is now complete.
If we now change the position of Movement in Pose Mode nothing happens. Before we can bind skeleton movement to it we have to create the next handle called Base.

Base is a virtual bone (handle) that makes it possible to switch the movement of the whole character on and off. It is needed to make the creation of walkcycle animations easier. Whenever we are fine-tuning the body movements during walkcycle we often want to keep the character at one place to ensure that the movement of bones are truly cyclical and smooth.
  • Movement – makes it possible to ensure that feet are "glued" to the ground.
  • Base – disables movement to make the whole animation smoothing easier

Create Base the same way as Movement and move it to the origin.

Base

NB! All bones have default shapes in Edit Mode and thus Movement and Base are completely coincident.
Create a custom shape object for Base – for example a small cube that is placed near the end of the bone (you can use Shape_Movement as reference to adjust the shape in Edit Mode). Rename this new object to Shape_Base.

Shape_Base

Specify Shape_Base as the custom shape of Base.

A new shape of Base

Base is not connected with the armature at moment and thus nothing happens if you move it around.

Next we create the first two constraints.
First we force COG to track the position of Base horizontally. Thus is Base moves during walkcycle, the origin of the skeleton moves together with it.

Select COG, open the Bone Constraints panel and add new constraint Copy Location.

Adding first constraint to COG

The color of COG changes to green, indicating that it has a constraint associated with it. The name field of the constraint is currently red. This indicates that the constraint is "invalid" as it's target is not specified yet.
NB! Target can be any object or a single bone from an armature. Currently we want it to be the bone Base so that COG to follows the location of it.

Chose the current armature object on Target field. A new field Bone appears. On that field chose Base.
Skeleton now "jumps" into the ground. This is because constraint was activated (it name field is now gray inidicating it is valid) and the location of COG was moved to the location of Base.(that should be at the origin).
We want COG to track only the horizontal position of Base. Thus we have to disable the Z checkbox on Copy Location panel. Skeleton now jumps to the correct location.
In addition we want to be able to manually adjust the location of COG during a walkcycle. It is needed because during a walkcycle Movement moves uniformly forward but the centre of body should swing slightly up-down, left-right and forward-backwards. To make this adjustment possible enable Offset checkbox so that only the relative movement of COG is added to the location copied from Base.

COG constraint panel

Confirm now that if Base is moved the whole skeleton moves together with it horizontally. Also we can move the skeleton separately by moving COG.

The first rigging constraint is now complete.

Next we add Copy Location constraint to Base and specify Movement as target.

Base constraint panel

As you probably do not want to move Base independently from Movement, keep X, Y and Z checked and do not enable Offset.

Confirm now that by moving Movement the whole skeleton moves along and Base cannot be moved separately anymore.

The forward movement can now be toggled on/off by enabling/disabling the Copy Location constraint of Base (small eye icon at the header of constraint panel).

Constraint enable/disable toggle

The handles and constraints moving the whole skeleton are now complete.

It is a good idea to move all rig handles to separate skeleton layer. Also all the bones that are not intended to be modified by user can be moved to separate layer so that they can be hidden during animation.

7 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. i like your article it was very informative keep doing informative and unique articles ..
    Qurbaan Hua
    molkki

    ReplyDelete
  3. http://www.jahannews.com/news/771453Mission Impossible" meaning "impossible" and refers to the possibility of the impossible

    ReplyDelete
  4. Today, the power of science and technology has become so great that few can stand against it. Digital currencies, or cryptocurrencies, are the technology and currency of the future. In this article, we try to talk about the importance of digital currency space and its purchase. ارز الون It is also important that we provide you with information about Alon digital currency.

    ReplyDelete
  5. Planning a vacation takes a lot of effort. Not only sound education but his alertness and dedication http://bsmt.ir/ too are most required

    ReplyDelete