Rigging- Leg IK with reverse foot tutorial

The following is a tutorial that explains the character rigging process for an IK leg with reverse foot setup. Among other things, this rig can be used for character walk cycles.

This leg rig will be part of a full ‘broken hierarchy’ rig and more parts will be added in future posts –
• Step 1 – Joint Creation – 
First, I create all the joints that I need for the rig. In this case, I have created a set of locators which will aid with the joint placement.
 Most importantly, we need to be aware of joint orientation. It is vitally important to understand how orientation effects the operation of the rig. The default in maya and the mostly common approach is to use local orientation  with x as the primary axis. Most automated rigging solutions follow this convention so its best to stick to defaults of x pointing down the bone.
Leaving ‘orient joint to world’ unchecked could be referred to as choosing ‘local orientation’.
So stick with the default of x as the primary axis
jointOrientation
So we use the joint tool at the default settings and start placing our joints. In this case, I am going to start with a basic hip chain. Then I will create a chain for the leg and parent it to the hip which will be the root for the entire hierarchy.
So I create a joint for the hip, then a second joint down toward the crotch. Note the hierarchy in the outliner.
rootJoint
Now I create a new joint chain for the left leg starting at the hip, then knee, ankle, ball and toe.
legJoints
Now I parent the hip joint (at the top of the leg chain) to the root bind joint to add it to the hierarchy. A new bone is automatically drawn to show the connection-
parentLeg
Personally, I like to add this entire joint chain to a ‘leg joints layer’ now so that we can template it out of the way later.

• Step 2 – Reverse foot – we are now going to create a joint chain called the ‘reverse foot’. The reverse foot chain will not be used for skin binding. It is a dummy system created to reverse the hierarchy of the foot and give snapping points for the IK handles.
I want the joints to operate in world space i.e normal world orientations where y is up, x is left and right and z is depth. Since they are not real joints and are not part of the hierarchy system that the geometry is bound to, we can keep it in world space which will simplify the control system.
orientToWorld
I lay down 5 joints but note the order of the hierarchy, this is the whole key to the reverse foot setup, the order of the joint hierarchy flows from the heel to the toe, then comes back in the inverse direction and picks up the ball – place the joints according to the illustration below – numbered 1 through to 5.  Note the area I circled in the outliner to point out where the hierarchical flow is reversed. I have also turned on the local joint rotations to illustrate that they are in world space, not local.
reverse
Now I I grab this joint chain and place it on its own layer called ‘inv_Layer’. Again this will be handy later when we need to template it out of the way.
• Step 3 – Inverse Kinematic Setup
We have now created all the joints for the left leg. It is time to add the IK. The first thing we need to do before adding the leg IK is to set preferred angle.
It is especially important in this case because the leg has been built completely straight with no Z rotation in the knee. The IK needs to make a decision on which way to bend the knee and so far has no information to base that on.
Select the knee joint and rotate y in the direction of the knee bend. Then right click on the knee bind joint and select set preferred angle. Best to enter local rotation mode before doing this.
IKdefault
We want to change the solver setting to RP or rotate plane. This will give us a pole vector or in other words, control over what the knee points at
ChangeToRP
Using the above settings, click the hip joint and then the ankle joint. We will always name our IK after the joint that they finish at, so name it ‘ik_L_Ankle’.
Note where I have circled- you can change the type of solver after the fact in the attribute editor if you need to.
makeRPsolve
Now change the IK setting back to the default of SC solver. This stands for single chain- we are only spanning two joints with the next 2 solvers so there is no need for a rotation plane.
Create one handle from the ankle to ball joint, hit Y to re-invoke the tool then make another handle from ball to toe. Remember to name them after the joint they finish at –
3IKs
Now we parent the IK handles to individual joints in the reverse foot-
Parent the Ankle IK to the Ankle joint
Parent the Ball IK to the Ball joint
Parent the Toe IK to the Toe joint-
IK_parenting
Now the heel joint can control foot lift and rotation, the toe joint can control heel lift pivoting at the toe and the ball joint can control rotations pivoting at the ball.
• Step 4 – Duplicating for the right side
There are two options for recreating all this for the right leg. One option is to mirror the joint chains across. Just note that because it involves joint orientations and IK it can be problematic and buggy. If you do decide to mirror the left leg joint chain to the right, I find its best to do it before parenting the leg to the hip bind or adding the IK. Select the root joint in the chain -(i.e the hip joint in the case of the leg) and use the ‘mirror joint’ tool. In this case, mirror across the YZ axis. It will mirror the whole chain. Also, stick with the default of ‘behaviour’ rather than orientation. This will make life easier for the animator as the rig will operate in a consistent across the symmetry and animation can be copied from one side to the other with predictable results.
If you have used a consistent naming convention, you can search and replace names, for instance swapping ‘L’ for ‘R’ so that you don’t need to spend time renaming joints.

The second option is to repeat all the above steps (apart from the initial hip bind joint creation) for the right leg. It doesn’t take long once you get the hang of it and it is another chance to practice – you probably need it!

• Step 5 – Control system

Build a foot control roughly in the shape of a foot. Make sure to freeze transformations when it is ready. Snap the pivot to the ankle joint.
footController
Select the foot controller, then the main joint in the reverse foot chain and apply a parent constraint. No need to ‘maintain offset’ as they share a pivot point and are both operating in world space.
This foot control now controls the root joint of the reverse setup which in turn controls the ankle IK, so this will control translates of the foot.
Now, if we used this to control rotations, we would always pivot at the ankle which would be useless when trying to complete a walk cycle. So we will build some individual controllers for rotations that pivot at the ball, the heel and also at the toe.

Create an arrow shaped controller, snap it to the back of the foot control. Dupe it and snap it the front of the foot control. Dupe it again and place it above the ball joint.
Freeze the transformations on all three – this gets rid of the ‘garbage values’ sets everything to zero an puts orientations to world which, if you remember, matches the orientation of the reverse foot joint chain. So they are all ready to work together nicely.
Snap the pivot for the heel control to the heel joint.
Snap the pivot for the toe control to the toe joint.
Snap the pivot for the ball control to the ball joint.

This is what it should look like-
heel_toe_ball_controls
Now to connect the rotations of the controllers to the joint rotations. We are dealing with direct connections here i.e if we rotate the heel control 90 degrees in x, we want the heel joint to rotate 90 degrees. When this is the case, rather than constraints, we can use the connection editor.
Open the connection editor, load the Heel control on the output side, load the heel joint on the input side –
connect rotate X to rotate x
connect rotate y to rotate y
connect rotate z to rotate z
the rotate values in the channel box for the joint turn yellow to show that the are being controlled.
conectionEd_rotations
Repeat this process for the toe control and the ball control.

Now we need to create a hierarchical system whereby the controllers will move with the rig. This is simple, we need to follow the hierarchy of the rig itself.
My summary of this logic –
when the heel JOINT is rotated, it affects the toe and ball because of the hierarchy, so when the heel CONTROLLER moves, it makes sense that we want the toe and ball CONTROLLERS to move.
when the toe JOINT is rotated, it affects just the ball because of the hierarchy, so when the toe CONTROLLER moves, it makes sense that we want the ball CONTROL to move.
when the ball JOINT is rotated, it affects just itself because it is last in the hierarchy, so when the heel CONTROLLER moves, it doesn’t need to move either of the other CONTROLLERS.
So –
Parent the heel control to the foot control
Parent the toe control to the heel control
Parent the ball control to the toe control
parentControllersTogether
Just a couple more steps to go before we are done-
• Step 6 – Pole vectorcreate a simple 4 pointed arrow (or similar). Snap it to the knee joint to get the position just right, then move it in Z so that it is far enough away that the IK handle will not cross over it at its most extreme position, this would cause the knee to flip.
Freeze transforms, delete history. Select it, then the ankle IK and apply a pole vector constraint, default of weight 1 is fine, we want it to 100% control the knee direction –
poleVector
• Step 7 – Cleanup –

1/ go through all the controllers and lock and hide all the attributes that we don’t want the animator to have access to.
2/ Clean up the outliner, delete anything unnecessary and add all the controllers to a group.
3/ Template the joint layers so that they wont be accidentally selected, we don’t need them.

• Step 8 – TestingAnimate your rig, push it to its limits to test its ‘breaking strain’ or even better – hand it over to someone else to animate and report back any problems.
Here it is a quick display of the rig functioning –

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s