Lesson 20: Inverse Kinematics
Inverse Kinematics involves the use of special skeleton
hierarchies made up of joints. To create a character that uses the skeleton
as its deformation frame, you must learn how to set up and animate skeleton
joints. When learning to work with skeletons, remember that the joint hierarchy
can work in the opposite direction of a normal hierarchy. In other words,
information can be passed from lower nodes to upper nodes until a root
joint is reached.
IK skeletons let you control the movement of characters
easily, as well as rotations of the limbs of those characters. They also
form the underlying structure that later controls the skin deformation
of the characters.
In this lesson, you construct a basic biped skeleton.
You also learn to apply IK handles and set some joint limits. You then
apply keyframes to animate the movement of the skeleton and its limbs.
Initial Setup
For this example, you start with an empty workspace.
Set up a New workspace
- From the File menu, select New.
- Tumble the Perspective view window to see a more 3D view of the scene.
Draw a Skeleton
To start, you build a biped-like skeleton using efficient
construction techniques and shortcuts available to you in Alias.
Create the right biped leg
Select Objects
Draw Skeleton.
- Click the Grid button in the upper right of the menu bar to
toggle Grid snapping on.
- In the Front window, click at the origin to place the first skeleton
joint. This will form the skeleton's hip.
- Next, click one unit to the left of the first joint to place the right
hip joint.
Note: Since the model is facing us, our
left is the skeleton's right.
- Place the knee joint 2 units down from the hip joint, and the ankle
joint 2 units from the knee joint.

At this point, you have constructed most of one leg.
The next step is to construct the foot of the skeleton. To do this, you
place the next skeleton joint in the Right window.
- In the Right window, click one grid unit to the left of the ankle joint,
to place the "foot joint" of the skeleton.

Create the left biped leg
Select Pick
Object. Click-drag over or click on a joint of the constructed skeleton.
By using Pick
Object, you have now selected the top dag node of the skeleton (the
anchor node), which is the hip joint. Draw Skeleton draws joints
from the currently active dag node, which lets you draw off the hip to
construct the left leg.
Select Objects
Draw Skeleton. In the Front window, click one grid unit to the right
of the waist joint to place the left hip of the skeleton.
- Click two units down to place the left knee and two more units down
to place the left ankle.
- In the Right window, place the foot joint one grid unit to the left
of the ankle joint. Here's a Perspective view:

Construct the backbone of the character
- To select the hip of the biped skeleton node, press the Shift
key and select the UP arrow on the keyboard four times.
Note: Each time you select the UP arrow,
you move up one joint in the skeleton's hierarchy, allowing you to traverse
the skeleton quickly. To move down a skeleton joint level, use the DOWN
arrow. To select a joint at the same hierarchy level as the currently selected
joint, such as is the case with the hip joints, select the LEFT
and RIGHT arrows. These keys work for any dag node hierarchy.
Tip: If you get lost, select Pick
Nothing then Pick
Joint. Click the
top node of the skeleton to pick it. Both of the legs are highlighted.
Again, remember that you must click-drag over or directly on a joint.
- In the Front window, click to place three joints one grid unit apart
from each other to form the backbone of the character.

When you placed the first backbone joint, a bounding
box appeared around the three joints that branch off from the top node
of the hierarchy. This box helps to remind you that the bones leading to
these joints all share the same rotational values.
Construct the arms of the character
- With Draw skeleton still selected, click two grid units
to the left of the top joint in the backbone to form the right shoulder
joint.
- Click two grid units below the shoulder joint to form the elbow joint.
- Click another two grid units below the elbow joint to form the wrist
joint.

- Using the Shift-UP arrow shortcut, press the UP arrow three
times to move back up the skeleton's dag structure until the top of the
backbone is highlighted with dotted lines. Dotted lines indicate that the
selected joint is the parent joint to all the other selected joints.
- Repeat step 4 to create the skeleton's left arm using the same steps.

Construct the neck and head of the character
- Use the Shift-UP arrow shortcut to go up the character's skeleton
until you reach the top of the backbone. The top joint and the two arms
should be highlighted.
- In the Front window, click one grid unit up from the top of the backbone
to form the neck joint. Click another grid unit up from the neck joint
to form the "head" joint.
- In the Right window, click one grid square to the left of the last
joint to create a "nose" for the character. Construction of the
biped skeleton is now complete.

Modifying Skeletons
There are different ways to modify the skeleton. This
kind of adjustment is often necessary to reposition the joints to match
existing geometry better, or to change the overall proportions of the skeleton.
Turn off Grid snap and select right shoulder joint
- Click the Grid button to turn Grid snap off.
Select Pick
Nothing,
then select Pick
Joint. With the middle mouse button, click-drag in the Front window
over the two knee joints to pick them without picking any other joints.

Move the knee pivot points
Select Xform
Local
Set Pivot.
Click-drag with the middle mouse button in the Right window to move the
knee joints' pivot positions forward.
Note: When moving a joint with the Set
Pivot tool, you are only moving the joint and not any other part of
the skeleton.

Tip: In order to prepare the legs for IK,
it is important that they be a little "cocked." This means that
the rest position of the legs gives the IK solver information that will
help it analyze and interpret IK motion. Had you left the legs straight,
the IK solver would not know which direction to rotate.
Move the skeleton's elbow joint and arm
Select Pick
Nothing,
then select Pick
Joint. Pick the two elbow joints.
Select Xform
Move. Using the middle mouse button, click-drag in the Right window
to move the elbow joints back a little.

Note: When using the Move tool on
a joint, all the joint nodes below the elbow joint are also moved. This
is a quick way to re-adjust the positioning of a whole skeleton chain,
such as an arm or a leg chain.
Rotate the skeleton's right shoulder joint and arm
Select Xform
Rotate. Click-drag with the left mouse button in any window to rotate
the forearms up to around hip level.

Again, you have put a slight angle in the elbow joint
to assist the IK solver. Now the character seems almost poised for action,
which is better for the upcoming steps.
Note: When using the Rotate tool
on a joint, all the joint nodes below that joint are also moved. This is
a quick way to re-adjust the positioning of a whole skeleton chain, such
as an arm or a leg chain.
Move the whole Skeleton up
Select Pick
Object. Click on any of the skeleton's joints with the middle mouse
button to pick the whole hierarchy.
Select Xform
Move. Press the Alt key to temporarily turn on grid snapping
and click-drag up so that the character is standing with his feet on the
ground plane. The top node will be at (0, 0, 4).
- When you are finished, change the various view windows to get a better
view of the character.

The Rest Pose
In the last few steps, you have prepared the skeleton
joints for the IK solver. To preserve this pose in case you want to return
to it during an animation, you must set a rest pose. By default,
a rest pose is created when you first place down joints. However, after
moving and rotating the joints into new positions, you must set a new rest
pose.
The IK solver uses the rest pose as the reference
pose for its solution. As a result, different rest poses act differently.
Setting the Rest Pose
- With the skeleton picked, go to the Edit menu and select Set
rest pose. Now this position will be used by the IK solver.
Pose the character by rotating the joints
Select Pick
Nothing, then Pick
Joint. Click on one of the skeleton joints to pick it for
editing.
Select Xform
Rotate. Click-drag with the right mouse button to rotate the chosen
joint.
- Click on other joints and click-drag to rotate them into an interesting
pose.

Tip: One method of animating a skeleton
is to Rotate joints like this, then use Set keyframes on
the joint rotations. While this solution can be tedious on its own, it
is a useful method of applying secondary animation to a skeleton that also
uses IK chains.
Assuming the Rest Pose again
Select Pick
Object. Click on any of the skeleton's joints with the middle mouse
button to pick it.
- Go to the Edit menu and select Assume Rest Pose.
The character goes back to the rest pose that was set earlier.
IK Handles
While rotating joints enables you to create a pose
for a character, the steps involved often lead to a robot-like motion since
the limbs are not acting as complete appendages. By applying IK handles
to the skeleton, you can create IK solutions that let you animate various
body parts as interconnected limbs.
Add an IK handle to the left arm
- Select Pick
Nothing.
Select Objects
Add IK handle. Click the shoulder joint of the left arm to
make it the root of the IK chain.
- Next, click the hand joint of the left arm to make it the end effector
of the IK solution.

You have now applied a single chain IK solution to
the left arm. Connecting the Root and the End Effector is a yellow line
known as the Limb Axis line. This helps you determine the start and end
points of the IK chain.
Add an IK handle to the right arm
With Add IK handle
still selected, click the shoulder joint of the right arm to make it the
root of the IK chain.
- Click the hand joint of the right arm to make it the end effector of
the IK solution.

You have now applied a single chain IK solution to
the two arms. This way, you can animate them by manipulating the IK handles.
Move the IK handle
Select Xform
Move. Click-drag in the Right window to move the right arm's IK
handle. The IK handle lets you drag the arm. Because the single chain is
an analytical IK solution, the motion is fluid and predictable.

Click-drag in the Front window to see the effect in this view.
With nothing picked, select
Pick
IK handle.
With the middle mouse button, click the other IK handle.
Select Xform
Move and move it into a new position.

Re-assume the Rest pose
From the Edit menu, select Assume Rest Pose. The
left arm goes back to the rest pose.
Note: Because only part of the skeleton's
hierarchy was picked, only this part returned to the rest position.
Click the right arm's IK handle to pick it. Go to the Edit menu
and select Assume Rest Pose. The right arm goes back to the
rest pose.
More IK Handles
The arms use a single IK handle to control motion.
To control the legs, you can apply one IK chain from the hip to the ankle
and another from the ankle to the toe.
Add an IK handle to the left leg
- Select Pick
Nothing.
Select Objects
Add IK handle. Click the hip joint of the left leg to make
it the root of the IK chain.
- Next, click the ankle (not the toe) joint of the left leg to make it
the end effector of the IK chain.

Add an IK handle to the left foot
With Add IK handle
still selected, click the ankle joint of the left leg to make it the root
of the IK chain.
- Next, click the toe joint of the left leg to make it the end effector.

You have now applied a single chain IK solution to
the leg and the foot.
Move the IK handle
Select Pick
IK handle and click-drag a pick box with the middle mouse button
over the two IK handles.
Select Xform
Move. Click-drag
in the Right window to drag the end effectors belonging to the leg and
the foot.
Because you have used an extra IK handle on the foot,
notice how the foot maintains its angle with the ground. In the next lesson,
you will learn how to use constraints so that you can rotate the two IK
handles as if they make up a single foot.

Re-assume the Rest pose
From the Edit menu, select Assume Rest Pose. The
character goes back to the rest pose.
Repeat for the Right leg
Use Add IK handle
to add IK chains for the right leg and the right foot.

Setting Limits
While manipulating the IK handles, you may have noticed
that the elbow and the shoulder joints have a great deal of freedom. While
this freedom is preferable in most situations, you also have the ability
to restrict some of the motion by setting limits to some of the joints.
You can set limits to the knee or ankle joints which
lie within the IK chain. You can't, however, set limits to the hip joint,
which is the root joint. The root needs 360 degrees of freedom in all three
directions to solve properly.
Open the Skeleton editor
Select Pick
IK handle and click-drag a pick box with the middle mouse button
over the right leg's two IK Handles.
- With the right leg's IK handles picked, go to the Windows menu
and select Edit
Skeletons.... It opens with nothing displayed. This is because
only the handles are selected.
- From the Editor's List Type menu, select Handles.
The right leg's IK handles and all associated joints are shown. You may
need to click-drag on the divider bar to see all the names.

Note: The order of the listing of joints
may be different than what is shown.
- Double-click the IK handle name in the editor that contains two joints.
Change its name to ik_handle_rfoot. Use the same method to change
the other joint names (as shown in the following).

Set Limits on the right knee
To expand the spreadsheet listing for the right knee, click the button
with the three wavy curves. The various parameters are now visible.
Important
In order to set rotations, you must click the name
X rotate to highlight the row in white, as shown below.

Click in the Use Limits column along the X rotate row.
Notice that the Minimum and Maximum rotational
limits columns become un-grayed. This lets you type in values for the minimum
and maximum rotations directly or you can set them in a more interactive
manner.
Select Xform
Move. In the Right window, click-drag until you're satisfied with
the rotation of the knee.

Make sure that you have clicked on the name X rotate in the
Skeleton Editor to highlight it in white.
Tip: The name must be highlighted if you
want to set a value on the channel.
In the Skeleton editor's Set menu, select Maximum. This
places the current rotational value for the ankle into the minimum column
for the X rotation of the ankle.

With Move still selected, click-drag in the Right window
until the leg is outstretched.

Select Set
Minimum. This sets a minimum angle.

Test the motion of the leg
Select Xform
Move. In the Right window, click-drag to move the end effector.
Note: The knee will stop rotating when
it hits the maximum angle. You could also set limits for other joints.
You CANNOT set limits for the hip joint OR the ankle
joint because they are root joints and need at least a full 360 degrees
of motion.
Tip: You may find that the leg stops too
harshly and you don't want to use limits. In this case, simply make sure
that you don't create exaggerated leg positions while keyframing.
Re-assume the Rest pose
Go to the Edit menu and select Assume Rest Pose.
The character goes back to the rest pose.
Set Limits on the left knee
On your own, use the steps outlined above to now set limits on the
left knee. Don't forget to Assume Rest Pose after testing
the motion.
Close the Skeleton Editor.
Adding General Selection Handles
Before you begin animating the skeleton, you can
use a general type of selection handle to improve the upcoming workflow.
Since you are working with IK handles and joints, you would find
yourself switching back and forth between these two pick modes.
You can apply general selection handles to any dag
node. The advantage of this is you can use a single pick mode (Pick
Selection handles)
while keyframing to streamline the workflow.
Add a Handle to the top joint
Select Pick
Object. Click on any of the skeleton's joints with the middle mouse
button to pick the whole skeleton.
- From the Edit menu, select, New Selection handle.
A selection handle is placed at the skeleton joint.
Select Xform
Local
Move Selection
Handle. In the Perspective window click-drag with the left mouse
button to move along the X axis.

Tip: You can separate the handle from the
actual joint so that it is easier to see. This is not necessary but you
may find it easier to see the handles.
Add Handles to the IK Handles
Select Pick
Nothing, then select Pick
IK Handle. Click-drag a pick box over all the IK handles.
- From the Edit menu, select New Selection handle.
A selection handle is placed on top of each of the IK handles.

Note: It would seem that putting a selection
handle on an IK handle would be redundant. Now you can use the Generic
selection handles to pick both IK handles and joints using the same pick
mode.
Tip: If you want, you could use the Move
Selection handle tool to move the handles outside the character. For
now, leave them where they are.
Add Handles to other joints
With nothing picked, select
Pick
Joint. Click
the joint at the base of the neck.
From the Edit menu, select, New Selection handle.
Select Xform
Local
Move Selection
Handle. In the Front window click-drag to place the selection handle
just above the character's right shoulder.

Select Pick
Nothing, then select Pick
Object Types
Selection
handle. With the middle mouse button, click the different selection
handles to see how you can now pick both IK handles and joints with this
pick mode.
Animating the skeleton
The next part of this lesson involves animating the
skeleton so that it starts in a standing position and then sits down on
a bench.
Create and transform a primitive cube
Select Objects
Primitives
Cube.
In the Right window, press the Alt key and click the grid square
to the right of the character and one grid square above the ground line.

Select Xform
Nonp scale. Enter 6, 1.5 2 to scale the cube into a bench-like
shape.

Move the skeleton
With nothing picked, select
Pick
Object Types
Selection handle.
With the middle mouse button, click the selection handle that belongs to
the top node of the skeleton hierarchy.
Select Xform
Move. Click-drag in the Right window to move the hips to a sitting
position.

Oops! The whole body moved with the joint.
- From the Edit menu, select Undo.
Set Keyframes on the handles
Press the Shift key and the middle mouse button to click-drag
a pick box around all the selection handles to pick them.
Note: Because the current pick mode is
Selection handle, you can pick the handles by pressing the Shift
key while using the Move tool.
Make sure the Current frame is set to 0 in the time slider.
From the Animation menu, select Animation
Set keyframe. Keyframes are set for all
the handles at frame 0.
Move the skeleton again
Use the middle mouse button to click the selection handle belonging
to the top node of the skeleton hierarchy.
Select Xform
Move. Click-drag in the Right window to move the hips to a sitting
position.

With keyframes set, the IK chains can work backwards.
This lets you animate the body and have the arms and legs remain planted
in their keyframed positions.
Without setting new keyframes, enter 0 as the current frame
in the time slider to re-load this frame and reposition the character standing
up.
Animating the character
To animate the character, continue to set keyframes
on joints and IK handles. In this case, the character will look to the
left and right before extending hands and sitting down.
Rotate the shoulders and keyframe
- With the middle mouse button, click the selection handle belonging
to the middle of the shoulders.
- In the time slider, go to frame 2.
- From the Animation menu, select Set keyframe.
- In the time slider, go to frame 15.
Select Xform
Rotate. Click-drag with the right mouse button and rotate the shoulders
to the character's right.

- From the Animation menu, select Set keyframe.
- In the time slider, go to frame 30.
With Xform
Rotate still selected, click-drag with the right mouse button and
rotate the shoulders to the character `s left.

- From the Animation menu, select Set keyframe.
- In the time slider, go to frame 40.
With Xform
Rotate still selected, type 0 and press Enter to
rotate the shoulders back to a straight position.

- From the Animation menu, select Set keyframe.
These keyframes create a motion where the character
looks around the room before sitting down.
Sitting the character down
Now, set keyframes on the top node of the character
and on the IK handles themselves. Animate the character sitting down with
arms stretched back to break the fall.
Sit the character down and keyframe
- Use the middle mouse button to click the selection handle belonging
to the top node of the skeleton hierarchy.

- Make sure the time slider is set at frame 40.
- From the Animation menu, select Set keyframe.
- In the time slider, go to frame 75.
Select Xform
Move. In the Right window, click-drag the character into a sitting
position.

- From the Animation menu, select Set keyframe.
Lower the arms and keyframe
- While pressing the Shift key and the middle mouse button, click-drag
a pick box around two handles belonging to the character's arms.
- In the time slider, go to frame 38.
- From the Animation menu, select Set keyframe.
This will start the arm extension extending before the character starts
sitting.
- In the time slider, go to frame 65.
Select Xform
Move. In the Right window, click-drag the hands down to the bench
to help break the fall. This motion will also anticipate the sitting motion.

- From the Animation menu, select Set keyframe.
Playback the results
- Playback the motion in the time slider.
- Stop the playback when you are finished.
Adding Secondary movement
To complete the character animation, you should add
some outward rotation to the arms while they absorb the impact of the character's
sitting motion.
All IK chains lie on a plane that cannot, by default,
be rotated. You can now use the Information window to change the control
type of the IK handles and control other types of motion such as the rotation
of the plane.
Edit the Control type for the right arm
- Use the middle mouse button to pick the selection handle belonging
to the right arm's IK handle.
- From the Windows menu, select Information
Information window.... In this window, open the IK Handle info
section. You can see that the Handle Type is Single chain and the
root and end effectors are defined. Also, notice that
the Control Type is set to Translation Only. By default you
can only translate IK handles with no control over the Plane of the IK
solution. This makes IK easier to use but can limit the ability to achieve
certain types of motion.

- From the Control type pop-up in the Information window,
select Plane Rotation.

In the modeling views, a circle and a Plane Indicator
icon appear on the root of the IK chain. These new controls let you rotate
the plane of the IK chain using the left mouse button in combination with
the Rotate tool.
Note: The third Control Type is
called Plane/ Pole rotation. This Control Type lets you control
the chain's Pole Axis, which helps you deal with extreme types of motion
where the IK chain may flip. If you encounter flipping, then you can learn
more about this Control Type in Animating in Alias.
Edit the Control type for the left arm
- Repeat the steps outlined above to change the left arm's Control
Type to Plane Rotation.
- Close the Information Window.
Set Keyframes on the left arm
- In the time slider, go to frame 65.
- From the Animation menu, select Set keyframe.
Click Yes when asked to overwrite keyframes.
- In the time slider, go to frame 78.
Select Xform
Rotate. Click-drag with the left mouse button and rotate the left
arm until its plane is rotated out from the body.

- From the Animation menu, select Set keyframe.
Set Keyframes on the right arm
- Use the middle mouse button to again pick the selection handle belonging
to the right arm's IK handle.
- In the time slider, go to frame 65.
- From the Animation menu, select Set keyframe.
Click Yes when asked to overwrite keyframes.
- In the time slider, go to frame 78.
Select Xform
Rotate. Click-drag with the left mouse button and rotate the arm
until its plane is rotated out from the body.

- From the Animation menu, select Set keyframe.
Playback the results
Play back the motion in the time slider.
Save the work
From the File menu, select Save as and save the
file as sitting_01. This completes the basic
setup of a skeleton animation. If you don't like the motion, you can work
with the keyframe tangents in the action window or apply other keyframing
techniques to improve the quality of motion. Use this skeleton to explore
some of the keyframing possibilities.
Working with the Rest Pose
Before going to the next lesson, you should take
a closer look at how a skeleton's rest pose affects the quality of motion
generated by the single chain solution. Using two IK chains with different
rest poses, you can explore how rest poses affect the character's motion.
Delete the sitting man and open a new window
- From the File menu, select New.
- From the Layouts menu, select Front. Track the
view until the X axis line is near the top of the window.
Draw a skeleton chain
Select Objects
Draw Skeleton.
- Press the Alt key to use grid snapping and place four joints
as shown below:

Add an IK handle
Select Objects
Add IK handle.
Click the top joint of the chain first (the root), then on the last
joint (the end effector).

Comparing Rest positions
The sitting man's IK chains only contained one internal
joint. In this example an extra joint is added to show how a chain that
spans three bones reacts to its rest position. In the earlier example,
the IK chains only spanned two bones and the rest position has less influence
on the final result. The rest position is most important with a chain that
spans three or more bones.
You'll now move the IK handle on this bone, then
duplicate it to create different rest positions. Each will create a different
kind of motion when animated.
Move the IK handle
With the IK handle active,
select Xform
Move
and click-drag to move the handle.
Note: The lowest joint moves but the middle
joints are locked up. This is because the rest position doesn't include
any rotation, so the IK chain can't decide which direction to go.

- From the Edit menu, select Assume Rest Pose.
Change the knee joint on the skeleton
Select Pick
Joint and with the middle mouse button click the second joint
from the top of the chain.
Select Xform
Local
Set
Pivot and click-drag with the middle mouse button to move the joint
to the left. 
Note: Since Set Pivot does not affect
joint rotation, you don't need to set a new rest position. The rest position
must only be reset if the joints have been rotated by either the Rotate
tool or a dragged IK handle.
Move the IK handle again
Select Pick
IK handle and use the middle mouse button to pick the handle.
Select Xform
Move and click-drag to move the handle. Note:
This chain now bends at the upper joint in an appropriate way. At the
same time, the lower joint remains fairly rigid because it is locked by
its rest position.

- From the Edit menu, select Assume Rest Pose.
Duplicate the skeleton
Select Pick
Object and with the middle mouse button, click the top joint
of the chain.
- From the Edit menu, select Duplicate object.
Select Xform
Move. Using the middle mouse button, click-drag to move the
chain to the right.
Change the knee joint on the second skeleton
Select Xform
Rotate. Using the middle mouse button, click-drag
to rotate the joint up.
Press the Shift and the Down arrow buttons to
move the lower joint. Rotate this joint. Do the same for
the other joints until the skeleton appears as follows:

Select Pick
Object. With the middle mouse button, click the top joint
of the duplicated leg.
From the Edit menu, select Set Rest Pose. Since
the skeleton was edited using the Rotate tool, a new rest
position has to be set.
Move the IK handle
Select Pick
IK handle. With the middle mouse button, pick the IK handle
on the duplicated leg.
Select Xform
Move and click-drag to move the handle to its old position
near the bottom of the window. This chain has more rotation on the ankle
joints.
Animating the two IK Chains
The best way of comparing the results of changing
the rest positions is to animate the two chains and compare their motion.
Set Keyframes on the two chains
Select Pick
IK handle. With the middle mouse button, click-drag over
the two IK handles.
- In the time slider, go to frame 0.

- From the Animation menu, select Set keyframe.
- In the time slider, go to frame 30.
- From the Animation menu, select Set keyframe.
- In the time slider, go to frame 15.
With Xform
Move, drag the two IK handles into a new position.

- From the Animation menu, select Set keyframe.
Preview the Results
- In the time slider, select Min/Max as the preview range.
- Press the Play button to preview the motion. You
will see that the first solution is locked just above the end effector
while the second solution has more rotational freedom.

By setting different rest poses, you can change how
the IK chain solves. This in turn affects the quality of the resulting
motion. While no one solution is particularly better than another, you
may want to test several rest poses to find the one that best suits the
particular animation needs.
aliasdocs@aw.sgi.com
Copyright © 1997, Alias|Wavefront, a Silicon Graphics Company.
All rights reserved.