CHAPTER 38

Understanding Rigging, Kinematics, and Working with Bones

IN THIS CHAPTER

Creating a rigging workflow

Understanding forward and inverse kinematics

Using interactive and applied IK methods

Setting thresholds in the Inverse Kinematics panel of the Preference Settings dialog box

Learning to work with the HI, HD, and IK Limb solvers

Building a bones system

Setting bone parameters and IK Solvers

Making linked objects into a bones system

What does a graveyard have in common with animated characters? The answer is bones. Bones are used as an underlying structure attached to a character that is to be animated. By using a bones structure, you can produce complex character motions by simply animating the bones and not having to move all the vertices associated with a high-resolution character.

Although Max includes a prebuilt skeleton with its Biped and CAT systems, at times you may want to build a custom bones system because not all characters stand on two feet. Have you ever seen a sci-fi movie in which the alien was less than humanlike? If your character can't be created by modifying a biped, then you need to use the traditional manual methods of rigging.

This chapter focuses on the process of manually rigging a character that, depending on the complexity of your character, could end up being even easier than working with bipeds. It also gives you a clear idea of concepts of rigging.

This chapter also presents the idea of kinematics. Kinematics is a branch of mechanics that deals with the motions of a system of objects, so inverse kinematics is its evil twin brother that deals with the non-motion of a system of objects, right? Well, not exactly.

In Max, a system of objects is a bunch of objects that are linked together. After a system is built and the parameters of the links are defined, the motions of all the pieces below the parent object can be determined as the parent moves, using kinematics formulas.

Inverse kinematics (IK) is similar, except that it determines all the motions of objects in a system when the last object in the hierarchy chain is moved. The position of the last object, such as a finger or a foot, is typically the one you're concerned with. With IK, you can use these solutions to animate the system of objects by moving the last object in the system.

Creating a Rigging Workflow

A rigged character starts with a linked hierarchy. A linked hierarchy attaches, or links, one object to another and makes it possible to transform the attached object by moving the one to which it is linked. The arm is a classic example of a linked hierarchy: When the shoulder rotates, so do the elbow, wrist, and fingers. Establishing linked hierarchies can make moving, positioning, and animating many objects easy.

A bones system is a unique case of a linked hierarchy that has a specific structure. You can create a structure of bones from an existing hierarchy, or you can create a bones system and attach objects to it. A key advantage of a bones system is that you can use IK (inverse kinematics) Solvers to manipulate and animate the structure. These IK Solvers enable the parents to rotate when the children are moved. In this way, the IK Solver maintains the chain integrity. Another advantage of a bones structure is that you can constrain the motion of bones so the motion is forced to be realistic, just like a real character.

After the bone structure is created, it needs to be edited to fit the skin mesh that it will control. You also need to define the limits of each bone and joint. This helps prevent the skeleton from moving in unrealistic ways. Applying IK systems is another way to control the motion of the bones and joints. This process of creating a skeleton structure and defining its limits is called rigging.

After you've edited a system of bones, you can cover the bones with objects that have the Skin modifier applied. This modifier lets the covering object move and bend with the bones structure underneath. The process of attaching a model to a bones system is called skinning.

Cross-Reference

The Skin modifier is covered, along with other aspects of skinning a character, in Chapter 40, “Skinning Characters.”

After a character is rigged and skinned, the character is ready to be animated.

Building a Bones System

In some instances, establishing a hierarchy of objects before linking objects is easier. By building the hierarchy first, you can be sure of the links between objects. One way to build this hierarchy is to use a bones system. A bones system consists of many bone objects that are linked together. These bone objects are normally not rendered, but you can set them to be renderable, like splines. You can also assign an IK Solver to the bones system for controlling their motion.

To create a bones system, select Create image Systems image Bones IK Chain, click in a viewport to create a root bone, click a short distance away to create another bone, and repeat this a few more times. Each subsequent click creates another bone linked to the previous one. When you're finished adding bones, right-click to exit bone creation mode. In this manner, you can create a long chain of bone objects all linked together.

These bones are actually linked joints. Moving one bone pulls its neighbors in the chain along with it. Bones can also be rotated, scaled, and stretched. Scaling a bones system affects the distance between the bones.

Caution

Bones should never be scaled without the XForm modifier applied, or all animation keys will behave erratically.

To branch the hierarchy of bones, simply click the bone where you want the branch to start while still in bone creation mode. A new branching bone is created automatically. Click the Bones button again to create a new bone. Then continue to click to add new bones to the branch.

Figure 38.1 shows the rollouts that are available for creating bones.

FIGURE 38.1 The Bone rollouts let you specify which bones get assigned an IK Controller.

image

Assigning an IK Solver

When you first create a bone chain in the IK Chain Assignment rollout of the Create panel, you can select from four IK Solvers: History Dependent, IKHISolver, IKLimb, and SplineIK Solver. You can assign each of these solver types to children and to the root bone using the available options. You need to select both the Assign to Children and the Assign to Root options to assign the IK Controller to all bones in the system. If the Assign to Children option is deselected, then the Assign to Root option is disabled.

Note

Each of these IK Solvers is presented later in this chapter.

Setting bone parameters

The Bone Parameters rollout (also in the Modify panel) includes parameters for setting the size of each individual bone, including its Width and Height. You can also set the percentage of Taper applied to the bone.

Tip

Because bones are simple geometry objects, you can apply an Edit Poly modifier to it and edit the bone shape to be whatever you'd like. Custom bone geometry doesn't always work with the Bone Tools.

Fins can be displayed on the front, back, and/or sides of each bone. For each fin, you can specify its size and start and end taper values. Including fins on your bones makes correctly positioning and rotating the bone objects easier. Figure 38.2 shows a simple bones system containing two bones. The first bone has fins.

FIGURE 38.2 This bone includes fins that make understanding its orientation easier.

image

At the bottom of the Bone Parameters rollout is an option to Generate Mapping Coordinates. Bones are renderable objects, so this option lets you apply texture maps to them.

Tutorial: Creating a bones system for an alligator

To practice creating a bones system, you'll take a trip to the Deep South to gator country. The main movement for this gator is going to be in its tail, so you need the most bones there. The front legs are smaller and can be controlled with only two simple bones. You also won't worry about fingers.

To create a bones system for an alligator, follow these steps:

  1. Open the Alligator bones.max file from the Chap 38 directory on the CD.

    This file includes an alligator model created by Viewpoint Datalabs.

  2. Select Create image Systems image Bones IK Chain, and in the IK Chain Assignment rollout, select IK Limb from the IK Solver drop-down list. Then set the Width and Height values to 10 and enable all the bone fins and set their Size to 5.
  3. In the Top viewport, click once at the pelvis and then again at the mid-abdomen, the base of the neck, and the end of the nose. Then right-click to end the bones chain.
  4. While still in Bones mode, click below the pelvis and create an additional five bones to define the tail. Then right-click to end the chain. Select the first bone in the tail chain and link it to the first joint with the Select and Link tool that moves from the pelvis to the nose, which is the root joint.

    Tip

    If you can't see the bones to make the link, then hide the body so the bones are clearly visible.

  5. Click on the Bones button in the Create panel, select the bone just in front of the legs in the Top viewport (the cursor changes to a cross-hair when it is over a bone), and drag to the top to form the left shoulder, left upper-arm and left lower-arm bones. Right-click to end the chain. Repeat to create bones for the left leg.
  6. Select the Animation image Bone Tools menu command to open the Bone Tools dialog box. Select all the bones in the left arm and leg and click the Mirror button. In the Bone Mirror dialog box, select the Y-axis and click OK.
  7. Click the Select Objects button on the main toolbar to exit Bones mode, and select and name each bone object so it can be easily identified later.

Tip

The Schematic View window is a good interface for quickly labeling bones.

Figure 38.3 shows the completed bones system for the alligator.

FIGURE 38.3 This bones system for an alligator was easy to create.

image

Using the Bone Tools

After you've created a bones system, you can use the Bone Tools to edit and work with the bones system. You access these tools from a panel that is opened using the Animation image Bone Tools menu command. Figure 38.4 shows this panel of tools, which includes three separate rollouts: Bone Editing Tools, Fin Adjustment Tools, and Object Properties.

FIGURE 38.4 The Bone Tools palette includes several buttons for working with bones systems.

image

Reordering bones

You can use the transform buttons on the main toolbar to move, rotate, and scale a bone along with all its children, but if you want to transform the parent without affecting any of the children, you need to open the Bone Tools panel using the Animation image Bone Tools menu command. Bone Edit Mode lets you move and realign a bone without affecting its children.

Clicking the Remove Bone button removes the selected bone and reconnects the bone chain by stretching the child bone. If you hold down the Shift key while removing a bone, the parent is stretched. Clicking the Delete Bone button deletes the selected bone and adds an End bone to the last child.

Caution

Using the Delete key to delete a bone does not add an End bone, and the bone chain does not work correctly with an IK Solver.

If a bone exists that isn't connected to another bone, you can add an End bone to the bone using the Create End button. The bone chain must end with an End bone in order to be used by an IK Solver.

The Connect Bones button lets you connect the selected bone with another bone. After clicking this button, you can drag a line from the selected bone to another bone to connect the two bones.

Use the Reassign Root button to reverse the chain and move the End bone from the parent to the last child.

Refining and mirroring bones

As you start to work with a bones system that you've created, you may discover that the one long bone for the backbone of your monster is too long to allow the monster to move like you want. If this happens, you can refine individual bones using the Refine button. This button appears at the bottom of the Bone Tools section of the Bone Editing Tools rollout.

Clicking the Refine button enables you to select bones in the viewport. Every bone that you select is divided into two bones at the location where you click. Click on the Refine button again to exit Refine mode.

The Mirror button lets you create a mirror copy of the selected bones. This button makes the Bone Mirror dialog box appear, where you can select the Mirror Axis and the Bone Axis to Flip. You also can specify an Offset value. In the previous example, you created arms and legs manually, but you could have created one of them and used the Mirror button to create its opposite.

Coloring bones

Bones, like any other objects, are assigned a default object color, and materials can be applied from the Material Editor. For each separate bone, its object color can be changed in the Modify panel or in the Bone Tools panel.

You can also apply a gradient to a bone chain using the Bone Tools palette. This option is available only if two or more bones are selected. The Start Color is applied to the chain's head, and the End Color is applied to the last selected child. The colors are applied or updated when the Apply Gradient button is clicked. Figure 38.5 shows a long, spiral bone chain with a white-to-black gradient applied.

FIGURE 38.5 A white-to-black gradient was applied to this spiral bone chain.

image

Adjusting fins

The Fin Adjustment Tools rollout includes the same parameters as those found in the Bone Parameters rollout. You can specify the dimensions and taper of a bone and its fins. But you can also specify that the parameters are applied using Absolute or Relative values. Relative values are based on the parameters of the bone that is above the current bone in the chain.

This rollout also includes Copy and Paste buttons that you can use to copy the bone parameters from one bone to another.

Making objects into bones

You can make any object act like a bone. To make an object into a bone, you need to open the Object Properties rollout in the Bone Tools panel. The Object Properties rollout includes a setting for Bone On. If enabled, the object acts like a bone. When the Bone On/Off option is enabled, the remaining Bone controls become available. The Auto-Align option causes the pivot points of adjacent bones to be aligned automatically. The Freeze Length option causes a bone to keep its length as the bones system is moved. If the Freeze Length is disabled, you can specify a Stretch type. None prevents any stretching from occurring, and Scale changes the size along one axis, but Squash causes the bone to get wider as its length is decreased and thinner as it is elongated. You can also select to stretch an axis and choose whether to Flip the axis.

You can use the Realign button to realign a bone: click the Reset Stretch button to normalize the stretch value to its current value.

Forward Kinematics versus Inverse Kinematics

Before you can understand IK, you need to realize that another type of kinematics exists: forward kinematics. Kinematics solutions work only on a kinematics chain, which you can create by linking children objects to their parents.

Cross-Reference

Chapter 9, “Grouping, Linking, and Parenting Objects,” covers linking objects and creating kinematics chains.

Forward kinematics causes objects at the bottom of a linked structure to move along with their parents. For example, consider the linked structure of an arm, where the upper arm is connected to a forearm, which is connected to a hand, and finally connected to some fingers. Using forward kinematics, the lower arm, hand, and fingers all move when the upper arm is moved.

Having the linked children move with their parent is what you would expect and want, but suppose the actual object that you wanted to place is the hand. IK enables child objects to control their parent objects. So, using IK, you can drag the hand to the exact position you want, and all other parts in the system follow.

Forward kinematics in Max involves simply transforming linked hierarchies. When you move, rotate, or scale a linked hierarchy, the children move with the parent, but the child object also can be transformed independent of its parent.

Creating an Inverse Kinematics System

Before you can animate an IK system, you need to build and link the system, define joints by positioning pivot points, and define any joint constraints you want.

Building and linking a system

The first step in creating an IK system is to create and link several objects together. You can create links using the Link button on the main toolbar.

With the linked system created, position the child object's pivot point at the center of the joint between it and its parent. For example, the joint between an upper and lower arm would be at the elbow, so this is where the pivot point for the lower arm should be located.

Cross-Reference

Chapter 9, “Grouping, Linking, and Parenting Objects,” covers creating linked systems, and Chapter 7, “Transforming Objects, Pivoting, Aligning, and Snapping,” covers moving pivot points.

While creating the linked system, you can select the IK Solver in the Create panel, and later after correctly positioning your pivot points, you can access the IK parameters in the Hierarchy panel by clicking the IK button. Several rollouts open that let you control the IK system, including the Object Parameters rollout shown in Figure 38.6.

FIGURE 38.6 The IK rollouts let you control the binding of an IK system.

image

Selecting a terminator

Because child objects in an IK system can cause their parents to move, moving a child could cause unwanted movements all the way up the system to the root object. For example, pulling on the little finger of a human model could actually move the head. To prevent this, you can select an object in the system to be a terminator.

A terminator is the last object in the IK system that is affected by the child's movement. Making the upper arm a terminator prevents the finger's movement from affecting any objects above the arm.

To set a terminator, select an object and enable the Terminator option in the Object Parameters rollout.

For Interactive IK mode, you also can enable the Auto Termination option included in the Auto Termination rollout. The Number (#) of Links Up value sets the terminator a specified number of links above the current selection.

Defining joint constraints

The next step is to define the joint constraints, which you specify in the Sliding Joints and Rotational Joints rollouts. The availability of these limits depends on the selected IK Solver and its options. By default, each joint has six degrees of freedom, meaning that the two objects that make up the joint can each move or rotate along the X-, Y-, or Z-axis. The axis settings for all other sliding and rotational joints are identical. Defining joint constraints enables you to constrain these motions to prevent unnatural motions, such as an elbow bending backward. To constrain an axis, select the object that includes the pivot point for the joint, locate in the appropriate rollout the section for the axis that you want to restrict, and deselect the Active option. If an axis's Active option is deselected, the axis is constrained. You also can limit the motion of joints by selecting the Limited option.

When the Limited option is selected, the object can move only within the bounds set by the From and To values. The Ease option causes the motion of the object to slow as it approaches either limit. The Spring Back option lets you set a rest position for the object; the object returns to this position when pulled away. The Spring Tension sets the amount of force that the object uses to resist being moved from its rest position. The Damping value sets the friction in the joint, which is the value with which the object resists any motion.

Note

As you enter values in the From and To fields, the object moves to that value to show visually the location specified. You also can press and hold the left mouse button on the From and To values to cause the object to move temporally to its limits. These settings are based on the current Reference Coordinate system.

Copying, pasting, and mirroring joints

Defining joint constraints can be lots of work—work that you wouldn't want to have to duplicate if you didn't have to. The Copy and Paste buttons in the Object Parameters rollout enable you to copy Sliding Joints or Rotational Joints constraints from one IK joint to another.

To use these buttons, select an IK system and click the Copy button; then select each of the joints to be constrained in a similar manner, and click the Paste button. You also have an option to mirror the joints about an axis. It is useful for duplicating an IK system for opposite arms or legs of a human or animal model.

Binding objects

When using applied IK, you need to bind an object in the IK system to a follow object. The IK joint that is bound to the follow object then follows the follow object around the scene. The bind controls are located in the Hierarchy panel under the Object Parameters rollout. To bind an object to a follow object, click the Bind button in the Object Parameters rollout and select the follow object.

In addition to binding to a follow object, IK joints also can be bound to the world for each axis by position and orientation. This causes the object to be locked in its current position so it won't move or rotate along the axis that is selected. You also can assign a Weight value. When the IK computations determine that two objects need to move in opposite directions, the solution favors the object with the largest Weight value.

The Unbind button eliminates the binding.

Understanding precedence

When Max computes an IK solution, the order in which the joints are solved determines the end result. The Precedence value (located in the Object Parameters rollout) lets you set the order in which joints are solved. To set the precedence for an object, select the object and enter a value in the Precedence value setting. Max computes the object with a higher precedence value first.

The default joint precedence for all objects is 0. This assumes that the objects farthest down the linkage move the most. The Object Parameters rollout also includes two default precedence settings. The Child to Parent button sets the precedence value for the root object to 0 and increments the precedence of each level under the root by 10. The Parent to Child button sets the opposite precedence, with the root object having a value of 0 and the precedence value of each successive object decreasing by 10.

Tutorial: Controlling a backhoe

As an example of a kinematics system, you start with a backhoe, which is a simple linkage system with tracks that can move forward, a chair housing that can rotate independently, and an arm and bucket that can rotate about a pivot. When you're finished with this tutorial, you can take the backhoe out and dig a hole for a swimming pool. I think you deserve it.

To create an inverse kinematics system for a backhoe, follow these steps:

  1. Open the Backhoe.max file from the Chap 38 directory on the CD.
  2. Open the Schematic View window with the Graph Editors image New Schematic View menu. Click the Connect button, and connect the tracks to the base plate, the base plate and the housing to the base cylinder, the bucket to the arm, and the arm to the housing. The connections should look like those in Figure 38.7.

    Cross-Reference

    You can learn more about the Schematic View window in Chapter 25, “Building Complex Scenes with Containers, XRefs, and the Schematic View.”

    FIGURE 38.7 The Schematic View window is helpful for linking hierarchies.

    image

  3. Next, you need to define the pivots for the objects that can rotate. Select the housing, and notice that its pivot is already located in the center of the base cylinder where it should be. Then select the arm, open the Hierarchy panel, and click the Pivot button. Click the Affect Pivot Only button, and move the pivot to the center of the cylinder that connects it to the housing. Then do the same for the bucket. Click the Affect Pivot Only button again to exit pivot-editing mode.
  4. The next step is to define the joint constraints for the system. Open the Hierarchy panel, and click the IK button. In the Object Parameters rollout, select the base cylinder and enable the Terminator, Bind Position, and Bind Orientation options; doing so prevents the base cylinder from moving anywhere. In the Rotational Joint rollout, deactivate all the axes.
  5. Select the housing object, and enable the Bind Position axes and the X and Y Orientation axes. Then disable the X and Y Rotation axes. Select the arm object, and enable all the Bind Position axes and the X and Z Orientation axes. Then disable the X and Z Rotational axes. Click the Copy button for the Rotational joint type in the Object Parameters rollout, select the bucket object, and click the Paste button. This copies the joint constraints from the arm object to the bucket object.
  6. To test the system, select the Interactive IK button in the Inverse Kinematics rollout and select and move the bucket.

    As the bucket is moved, the arm rotates and the housing spins about its axis, just as you'd expect.

Figure 38.8 shows the bucket moving. With the Interactive IK mode disabled, any object can be moved and/or rotated, and only the links are enforced.

FIGURE 38.8 The objects in this scene are part of an inverse kinematics system.

image

Using the Various Inverse Kinematics Methods

After you create a linked hierarchy chain, you need to apply an IK method to the chain before you can animate it. Max includes several methods for animating using IK. The traditional methods of Interactive and Applied IK are now joined with IK solvers. The Interactive and Applied IK methods are applied using the Hierarchy panel; the IK solvers can be applied to a bones system, or you can use the Animation image IK Solvers menu.

An IK solver is a specialized controller that computes an IK solution. This solution is used to automatically set all the required keys needed for the animation. Max offers four IK solvers: History Dependent (HD) IK, History Independent (HI) IK, IK Limb, and Spline IK solvers.

Interactive IK

Interactive IK is the method that lets you position a linked hierarchy of objects at different frames. Max then interpolates all the keyframes between the various keys. This method isn't as precise, but it uses a minimum number of keys and is useful for an animation sequence involving many frames. Interactive IK interpolates positions between the two different keys, whereas Applied IK computes positions for every key. Because the motions are simple interpolations between two keys, the result may not be accurate, but the motion is smooth.

Caution

Be aware that Interactive IK is not available for all IK Solvers.

After your IK system is established, animating using the Interactive IK method is simple. First, you need to enable the Auto Key button and select the Interactive IK button in the IK rollout of the Hierarchy panel. Enabling this button places you in Interactive IK mode, causing the system to move together as a hierarchy. Then reposition the system in a different frame; Max automatically interpolates between the two positions and creates the animation keys. To exit Interactive IK mode, simply click the Interactive IK button again.

The IK rollout includes several options. The Apply Only to Keys option forces Max to solve IK positions for only those frames that currently have keys. The Update Viewports option shows the animation solutions in the viewports as it progresses, and the Clear Keys option removes any existing keys as the solution is calculated. The Start and End values mark the frames to include in the solution.

IK Preference settings

The required accuracy of the IK solution can be set using the Inverse Kinematics panel in the Preference Settings dialog box, shown in Figure 38.9. You can open this dialog box by choosing Customize image Preferences. For the Interactive and Applied IK methods, you can set Position and Rotation Thresholds. These Threshold values determine how close the moving object must be to the defined position for the solution to be valid.

FIGURE 38.9 The Inverse Kinematics panel of the Preference Settings dialog box lets you set the global Threshold values.

image

You also can set an Iterations limit for both methods. The Iterations value is the maximum number of times the calculations are performed. This value limits the time that Max spends looking for a valid solution. The Iterations settings control the speed and accuracy of each IK solution.

Note

If the Iterations value is reached without a valid solution, Max uses the last calculated iteration.

The Use Secondary Threshold option provides a backup method for determining whether Max should continue to look for a valid solution. This method should be used if you want Max to bail out of a particularly difficult situation rather than to continue to look for a solution. If you are working with very small thresholds, you want to enable this option.

The Always Transform Children of the World option enables you to move the root object when it is selected by itself, but constrains its movement when any of its children are moved.

Tutorial: Animating a simple IK propeller system

Machines are good examples of kinematics systems. In this example, you animate a simple gear-and-propeller system using the Applied IK method.

To animate an inverse kinematics system with a propeller, follow these steps:

  1. Open the Gear and prop.max file from the Chap 38 directory on the CD.

    This file includes a simple handle-and-prop system.

  2. To accomplish the first task—linking the model—click the Select and Link button on the main toolbar, and drag from each child object to its parent. Connect the propeller to the shaft, the shaft to the gear, and the gear to the handle.
  3. Open the Hierarchy panel, and click the IK button. Constrain the motions of the parts by selecting the handle object. All Sliding Joints can be deactivated, and only the Z Axis Rotational Joint needs to be activated. To do this, make sure that a check mark is next to the Active option. When this is set for the handle object, click the Copy button for both joint types, select the gear object, and click Paste to copy these constraints. Then select the shaft object, click both Paste buttons again, and repeat this process for the propeller.
  4. Enable the Auto Key button (or press the N key), drag the Time Slider to frame 100 (or press the End key), and click the Interactive IK button in the Inverse Kinematics rollout of the Hierarchy panel. Select the Select and Rotate button (or press E), and drag in the Left viewport to rotate the handle about its Z-axis.

Figure 38.10 shows the propeller system.

Applied IK

Applied IK applies a solution over a range of frames, computing the keys for every frame. This task is accomplished by binding the IK system to an object that it follows. This method is more precise than the interactive IK method, but it creates lots of keys. Because keys are set for every object and every transform, this solution sets lots of keys, which increases the size and complexity of the scene. Each frame has its own set of keys, which could result in jerky, non-smooth results.

FIGURE 38.10 The propeller rotates by turning the handle and using IK.

image

To animate using the Applied IK method, you need to bind one or more parts of the system to a follow object, which can be a dummy object or an object in the scene. You do so by clicking the Bind button in the Object Parameters rollout of the Hierarchy panel and selecting an object in one of the viewports. After the system has a bound follow object, select an object in the system. Open the Hierarchy panel; in the Inverse Kinematics rollout, click the Apply IK button. Max computes the keys for every frame between the Start and End frames specified in the rollout. Click the Apply IK button to start the computation process that sets all the animation keys for the range of frames indicated.

History Independent IK solver

The History Independent (HI) IK solver looks at each keyframe independently when making its solution. You can animate linked chains with this IK solver applied by positioning the goal object; the solver then inserts a keyframe at the pivot point of the last object in the chain to match the goal object.

You can apply IK solvers to any hierarchy of objects. IK solvers are applied automatically to a bones system when you create the system. You also can choose Animation image IK Solvers to select an IK solver.

When you choose Animation image IK Solver, a dotted line appears from the selected object. You can drag this line within a viewport and click another object within the hierarchy to be the end joint. A white line is drawn between the beginning and ending joints. The pivot point of the end joint is the goal for the IK solver. It is known as the end effector. The end effector of the IK solver is marked by a blue cross. Several rollouts within the Motion panel also appear. These rollouts let you set the parameters for the IK solver.

The first rollout, after the Assign Controller rollout, is the IK Solver rollout, shown in Figure 38.11. Using this rollout, you can select to switch between the HI IK solver and the IK Limb solver. The Enabled button lets you disable the solver. By disabling the solver, you can use forward kinematics to move the objects. To return to the IK solution, simply click the Enabled button again. The IK for FK Pose option enables IK control even if the IK solver is disabled. This lets you manipulate the hierarchy of objects using forward kinematics while still working with the IK solution. If both the IK for FK Pose and the Enabled buttons are disabled, then the goal can move without affecting the hierarchy of objects.

FIGURE 38.11 The IK Solver rollout lets you enable or disable the IK solver.

image

If the goal ever gets moved away from the end link, clicking the IK/FK Snap button automatically moves the goal to match the end links position. Auto Snap automatically keeps the goal and the end link together. The Set as Preferred Angle button remembers the angles for the IK system. These angles can be recalled at any time using the Assume Preferred Angle button.

When you choose Animation image IK Solvers image HI Solver, the start joint is the selected object, and the end joint is the object to which you drag the dotted line. If you want to change these objects, you can click the Pick Start Joint or Pick End Joint buttons.

Tip

The best way to select an object using the Pick Start Joint and Pick End Joint buttons is to open the Select by Name dialog box by pressing the H key. Using this dialog box, you can select an exact object without missing selecting it in a complex viewport.

Caution

If you select a child as the start joint and an object above the child as the end joint, then moving the goal has no effect on the IK chain.

Defining a swivel angle

The IK Solver Properties rollout includes the Swivel Angle value. The swivel angle defines the plane that includes the joint objects and the line that connects the starting and ending joints. This plane is key because it defines the direction that the joint moves when bent.

The Swivel Angle value can change during an animation. Using the Pick Target button, you also can select a Target object to control the swivel angle. The Use button turns the target on and off. The Parent Space group defines whether the IK Goal's parent object or the Start Joint's parent object is used to define the plane. Having an option lets you select two different parent objects that control the swivel plane if two or more IK solvers are applied to a single IK chain.

You also can change the Swivel Angle value by using a manipulator. To view the manipulator, click the Select and Manipulate button on the main toolbar. This manipulator is a green line with a square on the end of it. Dragging this manipulator in the viewports causes the swivel angle to change.

To understand the swivel angle, consider the two puppet bones systems displayed in Figure 38.12. The HI solver has been applied to the right arms of both puppets with the upper arm as the beginning joint and the hand as the end joint. The swivel angle for the left bones system is 90 degrees, and the swivel angle for the right bones system is 180. You can see the manipulators for both bones systems. The left one is pointing upward, and the right one is pointing straight out from the puppet's head. Notice that the swivel angle determines the direction the elbow joint is pointing. The left bones system's elbow is pointing up and away from the spine, and the right bones system's elbow is pointing painfully out in front of the puppet in the direction of the manipulator.

FIGURE 38.12 The swivel angle defines the plane along which the joint moves.

image

The IK Solver Properties rollout also includes Threshold values. These values determine how close the end joint and the goal must be before the solution is pronounced valid. You can set thresholds for Position and Rotation. The Iterations value sets the number of times the solution is tried.

Tip

Setting the Iterations value to a higher number produces smoother (less jerky) results, but it increases the time required to find a solution.

Displaying IK controls

The IK Display Options rollouts can enable, disable, and set the size of the gizmos used when working with IK solvers. Using this rollout, you can Enable the End Effector, the Goal, the Swivel Angle Manipulator, and the IK solver (which is the line connecting the start and end joints).

Tutorial: Animating a puppet with the HI IK solver

The HI solver is probably the best solver to use for animating characters. This fine fellow made of bones makes a good candidate for trying out the HI solver.

To animate a puppet with the HI IK solver, follow these steps:

  1. Open the Dancing puppet.max file from the Chap 38 directory on the CD.

    This file is the same file that was created using the bones system.

  2. Apply the HI solver to the arm chains by selecting the left upper arm and choosing Animation image IK Solvers image HI Solver. A dotted line appears in the viewports extending from the selected object. Move the cursor over the left hand object, and click.
  3. Repeat Step 2 for the right arm and both leg chains.
  4. Click the Auto Key button, and drag the Time Slider to frame 20. Select the goal for the left leg IK chain, click the Select and Move button on the main toolbar (or press the W key), and move the left leg goal upward.
  5. Repeat Step 4 for frames 40, 60, 80, and 100, moving the various IK chains in different directions.
  6. Move the Time Slider to frame 50, and select all objects by choosing Edit image Select All (or by pressing Ctrl+A). Drag all the objects upward a short distance. Drag the Time Slider to frame 100 (or press the End key), and drag all the objects back down again.
  7. Click the Play Animation button (or press /) to see the resulting dance.

Figure 38.13 shows one frame of the dancing puppet.

FIGURE 38.13 Moving the goal for each IK chain makes animating a character easy.

image

History Dependent IK solver

The History Dependent (HD) IK solver takes into account the previous keyframes as it makes a solution. This solver makes having very smooth motion possible, but the cost of time to compute the solution is increased significantly. You also can assign this IK solver to a bones system by specifying the History Dependent solver in the IK Chain Assignment rollout or by choosing Animation image IK Solvers image HD Solver.

This IK solver shows up as a controller in the Motion panel when the IK chain is selected. The settings are contained in a rollout named IK Controller Parameters, which is visible in the Motion panel if you select one of the end effector gizmos. The end effector gizmo is the object that you move to control the IK chain. It is displayed as a set of crossing axes.

You can access the IK Controller Parameters rollout, shown in Figure 38.14, in the Motion panel. Any parameter changes affect all bones in the current structure. In the Thresholds section, the Position and Rotation values set how close the end effector must be to its destination before the solution is complete. In the Solution section, the Iterations value determines the maximum number of times the solution is attempted. These Thresholds and Iterations values are the same as those in the Preference Settings dialog box, except that they affect only the current linkage. The Start Time and End Time values set the frame range for the IK solution.

FIGURE 38.14 The IK Controller Parameters rollout sets the boundaries of the IK solution.

image

The Show Initial State option displays the initial state of the linkage and enables you to move it by dragging the end effector object. The Lock Initial State option prevents any linkage other than the end effector from moving.

The Update section enables you to set how the IK solution is updated with Precise, Fast, and Manual options. The Precise option solves for every frame, Fast solves for only the current frame, and Manual solves only when the Update button is clicked. The Display Joints options determine whether joints are Always displayed or only When Selected.

When you first create a bones system, an end effector is set to the last joint automatically. In the End Effectors section, at the bottom of the IK Controller Parameters rollout, you can set any joint to be a Positional or Rotational end effector. To make a bone an end effector, select the bone and click the Create button. If the bone is already an end effector, then the Delete button is active. You also can link the bone to another parent object outside of the linkage with the Link button. The linked object then inherits the transformations of this new parent.

Click the Delete Joint button in the Remove IK section to delete a joint. If a bone is set to be an end effector, the Position or Rotation button displays the Key Info parameters for the selected bone.

Tutorial: Animating a spyglass with the HD IK solver

A telescoping spyglass is a good example of a kinematics system that you can use to show off the HD solver. The modeling of this example is easy because it consists of a bunch of cylinders that gradually get smaller.

To animate a spyglass with the HD IK solver, follow these steps:

  1. Open the Spyglass.max file from the Chap 38 directory on the CD.

    This file includes a simple spyglass made from primitive objects. The pieces of the spyglass are linked from the smallest section to the largest section. At the end of the spyglass is a dummy object linked to the last tube object.

  2. To define the joint properties, select the largest tube object, open the Hierarchy panel, and click the IK button. In the Object Parameters rollout, select the Terminator, Bind Position, and Bind Orientation options to keep this joint from moving.
  3. With the largest tube section selected, make the Z Axis option active in the Sliding Joints rollout, and disable all the axes in the Rotational Joints rollout. Click the Copy button for both Sliding Joints and Rotational Joints in the Object Properties rollout.
  4. Select each remaining tube object individually, and click the Paste buttons for both the Sliding Joints and Rotational Joints.

    This enables the local Z-axis sliding motion for all tube objects.

  5. Select the largest tube section again, and choose Animation image IK Solvers image HD Solver. Then drag the dotted line to the dummy object at the end of the spyglass.
  6. Select the second largest tube object, and for the Sliding Joint Z Axis, select the Limited option with values from 0.0 to −80. Click the Copy button for the Sliding Joints in the Object Parameters rollout. Select tubes 3 through 6 individually, and click the Paste button for the Sliding Joints to apply these same limits to the other tube objects.
  7. Click the Auto Key button (or press N), drag the Time Slider to frame 100 (or press End), select the Select and Move button on the main toolbar (or press W), and drag the dummy object away from the largest tube object.

Figure 38.15 shows the end tube segment collapsing within the spyglass.

FIGURE 38.15 The HD IK solver is used to control the spyglass.

image

IK Limb solver

The IK Limb solver was specifically created to work with limbs. It is used on chains of three bones such as a hip, upper leg, and lower leg. Only two of the bones in the chain actually move. The goal for these three joints is located at the pivot point for the third bone. This solver is ideal for game character rigging.

This solver works by considering the first joint as a spherical joint that can rotate along three different axes, such as a hip or shoulder joint. The second joint can bend only in one direction, such as an elbow or knee joint.

The rollouts and controls for the IK Limb solver are exactly the same as those used for the HI solver covered earlier in this chapter.

Tutorial: Animating a spider's leg with the IK Limb solver

As an example of the IK Limb solver, you should probably animate a limb, so I created a simple spider skeleton with not two limbs, but eight. I created this skeleton fairly quickly using four bones for the abdomen; then I created one limb and cloned it three times. Then I used the Bone Tools to connect the leg bones to the abdomen bones, and finally I selected and mirrored the bones on all four legs to get the opposite legs. The hardest part was naming all the bones.

To animate a spider skeleton's leg using the IK Limb solver, follow these steps:

  1. Open the Spider skeleton.max file from the Chap 38 directory on the CD.
  2. Click the Select by Name button on the main toolbar (or press the H key) to open the Select Objects dialog box. Double-click the RUpperlegBone0l object to select the upper leg bone object.
  3. With the upper leg bone selected, choose Animation image IK Solvers image IK Limb Solver. A dotted line appears in the viewport. Press the H key again to open the Pick Object dialog box, and double-click the RFootBone0l object to select it.

    This bone corresponds to the foot bone, which is the end of the limb hierarchy.

  4. With the IK Chain01 object selected, click the Auto Key button (or press the N key) and drag the Time Slider to frame 100 (or press End). With the Select and Move button (or by pressing the W key), move the IK chain in the viewport.

    The leg chain bends as you move the end effector.

Figure 38.16 shows the spider's leg being moved via the IK Limb solver. The IK Limb solver provides a simple and quick way to add an effector to the end of a limb, giving you good control for animating the spider's walk cycles.

FIGURE 38.16 You can use the IK Limb solver to control limbs such as legs and arms.

image

Spline IK solver

The IK Limb solver works well for arms and legs that have a joint in the middle, but it doesn't work well for tails. Tails are unique because they require multiple bones to deform correctly. The Spline IK solver works well for tails, but it also works well for rigging tentacles, chains, and rope.

To use the Spline IK solver, you need to create a chain of bones and a spline path. By selecting the first and last bone and then selecting the spline, the bone chain moves to the spline. Each control point on the spline has a dummy object associated with it. By moving these dummy objects, you can control the position of the bones. At either end of the spline are manipulators that you can use to twist and rotate the bones.

The easiest way to use this IK solver is to select SplineIKSolver from the drop-down list in the IK Chain Assignment rollout while you're creating the bone structure. After the bone structure is complete, the Spline IK Solver dialog box appears. With this dialog box, you can select a name for the IK chain, specify the curve type, and set the number of spline knots. The curve type options include Bézier, NURBS Point, and NURBS CV. You also can select to Create Helpers and to display several options.

Another way to use this IK solver is with an existing bone structure. To do this, you need a spline curve in the scene that matches how you want the bone chain to look. Select the first bone where you want the solver to be applied, and choose Animation image IK Solvers image Spline IK. In the viewports, a dragging line appears; move the line to the last bone that you want to include, and then drag a second time to the spline that you want to use.

The bone structure then assumes the shape of the spline curve. A helper object is positioned at the location of each curve vertex. These helper objects let you refine the shape of the curve.

Tutorial: Building an IK Spline alligator

The IK Spline solver is perfect for creating long, winding objects like snakes or an alligator's tail. For this example, you take an existing bone structure and, using the Spline IK solver, make it match a spline.

To create a bone structure for an alligator that follows a spline using the IK Spline solver, follow these steps:

  1. Open the Alligator spline IK.max file from the Chap 38 directory on the CD.

    This file includes an alligator model created by Viewpoint Datalabs, a simple bone chain, the Skin modifier, and a spline.

    Tip

    If you're having trouble seeing the bones located inside the alligator, you can enable the See Through option in the Object Properties dialog box or press the Alt+X keyboard shortcut.

  2. With the first bone in the tail chain selected, choose Animation image IK Solvers image SplineIK Solver.

    A dragging line appears in the viewport extending from the first bone.

  3. Drag and click the cursor on the last bone in the bone tail chain.
  4. Another dragging line appears; drag and click the spline, and the bone structure moves to match the spline's curve.

Figure 38.17 shows the bone structure for the gator's tail. You can now control the gator's tail by moving the dummy objects along the spline.

FIGURE 38.17 The IK Spline solver is perfect for creating objects such as snakes and animal tails.

image

Summary

Understanding the benefits of a bones system helps if you ever need to customize a rig or create a new rig from scratch. Inverse kinematics (IK) provides a unique way to control and animate hierarchical structures by transforming the child node. In this chapter, you learned how to create and work with bones systems and the Bone Tools. This chapter covered the following topics:

  • Creating bones systems
  • Setting bone parameters and the IK Solver
  • Using the Bone Tools
  • Making objects into bones systems
  • The basic concepts behind IK
  • Exploring the difference between interactive and applied IK methods
  • Creating and animating an IK system
  • Using the IK settings in the Preference Settings dialog box
  • Learning how to use IK solvers

Now that you've learned the process for rigging a character and using IK, we look at using the Character Animation Toolkit (CAT) next and discover the benefits of using a pre-rigged skeleton.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.107.100