CAP 211 - Interactive Design and Game Development

Chapter 40 - Adding Inverse Kinematics

Objectives:

This lesson concerns forward and inverse kinematics. Objectives important to this lesson:

  1. Forward and inverse kinematics
  2. IK methods
  3. Thresholds
  4. IK limb solvers
Concepts:

This lesson begins with definition of kinematics, and a joke about reverse kinematics. Kinematics is the study of motion. Forward kinematics deals with how a system moves, and the results of that motion. Inverse kinematics starts with a result, and deals with how a system must have moved to go from an initial state to that result. In the book's terms, forward kinematics predicts how a child in a hierarchy moves when its parent moves. Inverse kinematics deduces how the parent (and its parent) must have moved to place a child in a specific position.

In general, all systems in real life behave this way. If I move my arm to turn a door knob, I will move the entire arm hierarchy through forward kinematics, ending with the fingers that turn the knob. If I grab a child's hand to pull it away from a hot stove, I am also imposing inverse kinematic movement on the child's arm.

The concept of a linked hierarchy is important. The text turns to building a linked system.

  1. Just linking a series of objects is not enough.
  2. The second step is to move each child's pivot point to the center of the joint it shares with its parent.
  3. Next, on the Hierarchy panel, click the IK button.
    (The illustration of the IK rollouts on page 936 has been modified to fit the page. Remember that rollouts are all in a vertical arrangement.)
  4. Several settings still need to be made. They are discussed as the chapter moves on.

The text introduces the idea of a terminator, also called an end effector, a bone at which IK motion induced by a child stops. The text explains that you would not want a character's head to move if you pull its finger. Well, maybe. What if Batman bends the Joker's finger? You'd expect a full body reaction. What if the Hulk grabs a character's finger? Goes without saying, the whole body follows, or the finger comes off. The text is assuming a limited amount of force being applied, which would not be true in all animation. For some purposes, it will be useful to set auto termination to stop IK effects a set number of links from the child.

Joint Constraints - By default a joint is allowed to move through all axes. This is undesirable, for instance, for an elbow.

  • We can eliminate an axis on the Sliding Joints and Rotational Joints rollout by disabling the Active setting (on by default). An axis with Active deselected is said to be constrained.
  • We can limit the rotation on an axis instead by selecting Limited, and setting the limits of movement in the To and From values for the axis.
  • Ease makes movement toward a limit slow as it approaches the limit.
  • Spring Back sets a position within the limits that the the joint will use as a rest position.
  • Spring Tension sets the amount of resistance to moving from the rest position.
  • Damping sets the amount of resistance to moving a joint from any position.

A joint configuration can be copied from one to another. Joints can be mirrored from one side of the body to the other as well.

Objects can be bound to other objects, making them follow the other object when it is moved. This may be more useful for objects that are not linked. The Unbind button cancels a binding.

Objects in an IK system can be given precedence values to determine the order in which objects are solved. (By solved, Mr. Murdock means that 3DS Max determines what to do with the hierarchy.) By default, joints are assigned a precedence of 0. The higher the number, the greater the precedence of the joint. If you click the Child to Parent button for an object, the root object in its hierarchy is assigned 0, and each child level of the hierarchy away from the root is incremented by 10 (10, 20, 30...). If you click the Parent to Child button, the root is still assigned 0, but each child level is decremented by 10 (-10, -20, -30...).

Exercise Notes and Questions

Work through the exercises and turn in your answers to all questions below as part of the homework for this assignment.

Tutorial 1 (Controlling a backhoe) :

  1. Open the backhoe file as instructed.
  2. Open the Schematic View window, and create the hierarchy as indicated. You should have already seen the process for doing so in CAP 202, Lesson 11.
  3. Adjust the pivot points of the objects as instructed.
    Question 1: In general, how should each object in the hierarchy pivot?
  4. Step 4 tells you how to prevent an object in the hierarchy from moving at all.
    Question 2: Why is this a good idea for this exercise?
  5. Step 5 sets the parameters for the rest of the system.
  6. Test the backhoe as instructed.

The exercise above did not finish the tasks of adding IK to the backhoe. The text moves on to discuss the next steps, and builds toward another tutorial. The next thing we need for a linked chain of objects is an IK method. (Think of a method as a program logic module.) Two standard methods are listed: Interactive and Applied IK. The method used is linked to an IK Solver (more programming). Four solvers are listed: History Dependent (HD), History Independent (HI), IK Limb, and IK Spline.

Interactive IK is like keyframing. The next tutorial uses the Interactive IK method.

Tutorial 2 (Animating a simple IK propeller system):

  1. Open the indicated source file.
  2. The model has four parts that are not linked. Link them as instructed.
  3. Step 3 has many adjustments to make. Walk through them, trying not to leave anything out. Set the constraints on the handle, then copy them to the gear.
    Question 3: At the bottom of page 941, after pasting on the gear, you are told to select the shaft and click both paste buttons again. This is wrong. What should you do instead?
  4. Question 4: In step 4, you are told a quick way to move the time slider to the end of the timeline. What is it?

The text continues by discussing Applied IK, which computes many more keys than Interactive IK. They are created by the IK system which is bound to one or more follow objects in the scene.

This takes us to the discussion of solvers. The text uses the phrase goal object to denote the object in a chain that you position in a frame. We are told that an IK solver can be used to calculate the position of all linked objects based on the position of the goal object. Again, the discussion becomes quite esoteric without an example. We should move on to the next tutorial.

Tutorial 3 (Animating a puppet with the HI IK solver):

The HI IK solver is History Independent, which means it makes calculations for each keyframe independently of any others (history). When you build a hierarchy, you can set an IK solver to start and end at any two objects in the hierarchy. This is not necessary when creating a bones system, since IK solvers are added to bones automatically.

The text says "to animate an alligator" on page 945. I suspect this is a typo from updating the book to a new edition. (To me, the puppet in this exercise looks like a Hawaiian petroglyph character of a human, not an alligator.)

  1. Open the file as instructed.
  2. You are told to select the upper left arm. It would be nice if it were blue for left, but it isn't. Hover over the upper arm on the right side of your screen and wait for balloon help to confirm you are over the correct bone. Use the menu bar, as instructed to apply an IK solver to the arm.
  3. Repeat for the other arm and for each leg.
  4. Move the legs and arms as indicated.
    Question 5: What does the text mean by the goal for an IK chain?
  5. Create more movement at the timeframes indicated.
  6. Continue with the instructions.
  7. Play the animation. Save incrementally.

The HD IK solver is History Dependent, which means that it considers each previous keyframe before calculating a solution for the current frame. It creates smoother motion than the HI solver, but it takes more computing time.

Tutorial 4 (Animating a spyglass with the HD IK solver:

  1. Open the spyglass file.
  2. Enter the IK mode on the Hierarchy panel, and lock the largest tube down as instructed.
  3. Change the Sliding Joints and Rotational Joints parameters as indicated. Copy both Sliding and Rotational Joints.
  4. Paste the Sliding and Rotational Joint settings to each of the smaller tubes.
  5. Apply an HD Solver to the largest tube, linking to the dummy object.
  6. Set the Sliding Z Axis limit as indicated for the second largest tube. Copy the setting and paste on tubes 3, 4, 5, and 6.
  7. Enter Auto Key mode and animate as instructed.

The IK Limb Solver is meant to be used on arms and legs. It works on a chain of three bones. The first bone (e.g. a hip) is not meant to move, and the goal is set at the pivot point for the third bone. It assumes the first joint can rotate (like a hip or shoulder), and the second joint moves like a hinge (like a knee or elbow).

Tutorial 5 (Animating a character's arm with an IK Limb solver:

  1. Open the future man file as instructed.
  2. Select the left upper arm bone as instructed.
  3. Apply the IK Limb solver as instructed. Link to the left hand as instructed.
  4. Practice moving the hand as instructed.
    Question 6: What does the text call the hand at the end of this step? Why is it called that?

The last solver to consider is the Spline IK solver (or IK Spline solver), which is meant for tails. It could also be used for tentacles. It uses a long chain of bones and a spline for a path. Dummy objects are attached to control points on the spline to move the bones. To make this possible, you attach the Spline IK solver to the first and last bones in the chain, and to the spline.

Tutorial 6 (Building an IK Spline alligator:

  1. Open the alligator file as instructed.
  2. Select the first tail bone as instructed. Apply the Spline IK solver as instructed.
  3. Drag the line to connect the first tail bone to the last tail bone as instructed.
  4. Drag the second line to connect to the provided spline.
  5. Move the tail with the dummy objects attached to the spline.