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 different methods for animating using inverse kinematics. 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 from book IK Solvers menu.

An IK solver is a specialized controller that computes an inverse kinematics solution. This solution is used to automatically set all the required keys needed for the animation. Max offers four different IK solvers: History Dependent (HD) IK, History Independent (HI) IK, IK Limb, and SplineIK 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.

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 Inverse Kinematics 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 Inverse Kinematics 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 40.4. You can open this dialog box by choosing Customize image from book 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.

image from book
Figure 40.4: The Inverse Kinematics panel of the Preference Settings dialog box lets you set the global Threshold values.

Note 

Because the Applied IK method is more accurate, you want to set its Threshold values lower than those of the Interactive IK method.

You can also 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 solution rather than to continue to try to find 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 a kinematics system. 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 image from book Gear and prop.max file from the Chap 40 directory on the DVD. This file includes a simple handle and prop system.

  2. The first task is to link the model. Click the Select and Link button on the main toolbar. Then 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. We next 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. Finally, 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. Then select the Select and Rotate button (E), and drag in the Left viewport to rotate the handle about its Z-axis.

Figure 40.5 shows the propeller system.

image from book
Figure 40.5: The propeller rotates by turning the handle and using inverse kinematics.

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 and non-smooth results.

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 then 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.

Tip 

If you plan on using the Applied IK method, set the Threshold values in the Inverse Kinematics panel of the Preference Settings dialog box to small values in order to ensure accurate results.

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 keyframes the position of 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 can also choose Animation image from book IK Solvers to select an IK solver.

When you choose Animation image from book 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. The goal of the IK solver is marked by a blue cross. Several rollouts within the Hierarchy panel also appear. These rollouts let you set the parameters for the IK solver.

The first rollout is the IK Solver rollout, shown in Figure 40.6. 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.

image from book
Figure 40.6: The IK Solver rollout lets you enable or disable the IK solver.

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 from book IK Solvers image from book 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 or End Joint buttons is to open the Select TIP by Name dialog box by pressing the H key. Using this dialog box, you can select an exact object without having to miss 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 can also 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 can also 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 40.7. 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.

image from book
Figure 40.7: The swivel angle defines the plane along which the joint moves.

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 an alligator with the HI IK solver, follow these steps:

  1. Open the image from book Dancing puppet.max file from the Chap 40 directory on the DVD. 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 from book IK Solvers image from book 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 from book Select All (Ctrl+A). Then 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 (/) to see the resulting dance.

Figure 40.8 shows one frame of the dancing puppet.

image from book
Figure 40.8: Moving the goal for each IK chain makes animating a character easy.

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 can also assign this IK solver to bones systems by specifying the History Dependent solver in the IK Chain Assignment rollout or by choosing Animation image from book IK Solvers image from book HD Solver.

This IK solver shows up as a controller in the Motion panel. 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 40.9, 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.

image from book
Figure 40.9: The IK Controller Parameters rollout sets the boundaries of the IK solution.

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 already is an end effector, then the Delete button is active. You can also 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 we can use to show off the HD solver. The modeling of this example is also 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 image from book Spyglass.max file from the Chap 40 directory on the DVD.

    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. First, you need to define the joint properties. Select the largest tube object, open the Hierarchy panel, and click the IK button. In the Object Properties 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. Then 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 from book IK Solvers image from book HD Solver. Then drag the dotted line to the dummy object at the end of the spyglass.

  6. Select the second tube object, and for the Sliding Z Axis, select the Limited option with values from 0.0 to 80. Then click on the Copy button for the Sliding Joints in the Object Parameters rollout. Then 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 (N), drag the Time Slider to frame 100 (End), select the Select and Move button on the main toolbar (W), and drag the dummy object away from the largest tube object.

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

image from book
Figure 40.10: The HD IK solver is used to control the spyglass.

IK Limb solver

The IK Limb solver was specifically created to work with limbs such as arms and legs. 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.

The way this solver works is that it considers the first joint as being a spherical joint that can rotate along three different axes, like 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 character's arm with the IK Limb solver

As an example of the IK Limb solver, we should probably animate a limb, and the future man model produced by Viewpoint Datalabs is ready to go.

To animate the future man's arm using the IK Limb solver, follow these steps:

  1. Open the image from book Future man IK arm.max file from the Chap 40 directory on the DVD.

  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 "upper_arm_bone_l" object to select the upper arm bone object.

  3. With the upper arm bone selected, choose Animation image from book IK Solvers image from book IK Limb Solver. A dotted line appears in the viewport. Press the H key again to open the Pick Object dialog box, and doubleclick the "hand_bone_l" object to select it.

    This bone corresponds to the hand 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 (End). With the Select and Move button (W), move the IK chain in the viewport.

    The arm chain bends as you move the end effector.

Figure 40.11 shows the man's arm being moved via the IK Limb solver.

image from book
Figure 40.11: You can use the IK Limb solver to control limbs such as legs and arms.

Spline IK solver

The Limb IK solver works well for arms and legs that have a joint in their middle, but it doesn't work well for tails. Tails are unique because they start out large and gradually are reduced in size to a point. For tails, the Spline IK solver works well.

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 can also select to Create Helpers and to display several different 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. Then select the first bone where you want the solver to be applied, and choose Animation image from book IK Solvers image from book 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, we 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 image from book Alligator spline IK.max file from the Chap 40 directory on the DVD.

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

  2. With the first bone in the tail chain selected, choose Animation image from book IK Solvers image from book 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 on the spline, and the bone structure moves to match the spline's curve.

Figure 40.12 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.

image from book
Figure 40.12: The IK Spline solver is perfect for creating objects like snakes and animal tails.




3ds Max 9 Bible
3ds Max 9 Bible
ISBN: 0470100893
EAN: 2147483647
Year: 2007
Pages: 383

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net