Introduction
This tutorial explains how to create a working leg setup with 3D Studio MAX r2.5 and its
"New IK" system. After going through this article you should be able to take the same
principles here and apply them to other setups such as arms, antennas, or anything else you might
want to create (such as animated flying dachsunds). A basic working knowledge of MAX is assumed.
There are two basic setups I will discuss. The first, the simpler of the two, is an IK leg chain that ends at the ankle, with a forward kinematics foot. This setup is very stable, and easier to create, but the foot separates from the leg if it is placed too far. Not really a big deal since you can just make sure you animate it correctly. The FK foot is my personal choice.
The second setup is a full unbroken IK chain for the leg and foot. This setup is a bit more complicated to animate, but the foot stays attached regardless. It's still pretty stable, but probably not quite as much as the FK foot.
Both of these IK setup MAX files are available by
downloading the IK Tutorial ZIP File (iktutfiles.zip). You should
probably read through the FK version first, as it discusses some basic principles of IK. However,
I tried to make each tutorial independant, so you can technically read them out of order.
Skeletons In Your Window - IK Leg / FK Foot Setup
Some important notes about this setup. First, besides the upper and lower leg bones, and foot and toe bones, there is a Hip bone. In between the hip bone and the upper leg bone is a "socket" bone. This is just another bone in the chain and is needed for reasons we will discuss later. For now, just note that you basically need 6 bones as shown. In addition, it helps to have everything lined up in a straight line for setup.
Reset transform insures you won't get any skewing of the bones when you rotate them, as might happen if they were non-uniformly scaled. It also helps to have the axis of each bone aligned the same to make rotation limits easier to setup.
Finally even though we won't be using any rotation end effectors here, in order for rotation constraints to work correctly, both the dummy and the bone have to have the EXACT orientation. The easiest way to do this is to make sure everything has it's transform reset, and that the dummy is created in the Top viewport. The way to think of it is that linking position end effectors is relative, while rotation end effectors are always absolute.
Due to the way reset transform works, you should first unlink everything in your hierarchy. In addition we will be making a few additions/changes to the hierarchy, so unparenting is a good idea anyways.
So, select all the bones, and hit unlink. From the utility panel, choose "ResetXForm" and click the "Reset Selected" button. Alternatively you could apply an X-Form modifier to each bone one at a time, but this is quicker. Next, in order to easily collapse the stacks of all the bones, apply an Edit Mesh modifier, turn off subobject mode, hit the Edit Stack button and "Collapse All".
You should now have a bunch of unparented bones with their transforms reset.
Create a dummy at the ankle area called AnkleDummy. The dummy does two things. First, it
will become the indirect animation control that is used to make the leg move and rotate. (Who ever said dummys were stupid?) Second, it is needed in order for the IK chain we create to automatically
be generated through the lower leg. Basically think of it as telling MAX where the end, or tip
of the chain is. MAX needs to know where the tip of the last bone in the chain is, so that it
creates the last bone correctly. By adding this AnkleDummy in at the bottom of the leg, MAX will
be able to know to place a bone lengthwise through the lower leg segment.
The main change is that we will link the ankle dummy to the lower leg bone, instead of using the foot. Link the hierarchy upwards as normal then, with the hips as the root and the AnkleDummy as the last child. Leave the toes and foot boxes UNparented to anything. The basic chain is: AnkleDummy->Box04-LowerLeg->Box03->UpperLeg->Box02-HipSocket->Box01-Hips.
Click on the "Create Panel", choose "Systems" and then from the standard dropdown listbox choose "Bones". Leave all the defaults as is (everything checked except for 'Assign to Root'), and then click the "Pick Root" button.
Then, click on the smaller Box02-HipSocket bone. This is the second bone in the list. Note: do
not choose the regular top Hips as the root of the chain. We want the IK chain to start one bone down in the hierarchy. MAX will automatically generate the New IK bone structure as shown.
To begin with, select the topmost yellow IK bone, Bone01. Parent this to the purple Box02-HipSocket block. Then parent the Box02-HipSocket bone to the topmost red Box01-Hips bone. That way, you can animate the Hip bone to move the torso of the character around.
Next unlink the AnkleDummy. By default it is parented to Bone04. We are unlinking it because we will use it as a parent for Bone04's "end effector". In order to do this, it has to be unparented from the hierarchy itself.
Under "Threshholds" change both the Position and Rotation values to 0.0. This value determines how close MAX will try to get when calculating the IK solution. Larger values are quicker, but more coarse. A value of zero is as exact as you can get.
Under "Solutions", change the "Iterations" to 100. A value from 100 - 500 or higher will yeild a more stable IK solution, but once again it gets slower as it gets more exact.
Change the "End Time" to be a large frame number outside of the end of your animation. I usually make it several thousand. Any frame after this number, and IK will magically (or not so magically) stop working. All you have to do is to select the frame range you want IK to work for in your animation. By making this a nice high value, you won't have to worry about your animation being too long.
Finally, click the "Lock Initial State" checkbox under "Initial State". This tells MAX that
the current orientation and setup is the base pose for the hierarchy, and helps it in its calculations.
Plus, it's fun to click on little boxes.
By default, the last bone in the hierarchy already has a Position end effector created. Using the 'Create' and 'Delete' buttons in the IK rollout, you can create or delete end effectors for the bones. In order to easily move/rotate the end effector controls, which is what really makes the IK chain pose and animate, you can link the end effectors to any object. (Remember we mentioned earlier that position effectors are relative and rotation effectors are absolute. So it doesn't matter if the AnkleDummy is in the exact position or not of the last bone since we'll be using only a [relative] position constraint.)
Make sure Bone04 is selected, and press the "Link" button. Then click on the AnkleDummy. The name appears as the "End Effector Parent". If it doesn't allow you to select the AnkleDummy, it means you forgot to unparent it in a previous step. If that happens, just turn off the link button, and unlink the AnkleDummy, then try again.
As a test, you should now be able to select the AnkleDummy object and move it around to control
the location of the end of the leg. If you pull too far you'll see a blue cross hair which is
actually the real end effector of Bone05. Make sure you undo any movement changes before proceeding.
There are two important sections in this rather long panel that are used with New IK. First, is the "Object Paramters" rollout with the Position and Orientation settings. Under these is an item called "Weight" which defaults to 1.0. Changing this value changes the relative amount of pull each end effector has relative to other end effectors in the hierarchy. Higher values mean the end effector is stronger than others that might be pulling in the opposite direction. Because it's relative, the actual numbers don't mean anything except in relation to each other. (i.e.: 100 to 50 is the same as 1 to 0.5 is the same as 4 to 2).
The other section used here is the "Rotational Joints" rollout. (No, this does not mean it
tells you how to roll a joint...) This area allows you to select which axis bones can rotate on,
and to setup limits for the angles they can move through.
Using these options, we can stop the lower leg from rotating funky ways.
Go down in the panel to the "Rotational Joints" rollout. By default all axis are checked active. However, the lower leg should only rotate on the local X axis. (You can determine which axis to use by choosing rotate in parent mode and also by noting that the bone orientation is the same as world coordinates since we reset transforms earlier).
So, uncheck the active buttons for the Y and Z axis. Now we also want to limit the amount that the lower leg can go so it doesn't bend forward, or backwards, too much. Click the "Limited" checkbox under the X-Axis, and then set the From and To values to be 3 and 170 respectively. The 3 value allows for the leg to never totally lock up and the 170 is almost a full leg bent value. You can see the range visually as you drag the slider by looking in a right or left viewport. An orange arc appears showing the range of motion.
Setting up the rotational limits like this is one of the reasons to have the hierarchy in a nice straight line. The limit numbers are based relative to the bones parent. If the child is rotated in it's base pose some funky way, you get get gimbal lock problems, and it can be difficult to setup the limits. One solution is to set everything up in a straight line as we are doing. Another, is to add an extra dummy (and hence IK segment) with the same orientation as the child that is having rotation problems, inbetween the parent and child. This extra segment would cancel out the offset rotation of the original parent since it's inbetween, allowing you to easily set the rotational limits for the real child bone.
Finally, also under the X-Axis, check "Spring Back" and set the value to 5 and the Spring Tension to 0.3. This also helps to keep the leg from locking up.
Now then, if you just did all of this, chances are the upper leg probably just rotated all funky.
Don't despair, this is because we haven't constrained it yet. What we want to do is to stop the
upper leg from being able to spin by itself which is the next step...
Select Bone02. Uncheck the Active box for the Z-Axis. The leg should orient back to a more normal
pose.
However, you will probably want the knee NOT to inherit the spin of the hips, but to still inherit the other axis. To do this, select the Box02-HipSocket bone. Then, still in the Hierarchy Panel, choose the "Link Info" panel. Under the "Inherit" rollout, turn OFF the Z axis.
In addition, we want this bone to ONLY rotate on it's Z axis. From
the top "Locks" section, turn on the X and Y Axis, so that it is only allowed to rotate on Z.
This makes it easier to animate in case we accidentally try to rotate it on another axis.
The FK foot here is very simple and easy to both setup and use. However it has the caveat that the leg/ankle will pull away from the foot if it moves too far away. On the other hand, the foot is always perfectly locked. For the most part, you can just pay attention to posing your character so the foot is within range, so it's not a big deal. The remaining steps will complete the IK Leg and FK Foot setup.
You can take the FootDummy, and both move and rotate it to adjust and animate the entire foot. You can rotate the Box05-Foot bone itself, which has the effect of keeping the toes planted, but allowing the heel to come up.
You can also rotate the Box06-Toes bone which keep the foot steady but rotates the toes. As a whole the foot remains perfectly stable, though if the FootDummy or Hips move too far, they will pull apart. Still, this is my personally favored foot setup.
In addition you can move and rotate the hips or root of the character. The HipSocket bone is spun on it's local Z axis to control the placement of the knee/upper leg.
That's it. This is a very stable and usable IK leg setup for MAX.
Stop Pulling My Leg - IK Leg and Seamless IK Foot
In this section we'll build an IK foot setup that remains locked at the ankle.
This setup is a bit more complicted to create and animate, but it uses the same principles
as the setup above. The steps below in many cases are identical to the ones above for the
leg itself. However, there are a number of differences to the initial hierarchy itself and
of course an entire new section for the foot.
Some important notes about this setup. First, besides the upper and lower leg bones, and foot and toe bones, there is a Hip bone. In between the hip bone and the upper leg bone is a "socket" bone. This is just another bone in the chain and is needed (once again) to control the knee placement. In addition, it helps to have everything lined up in a straight line for setup.
Reset transform insures you won't get any skewing of the bones when you rotate them, as might happen if they were non-uniformly scaled. It also helps to have the axis of each bone aligned the same to make rotation limits easier to setup.
Finally, because we'll be making a rotation constraint here, we need to make the dummy and the bones have the EXACT same orientation. The easiest way to do this is to make sure everything has it's transform reset, and that the dummy is created in the Top viewport. The way to think of it is that linking position end effectors is relative, while rotation end effectors are always absolute. We'll deal with this again later on.
Due to the way reset transform works, you should first unlink everything in your hierarchy. In addition we will be making a few additions/changes to the hierarchy, so unparenting is a good idea anyways.
So, select all the bones, and hit unlink. From the utility panel, choose "ResetXForm" and click the "Reset Selected" button. Alternatively you could apply an X-Form modifier to each bone one at a time, but this is quicker. Next, in order to easily collapse the stacks of all the bones, apply an Edit Mesh modifier, turn off subobject mode, hit the Edit Stack button and "Collapse All".
You should now have a bunch of unparented bones with their transforms reset.
Create a dummy at the base of the leg, called AnkleDummy, one at the ball of the foot
called BallDummy, and the last at the tip of the toes, called ToeDummy.
Click on the "Create Panel", choose "Systems" and then from the standard dropdown listbox choose "Bones". Leave all the defaults as is (everything checked except for 'Assign to Root'), and then click the "Pick Root" button.
Then, click on the smaller Box02-HipSocket bone. This is the second bone in the list. Note: do
not choose the regular top Hips as the root of the chain. We want the IK chain to start one bone down in the hierarchy. MAX will automatically generate the New IK bone structure as shown.
Also, select Bone01, this is the first bone in the New IK bone structure, and link it to the Box02-HipSocket block. Then link the HipSocket to the Box01-Hips bone. This way you can animate the hips block of the character.
In fact, you can now test this by moving the hips block around. As you see there's IK, but it doesn't quite work. The leg doesn't really bend correctly or enough and the foot goes all over. We need to set some constraints up to limit rotations and to get bones to lock to certain places.
To start, select Bone04 (or any other yellow New IK bone) and go the Motion Panel. Change the Position and Rotation thresholds to 0 and set the Iterations to 500. Lowering the position and rotation thresholds make the IK solution more precise, as does raising the iterations. Both also cause it to slow down. One thing you can do is to lower the iterations to a smaller value when animating, the raise it back up again when doing the final render.
Also, set the End Time to a nice high value like 4000 frames, so that the IK doesn't suddenly
stop working before the animation is done. Finally, click Lock Initial State to tell MAX this is
the base pose of the setup.
If it doesn't let you click on the AnkleDummy, it means you forgot to unlink it in an
earlier step. If that happens, simply turn off the link button, select the AnkleDummy and unparent
it, then reselect Bone04, and link the end effector to the dummy via the motion panel.
Turn off the Activve boxes for the Y and Z axis.
Select Bone02. Uncheck the Active box for the Z-Axis. Leave the X and Y axis active.
However, you will probably want the knee NOT to inherit the spin of the hips, but to still inherit the other axis. To do this, select the Box02-HipSocket bone. Then, still in the Hierarchy Panel, choose the "Link Info" subpanel. Under the "Inherit" rollout, turn OFF the Z axis.
In addition, we want this bone to ONLY rotate on it's Z axis. From the top "Locks" section, turn on the X and Y Axis, so that it is only allowed to rotate on Z. This makes it easier to animate in case we accidentally try to rotate it on another axis.
At this point the leg is set up. You can try moving the top Hips bone and rotating the HipSocket
bone to control the leg. However, the foot does all sorts of odd rotations. Make sure you undo
any changes you make by test moving the hierarchy before continuing on. Don't worry if some of
the foot bones are at odd rotations for right now.
We'll start by making our end effectors, and linking them to the dummy objects. Select Bone07.
This is the last New IK bone going through the toes. Go to the Motion Panel. Because this is
the last bone in the chain, a position end effector was already created by default. Click the
"Link" button in the motion panel, and then select the ToeDummy.
Go to the Hierarchy Panel, and choose the IK subpanel. Select Bone06. This is the bone that is actually the parent of the toes, but appears through the foot. Becaue the toes can only rotate on the X axis, turn off the "Active" boxes for the Y and Z axis down in the "Rotational Constraints" rollout, but leave the X axis active.
In addition, set the Position weight to 50.
What we should do is to select the bones and nudge them a little bit to make the foot flat. You can select and rotate the ankle dummy if needed on the local Y axis to get the foot flat. If the toes are slightly bent, move the ToeDummy a little to make them flat.
You should have a flat foot as shown.
Create 2 dummys in the top viewport. Create a larger one called FootDummy at the same
location as the ankle. Create a dummy called HeelDummy, at the same location as the
BallDummy, but a bit larger.
This setup is considerably more complicated looking around the foot area, but actually it operates in much the same manner as the FK foot setup. You can rotate the BallDummy object to rotate the toes. Because it's constrained to the X axis, you don't have to worry about rotating it odd ways. This is basically identical to rotating the toes themselves in the FK setup.
You can rotate the HeelDummy on the X axis in order to keep the ball planted and raise the heel. This is similar to rotating the Foot in the FK version. For the entire foot, select and then move or rotate the FootDummy.
You can also rotate and move the Hips block at the top itself, and spin the HipSocket bone to set the knee location/upper leg orientation.
Walking Away
That's the basics of setting up a leg with MAX's "New IK". You can take the same principles here and apply it to an arm setup. Instead of a Knee rotation constraint, you'd have an Elbow position constraint (you could try a rotation effector for the elbow, but usually the position type works better). Instead of an Ankle position effector, you'd have a wrist position effector. In addition, you could add one extra segment and effector into the hierarchy for the shoulders if you wanted them IK'd.
My personal preference is still a broken foot or hand hierarchy with FK. That way you get perfectly stable locking, a little slack if you want it, and it's really easy to control and animate. Whatever you choose, have fun, and IK away!
Special Thanks
Special thanks to Michael Brown for helping me deal with a lot of IK issues, questions,
and for figuring out MAX's lovely rotation constraints. He gets a big Kit-Kat. Special thanks to
Ken Morton for suggesting the knee control method without using a knee effector. (I guess this
idea initially comes from Rick May of the CG-Char List. Also, special thanks to Steph Greenberg for writing his Animation Master IK tutorial
in Doug Kelly's Character Animation In Depth book. The MAX tutorial I wrote in that book was my very
first MAX IK setup based on his AM version.
About the Author
Michael Comet is currently a Rigger/T.D. at Blue Sky Studios in New York.
Previously he was Video Team Lead Rigger and CG-Supervisor and a 3D/Animator/Artist at Big Idea in
Lombard, IL where he is worked on 3-2-1 Penguins and Veggie Tales.
Prior to that he was lead animator at the video game company
Volition, Inc., where he animated most of the cinematic
sequences for Descent: Freespace, and headed up much of the realtime character animation and
cinematics for their RPG title, "Summoner". He can be reached via email
at comet@comet-cartoons.com, and has a
personal homepage at: http://www.comet-cartoons.com/
which has more information and samples of his work
About the Sample Images
This article, all images and text is Copyright ©1999 Michael B. Comet
All Rights Reserved.
This article may be reprinted for personal use only. It may not be packaged or sold in part or in whole, either alone or as part of another package, book, magazine or any other item. Unauthorized duplication is strictly prohibited. This article and related artwork, samples or text, are not to be copied onto other sites without prior written consent from the author. When in doubt, ask.