In the previous movie, we put the finishing touches on our head and neck rig
by addressing space switching and general cleanup issues.
In this movie we’ll set up the basic leg joints
and explore the relationship between IK, FK, and the result joints.
Start by opening the file “10-0-Character_Rigging_part10_start.mb”
or by using your own file from the previous lesson.
First, let’s middle-drag left_leg_GEO out of the hidden emma_GEO group node.
Our basic leg joints will consist of a thigh, shin, foot, ball, and toe joint.
Switch to the side view and, from the Animation menu set, select the Skeleton > Joint Tool.
Start by creating a joint at the leg geometry, preferably at the bottom of the hip geometry.
It helps to use human anatomy references
to better approximate joint positions as you create them.
From there, create additional joints at the knee,
the ankle,
the ball of the foot,
and finally at the end of the toes.
Notice we’ve built a slight bend into the knee. This will help us later when we create our leg IK solver.
If you return to the perspective view,
you’ll find that Maya has actually built our leg joint hierarchy in the center of the scene.
We’ll use the front view to roughly move it in the X axis until it’s at the middle of the leg geometry.
Freeze the transformations.
Next, let's set the local joint orientation of this hierarchy.
You can use the "Toggle Local Axes Visibility" button
to show the local rotation axes of all selected joints.
This time we want our primary axis to be X so it goes along the bone,
and we want our secondary axis to be Y with +X as world orientation so that Z points forward.
As we covered in the torso rig, we choose our joint local orientations
so that the common tasks of rotating the shin back, or the ankle down,
produce positive rotation values.
Consistent joint behavior will ease the animator's day-to-day work.
Rename the joints “leftThigh _result_JNT”, “leftShin_result_JNT”, “leftFoot_result_JNT”,
“leftBall_result_JNT”, and “leftToe_result_JNT”.
You'll notice however that our foot joint and foot geometry don't line up.
In general, you'll find it a lot easier to work with joints that are parallel to one of the major axes.
However, here that's unfortunately not the case.
The foot geometry is slightly bent to face away from the Z axis.
We'll fix this by rotating the foot joint temporarily around the Y axis to match.
Once we've sliced up and parented the correct geometry to it,
we'll then zero the rotation back out to make the foot straight again.
We'll rotate the ankle with "Rotate mode" set to "World",
since we want it to remain straight. This is fine since it's just a temporary rotation.
Just make sure you set it back to "Gimbal" mode afterward.
Now let’s slice up our geometry.
In the side view, using the Extract command as we did in part 2 of this series,
separate the leg into multiple pieces based on the joint positions.
We don't need to use the Cut Faces tool this time
since the original mesh topology has edge loops in all the right places already.
So instead, just extract based on the existing topology.
When you’re done, delete the history of the left_leg_GEO group node
and rename the new geometry sections appropriately.
Before we parent our geometry to this result leg chain,
we’ll want to use it to create our IK and FK legs.
If we look back at our torso and neck, recall that we used a system
in which an IK spline controlled the majority of our result joints
with a simpler FK joint chain acting on top of that.
However appendages like the arms and legs work differently.
Rather than having the two systems working directly with each other,
we’ll actually have two distinct leg chains working autonomously: one IK and one FK.
We’ll then use one or the other (depending on the needs of the situation)
to drive the result leg chain, which in-turn will drive the geometry.
In general, IK, which works in world space, is good in situations
where you need to plant the desired body part in a spot independently of the rest of the body.…
…while FK will give us more precise control over the exact movements
of the appendage in question, resulting in better ballistic arcs,
and thus more fluid, human-like movements.
With that said, let’s duplicate the result joints twice.
And rename them with the IK and FK suffixes respectively.
We use duplicates because this assures us that not only will the joints
be in the exact same spots as the result joints,
but also that their local rotation axes will carry over.
With the duplicates created, we can now parent the geometry to the result joints.
Be sure to move each of their pivots to their respective joint.
And delete the leftover group node.
A quick test of all the result joints confirms the geometry looks good in motion.
Now we can zero out all the joint rotations at the foot joints
to straighten out the bind position as we mentioned before.
Don't worry that the geometry no longer lines up perfectly with the leg.
Freeze the geometry's transforms.
Now as we said before, we want to drive the result leg chain
using either the IK or FK hierarchies depending on the situation.
To accomplish this, we could certainly use constraints as we have on the torso rig.
However in this case, we're going to try a different method.
We’re going to use a Blend Colors node to “blend” between the positions
of each IK and FK joint on their respective result joint counterpart.
There are a few of reasons for this.
First, it’ll keep our Outliner cleaner
since we won’t have so many constraints nested in our joint hierarchies.
Second, node calculations evaluate faster than constraints,
and a boost in performance is always a good thing,
especially once your entire character rig is assembled.
Finally, it will be a lot easier to animate a gradual “blend” between an IK and FK position
using this method versus an orient and point constraint.
Select all three joint chains and open the Node Editor.
Show the connections.
Press Tab and type blendColors.
Rename this node “leftThigh_rot_IKFKChoice”.
Hook up the leftThigh_IK_JNT's "Rotate" attribute to "Color 1".
Notice that Maya automatically creates a UnitConversion node
to properly adapt the incoming vector data type into a color type.
Now connect the leftThigh_FK_JNT’s "Rotate" attribute to "Color 2".
Finally, connect the output of the blend color node to the leftThigh_result_JNT’s "Rotate" attribute.
Now if you rotate either the IK or FK thigh joint, the result thigh joint goes with it…
…well, at halfway at least.
This is because by default we’re getting equal influence from the leg we’re moving,
and the one that’s remaining still.
We can tweak this balance using the blend color node’s “Blender” attribute.
In this example, we’ve set up our connections so that a value of 0 drives the leg via the FK chain,
and a value of 1 controls it via the IK chain.
It would've been perfectly valid to reverse this relationship,
so long as you stay consistent to it when rigging other parts of the body as well.
Now create blend color nodes for each of the remaining joints
and hook them up to the rotations just like you did with the thigh.
Once you've created those five blend nodes, your laid out DG should look like this.
Don’t forget to do another set for the translations as well.
This will be important for matching the joint positions during a squash or stretch,
which we'll look at a little later.
When you're done, you should end up with ten blend nodes in total.
Now just zero out any previous rotations, and test to make sure that the result joints
abeing influenced by both the IK and FK joints.
We’ve now set up the framework for our IK/FK legs.
In the next movie, we’ll build an IK/FK switch to swap between leg states.