Return to 3D Resources main page
Search  |  Submit  |  Contact  |  Advertising   
Return to 3D Resources main page
  Menu
  Advertisements
  Partners
Tutorial Guide
Photoshop Tutorials
3D Tutorials
Free Templates
CYGAD's 3DXtra
3D Commune
Renderosity
Super 8 Film to DVD


Inverse Kinematics In Lightwave Tutorial
Added: 2004-12-06 | Views: 12669/18964 | Software: LightWave 3D

introduction


Hierarchy Basics

Before you can use IK you must first have a firm grasp of how basic hierarchies are set up in Lightwave. Objects or bones are linked together by means of PARENTING to form the movable joints in a body.

The thigh is the PARENT OBJECT of the shin. The shin is parent of the foot. The foot is the parent of the toes, and so on... This is called serial linking, and it establishes the hierarchy. When you rotate an object (like a thigh) using H, P or B in the Mouse Panel, the child objects linked to it (shin, foot and toes) will follow along. This is the essential principle of hierarchical motion. And this simple method of working with a hierarchy is called FORWARD Kinematics.


What Is IK?

So what is INVERSE Kinematics? Well, as just described, in Forward Kinematics, motion is inherited DOWN the hierarchy from the parents to the children. In Inverse Kinematics, motion is inherited UP the hierarchy, from the extremities to the more proximal joints (closer to the body) which are their parents.

This effectively allows an entire arm or leg to be posed by moving one object: a GOAL (or ``handle'' in other programs). As the Goal is moved around, the extremities follow it, and the joints above it in the hierarchy readjust accordingly. In order for the joints to readjust appropriately, constraints or ``degrees of freedom'' have to be assigned to the joints, so they don't bend beyond a realistic range of motion.

On its surface, this may seem simple, but there are a variety of specialized things that can be done with LW's IK that are difficult to do any other way. This includes, anchoring, tracking, magnetism, sticky feet, even a sort of collision detection. And with the implementation of new FULLTIME IK in 5.0, more complex things like bipedal or quadrupedal locomotion motion are possible.





ik basics


Goals

Goals can be assigned to any object in the hierarchy, but they will probably work best assigned to extremities like the hands, feet or toes. Use ADD NULL in the Objects Panel to bring in a null axis to use as a Goal, and rename it something logical with the SAVE OBJECT button. (Since null axes are saved with the Scene, the Save Object command will not bring up a file requestor like normal, it will just bring up a blank where you can enter a new name.)

Then the null axis must be assigned to an object in the hierarchy as a Goal. Select the extremity that you want to follow the Goal. Then go into the extremity's IK Options and choose the null axis as its GOAL OBJECT.

Objects which have a Goal assigned will be magnetically attracted to that Goal, and attempt to follow, or track to the Goal as it is moved.

Goals cannot be linked or attached to the hierarchy of a figure, so they are free to move all around the scene. At first this might seem a little inconvenient, because it's easy for them to get lost off screen. But their ability to exert an influence on objects without making direct contact with them is the key to things like tracking eyes, sticky feet and gravity effects.

Objects which have a Goal assigned to them will not rotate in relation to their parent when using IK. For example, let's say you have a Foot which pivots at the ankle, with a Shin as its parent. If you assign the Goal to the Foot, when you move the Goal, the foot will not rotate in relation to the Shin. The ankle will essentially be frozen. To get the ankle to bend, you must add a null axis, or another joint at the ball or toe of the foot and assign your Goal to it instead.

Another example: To get an eye to follow a Goal, you'd need a null axis linked in front of the eye as its child. The Goal would then be assigned to the null axis. Then the eye itself will pivot to follow the Goal.


Unaffected by IK of Descendants

Another thing you must do is assign ``stop points'' in the hierarchy to isolate the behavior of the IK chains in each limb, so they don't effect other parts of the body. An IK'd model without these stop points will just flail around uncontrollably (kinda like Tom Cruise when he ``flips out'' in Jerry Macguire.). Typically these stop points would be assigned to the pelvis or abdomen to isolate the movement of the legs, and to the chest to isolate the movement of the arms. These stop points are set by turning on UNAFFECTED BY IK OF DESCENDANTS in the IK Options for that object or joint.


IK Limits, Min and Max Angles

Another thing you should do is assign ``degrees of freedom'', or maximum and minimum angles of rotation for each joint. These will constrain the movement of joints so they more accurately simulate the mechanics of a real body. You can determine the range of motion for each joint by testing various angles of rotation in the Layout for each axis H, P, B, and then entering the maximum and minimum angles in the IK OPTIONS. Then when you move the limb with IK, the joints won't go past their realistic range of motion.

Some joints such as the thigh will have some freedom of movement in all three axes, while others like the SHIN will only be able to rotate in one axis (in this case, the PITCH backwards of the knee).

IK Limits are saved with the scene file for each object in the hierarchy.


Creating Keyframes

After you've created a pose with IK, one way you can save it is by selecting the master parent of the hierarchy (not the Goal) and CREATE KEY for SELECTED ITEM AND DESCENDANTS. This will create keys for the rotation of all joints in the hierarchy. As we'll see later, this is not the most efficient and powerful method of animating IK. But it is the only option for users who do not have 5.0 with Fulltime IK yet.





how the mouse panel effects ik


There are a couple of important things you should know about how the Mouse panel effects hierarchies both in the Forward and Inverse Kinematic modes.

Settings in the Mouse panel are saved with Scene files for each object in the hierarchy. So you should disable all the settings except those that apply to each joint. This way you can store your hierarchy with basic rotational constraints already set up, making movement of the figure more intuitive, both in the regular Foward Kinematic mode and IK.

Only ROTATIONAL settings should be enabled for the joints in a hierarchy. MOVE, SIZE, STRETCH and MOVE PIVOT should all be disabled. The exception is that you'll want MOVE mode active for Goals, and the COG, or master parent in the hierarchy so you can move the whole figure around the scene.

Once you've enabled the proper H, P, B settings for each joint in the Mouse panel, it's probably a good idea to discipline yourself not to change the settings. If you do change them while building a pose, restore the correct settings before you save the scene, so the right parameters will be active next time you load it.

One other important thing you should know about the Mouse panel is that the H, P, B settings will effect Inverse Kinematics. This is in addition to the Limits you've set in the IK Options. When you're using IK, if you ever find that a joint isn't rotating the way it should, double check the Mouse panel to see if you have the correct H, P, B settings enabled.





fulltime ik


Fulltime IK is a new feature in 5.0. It allows a hierarchy to be animated by keyframing the movement of Goals. In 4.0, Goals could only be used to pose the figure, and keyframes had to be set for rotation of all the joints as described earlier. Fulltime IK allows the Goals to be animated directly, and effect the hierarchy on the fly as each frame is generated. On limbs where you are using Fulltime IK, no keyframing is necessary for the rotation of the joints.

With Fulltime IK, multiple goals can all be active at the same time exerting their influence on the hierarchy simultaneously. For example, while one Goal is used to plant the left Foot, another Goal can be moving the right Foot, finally making realistic terrestrial motion possible in LW.

FULLTIME IK is activated in the IK Options only for extremities that are following Goals. It is NOT turned on in the IK Options of the Goals themselves.

One problem with Fulltime IK in LW 5.0 versions up to K/M is that it can get confused if their is a joint in the IK chain free to rotate in more than one axis. In a hip joint, which is free to rotate slightly in all three axes (H, P, B), the program can't make up its mind which way to bend it, causing it to shimmy. The IK routine in 5.0 K/M has no resistance or dampening on the joints, so in certain situations, they will tend to seek the extremes you've defined in the IK Limits unimpeded.

Locking the rotation of joints so they are free to rotate in only one axis each (either with the Mouse panel's H, P, B settings, or the IK Limits) can stop this indecision.

Or, using more than one Goal to control the extremities (for example, one for the foot and one for the toes, parented together so they move in unison) can also stabilize the joints in the leg so they don't shimmy, while still retaining the freedom to move in multiple axes.

If you can keep the joints from shimmying with one of these methods, then you should be able to get the figure to walk around your scene, by simply keyframing positions for the ``Foot'' Goals, and translating the figure's body along with them, by moving the COG so it stays roughly over the feet at a fairly constant height.



The latter method of using multiple goals for each extremity is the one I prefer, and used to make a figure walk up a flight of stairs. I had three Goals set up for each foot, one for the tip of the toes, one for the ball, and one for the ankle (and actually a fourth one above the arch as well). These three Goals were grouped together with the Toe Goal as parent of the Ball Goal, and Ball Goal as parent of the Ankle Goal. This is reverse the parenting order of the actual objects in the leg that they influence. However, by using groups of Goals this way, I was able to manipulate the whole leg in a very sophisticated fashion just by moving the Toe Goals. The multiple Goals stabilized the foot and other joints in the leg, and it also allowed for the ``sticky foot'' effect (where the heel raises off the ground before the toes). Fulltime IK was turned on for each object in the foot to which a Goal was assigned.

The figure was animated walking up the stairs by simply moving the Toe Goals, and keeping the figure's COG roughly centered above them.



In the motion graph for the movement of each Toe Goal, Spline Controls were set to LINEAR for keyframes where the foot was planted on a stair. This prevented the foot from penetrating the surface.

Also, increasing the GOAL STRENGTH on the objects that followed the Ball Goals seemed to enhance the sticky foot effect.





speeding up the interface


One of the biggest problems with Fulltime IK is that it will slow down the Lightwave interface, especially when using multiple Goals, and bones (which are already slow to begin with). Using an OpenGL accelerator probably won't make much difference here, because it is the calculation of the deformations, and overlapping influences of Goals that cause the slow down. A faster CPU would help some. Also you should know that 5.0 Z and 5.5 are much faster than earlier version of LW, so getting one of these will help most of all. Using a low polygon model will help quite a bit as well, and you can replace it later with a high poly model or use Metamation when your are ready to render.





other ik caveats



Gimbal Lock

Lightwave uses a gimbal method of rotation. When you rotate an object 90 degrees in Pitch or Bank you'll loose one axis of rotation. For example a hip can rotate in all three directions. In particular, you can twist it about its length with HEADING. However if you rotate it 90 degrees in PITCH, and then try to rotate it in HEADING, it now behaves the same as if you were using BANK. It's no longer possible to twist the THIGH about its length. This problem is known as GIMBAL LOCK. It will probably only effect your work on rare occasions, but you should be aware that it's there.


IK Limits Don't Apply to H,P, B Mouse Rotation

After spending all the effort setting up the IK Limits, it would certainly be nice if they applied to standard forward kinematics, instead of just movement with Goals.


Important note: The author is not or may not be a natural English speaker and there is a high chance of mistakes in every way. Corrections and comments are welcome.
  New To Gallery
Office Lobby
Krane Bot
  Advertisements
Tutorial Guide
  Partners
3D Tutorials
3D Links
Gallery Of 3D
CG Directory
Tutorials 3D

 Disclaimer Powered By Digital Spark