Archives of 34Bit:

Wednesday, January 23, 2008

Tutorial - IK Setup

A Basic IK Setup



You will notice that this tutorial starts off with a model and a bone structure for animation. You will need the bone structure. Also, it is okay if your skeletal setup differs from mine, this tutorial will cover a basic overview of IK that should apply to almost all characters.

Now even though your setup doesn’t have to be identical, here are some of the characteristics of my setup. The Node is, at least for now, the pelvis which I made from a sphere with minimal segments. The Head, Hands, and Feet were all modeled from basic primitives. I did this to show that you do not just have to use bones in your rig; rather you can also apply modeled geometry. There is no clear advantage or disadvantage to using bones or not it is up to you. I have seen advanced rigs that only use some bones and I have seen rigs that use all bones. It depends a lot on the character and a lot on who is rigging the character. Notice the chest bones. Extra bones like these are critical to Secondary Motion. If your character has a large gut, a chest, a butt, ext. you may want to add these bones to aid in animation!

Before we get into IK we need to double check our Hierarchy of the skeletal setup. If it is off by just one link our IK will not work. Remember with linking you want to link from the tips of the appendages to the core of the body. (Finger tips, up through the arm, into the chest and then the pelvis.) Double check your hierarchy!



Next… we need to figure out what we want to animate IK and what we want to animate FK. Some people will completely convert their Rig to IK, this is not a necessity. You can choose to run the arms IK and keep the hands FK. Once again this is all personal preference. Here is how I will set up my rig… IK Chains in the Arms, Legs and Feet. Everything else will be ran FK. I choose to do this because personally I think it is much easier to animate the spine and fingers with FK animation.



Also, we are going to use the IK Limb Solver on the Arms and Legs and we will use the HI Solver on the shoulders and feet. But before we get into the IK chains we need to look at what is called a Preferred Angle. To do this all you need to do is make sure your bone structure is angled in the way you wish it to bend. If you notice the arms and legs of my Rig are slightly bent. This is critical, if your bone structure is straight 3D Studio will not apply the IK correctly because it does not know which way you want to bend. It just needs a slight angle to figure it out, but with out that slight angle it will not work!

To start the IK Setup, select the shoulder bone in the Right arm. Under the Animation menu you will have the IK Solvers and under there you will have your four options, remember we will only use IK Limb and HI.



Select HI… you will now need to select the end bone of the IK chain, we are creating a simple chain to use to animate shoulder movement, so choose the bicep. You will notice a “cross” appear at the shoulder. This is an important object known as the Goal. You will be able to move the goal and it will update your bone structure. The important thing to realize is that once you apply an IK Chain you will no longer be able to grab the shoulder bone and move it, you have to move the Goal!



Now, select the Bicep and choose an IK Limb Solver. The IK Limb Solver is meant just for limbs and will only solve through two bones, so please only use the Limb Solver on limbs.



Next, select the palm of the hand. You will notice that the IK Chain’s Goal will be created in-between the bone you select and the parent bone… in this case the wrist.



If you grab the Goal in the wrist and move it around you will notice it will move and bend the arm. A problem that may occur though is the angle that the arm bends at. By default an IK Chain can only bend in one direction. You can adjust it by the Swivel Angle… with the IK Goal selected go to the Motion Panel. Here you will have the option to change the angle as well as the Goal size!



Later we will set up control objects so we do not have to animate the Swivel Angle directly. But that will come near the end!

Repeat process on opposite side to complete the arms.



The legs are very similar to the arms; we will use an IK Limb Solver in the leg and HI Solvers in the feet. There are many setups for the foot; this setup is a straight forward approach with the bones mimicking the actual geometry of the foot. The main placement of the foot should be in the ankle not the heel. This is a common mistake, but it will be important for animation that the foot rotates from the ankle. To do this, just make sure that the joint is in the ankle.



To start… select the Thigh and select the IK Limb Solver. We are going to want to place this chain so that the Goal is in the ankle so make sure to choose the first bone in the foot. Some rigs may show a chain that goes all the way from the hip to the tip of the toes. I do not recommend this workflow because it limits the way you can animate your toes to one direction. And even with a simple walk cycle you will want to animate the toes rotating up and down. So we need to actually place additional chains to get the right effect.



Now the setup for the foot. Remember to use HI Solvers and not the IK Limb Solver. We are going to need to place in two chains in the foot. We will need one chain from the ankle to the base of the toes, and another from the base of the toes to the tip of the toes. You will notice that there is a nub on the end of the foot; this is an important object to IK Chains only. We will not animate this bone or even skin this bone; we need it just to create the IK Chain at the end of the foot. Remember that the chain needs to be placed between a parent and a child object, so with out these end bones you will not be able to place a chain at the end of the foot. Here are two views of the foot setup.



Once again repeat the leg setup on the opposite side of the rig to complete the IK Chain setup.



At this point we are done with the IK Chains, but we are not done with the Rig. We now need to setup our Control Objects. These are objects that we will link the IK Chains to. This way we will not set keys on the IK Chain themselves but we will animate the control objects. This is proper workflow in industry and is important to follow. But before we move on to this step make sure to double check your rig and make sure you have the proper IKs. Also, move around the Node and notice that the IK Chains say in world space while the Node moves. This is the wonders of IK.



Once you are happy with the IK we will be able to move to the next step. Remember that this Rig only uses IK in the Arms and Legs. You may want to add IK to the fingers or spine it is up to you. Usually the more complicated the Rig the more IK is applied, for this tutorial I am keeping things simple and this rig will be very easy to animate because of this. If you wish to add more chains please feel free to. The whole trick will be to create a control object for each IK Chain. So more chains just means you will need to create more objects. Remember you do not want to animate the IK Chains directly.

Here is the Control Object I will need.



1. Is called a gyro, it will be the control object for the shoulder IK, but more important it will allow us to animate the Swivel Angle with out having to animate a spinner! To create this object I started with a spline circle, and converted it to an Editable Spline. Under the element sub-object I cloned and rotated it 90 degrees on each axis. It will mimic the rotate tool’s gismo.

2. This will be the control object for the hands. It is just a modified spline circle to resemble a hand.

3. This is a spline circle that we will use for the knee control. We will have the legs IK chain use this object as its target. This way once again we will not have to animate the Swivel Angel directly.

4. This will be our foot control. Once again this is just a modified circle. This control will actually have two IKs linked to it! And will be the only control object that gets more than one.

5. We will need a toe control so we can animate the toes bending backwards. I also adjust the pivot point of this object to the base of the toes. That way we will animate rotation instead of position, and of course this is true to how toes actually move.

6. We will need control objects for the opposite side as well.

7. We need a control object to move the node… pelvis.

8. We now need a new NODE to move the entire rig. We will only use this object to place the rig in X, Y, Z axis.

9. REMEMBER TO NAME CONTROL OBJECTS!!!!!!!

Let’s start with the foot. The first thing we will need to do is link the Toe control to the Foot Control. Then place the Foot Control under the Foot bones.



Link the toe IK to the Toe Control and link the ankle and foot IK to the Foot Control. Do not make the mistake of linking backwards. It is important that you always link the IK to the Control Object!



The Knee. Place the Knee Control object in front of the character’s knee. Link the Knee Control into the Foot Control that way when you move the foot the knee will go with it. Then you can adjust it with this Control Object. To get this effect we will need to use the Target option of the IK Solver. We need to select the IK Solver that is in the ankle. That is the IK Solver for the leg so it will control the leg bending, and the direction of the bend.



After setting up the Target, I had to slide the Control object out to put my foot back in place.

Shoulder. Align the Shoulder Control Object to the shoulder IK Solvers Goal, and link the IK Goal to the Shoulder Control Object.



Next we are going to Wire the Swivel Angel to the rotation of the Shoulder Control. To do this, select the Control Object and right-click to open up the quad menu. You will see Wire Parameters…



You will get a small dialogue box; choose Transform -> Rotation-> and Z Rotation.



You will now need to select the arms IK Solver in the wrist. Make sure when you select it you still have your rubber band (stretchy dotted line) active, otherwise it will not work. When the dialogue pops up choose Transform -> Swivel Angle.



This will bring up the Wire Parameters Dialogue box. Here were the acts of wiring takes place. You will only have to choose the Control Direction and Connect the two together. This should pretty much work by default. After you have connected them rotate the Control object and notice how the arm rotates with it. If yours is rotating backwards you will have to negate the rotation with a negative sign and update it. Then everything should work fine.



The Hand. This will be an easy one. Just align the Hand Control to the hand of your rig. Once you have done this simply take the IK Solver in the wrist and link it the Hand Control Object. Now you will be able to move the hand and arm by moving the Control.



Now you will need to repeat these steps on the opposite side. Also take the Control Node and place that around your pelvis, and place the IK NODE Control at the base of your character feet. Also once you have completed these steps you can hide your IK Solvers. We will not need them, so it just helps to clear up your viewports.



There is one last step. We now need to create a new hierarchy with the Control Objects and the Rig. Here is a diagram to help:



Now remember when you animate this rig you are not animating the IK Solvers but the Control objects. Also, we left the spine and hands as FK, so you will still need to apply key frames to these objects. Remember when animating, you are only keying the FK Objects and the Control Objects!