MART Term 1, Lecture 8
Joints, Skeletons and Rigid Skinning


In our lesson about hierarchies, we keyframed the rotation of individual items of geometry to animate our grabbing claw. For such a simple system this works quite nicely, but it very soon becomes apparent that this is not the best way for something as complicated as a humanoid character. For something like that, we have to use a skeleton: based on a real-life skeleton, but with substantial differences. A CG skeleton is made up of objects which do not render, and control the position of the geometry of our character.


[screenshot: MART_T1L08_html_m4489f893]Let's start out by learning what a joint does. From the Animate set of menus, click on Skeleton → Joint Tool ❐. We won't change any of the options yet. Click on three points in the shape of a "(" in the front viewport, and press enter: you have now created a three joint chain.

Now try clicking on the joints, and rotating them. When you click on a bone, it selects the joint above it. This is because in Maya the bones don't really exist: they are drawn on screen to make it easier to see which joint is connected to which.

If you want to move a joint, just translate it the way you would any other object: if you want to move one without affecting its children, press the Insert key.

Get your bones into a sensible position, and we'll try attaching objects to them, as if we were making a very simple leg. But first, we want to make sure that we can get them back to this position at any time. Bring up the marking menu on the root of the chain (the root is the first joint in the chain), and select Set Preferred Angle. Now we can go back to this position at any time by clicking Assume Preferred Angle. Try it now: rotate the bones, then move them back this way.

[screenshot: MART_T1L08_html_600f3827]We can also decide which axes the bones can rotate in: in the options box of the joint tool, we can set their Degrees of Freedom. If you unclick any of the x, y or z, the joint will not be able to rotate in that direction. This is identical to locking the undesired rotation axes in the channel box.

Now bring in a couple of objects and place them over the bones (I'm going to use cylinders). Bring up an outliner, and you should see all of the objects we've just created: joint1, joint2 and joint3, as well as pCylinder1 and pCylinder2. The three joints are created in a hierarchy: this is vital for the skeleton to function properly. Joint chains work by having three objects parented in the correct way: it is possible to get the same effect by parenting three locators in the same way (though there are many additional things that joints can do that other objects cannot). Notice that if you move the joints out of this hierarchy, the bones disappear. We can "reroot" the chain in order to change which of the joints is the root: this is simply a quick way of rearranging the hierarchy. We can also disconnect a chain at a joint: this makes two new chains by duplicating the selected joint and attaching one copy of it to each end.

In order to get the objects to move with the bones, parent the objects to the correct joint in the hierarchy. Like we did earlier, try to think about which objects (and which joints) should move when each joint is rotated. Don't worry about getting it wrong, we can easily undo it, or even force the skeleton to Assume Preferred Angle if need be.

[screenshot: MART_T1L08_html_7b1f5f3f]The correct hierarchy is shown here: now we can move our "leg" around by rotating each of the joints. At this point I should mention that as soon as you have created a joint chain, it is important to label all the joints: rigging is one of the most complicated aspects of character animation, and the last thing we need is to make it more confusing by having lots of unnamed objects.

[screenshot: MART_T1L08_html_4068df61]Get a new scene, and create a 4 joint chain like the one shown here in a side view. Then, in a perspective view, move the joints over to one side or the other, and rename them. Now select the second highest joint, and go to Skeleton → Mirror Joint ❐. Set the Mirror Across to YZ, and replace the names. Now spend 10-15 minutes animating the two legs walking.

This type of rigging (known as forward kinematics or FK) is very popular, particularly amongst animators from a traditional background. It is great for making beautiful arcs of action, such as those made by a persons arm as they throw a ball or stride along. What it is less good at is, for example, making someone's hand stay attached to a door handle, or making their feet stay on the floor. Ideally what we want is the ability to say "I want the end of the leg to be here", rather than to say "I want this joint to be at this angle and this one to be at this angle" and hope that the foot ends up in approximately the right place. Inverse kinematics (IK) allows this type of goal-driven animation.

Inverse Kinematics

[screenshot: MART_T1L08_html_674f371]Let's set up a simple IK chain now. From the Animate set of menus, pick Skeleton → IK Handle Tool. This creates a line between our "foot" and our "hip", which indicates that there is an IK handle set up on the chain. Try moving the handle around: you should see that the joint chain (and therefore the cylinders) moves as well. If you can, decide before you start animating whether you are going to use FK or IK. Generally IK is used for legs, as they need to stick to the floor, and FK for arms (unless they are going to be grabbing on to stationary things, like a ladder). Either the position of the ikHandle or the rotation of the joints should be keyframed: blending between the two is not always terribly reliable, and as such is not for the faint of heart. We don't have as much control over the chain by just moving the ikHandle as we did rotating both bones, so we have an additional control: the pole vector. This lets us decide which way the knee points. If your chain is set to ikSCsolver (check in the attribute editor) you can simply rotate the ikHandle to move the pole vector, otherwise (if you have an ikRPsolver chain) select it and press t to bring up its manipulator. Try it now.

There are lots of attributes for an IK chain, but two particularly important ones: Snap and Stickiness (both in the IK Handle Attributes portion of the attribute editor). Snap doesn't let you move the ikHandle away from the end of the chain (which in my opinion is a useful thing to be able to do, so I generally have snap off), and Stickiness allows you to move the root of the chain without moving the ikHandle (very important, so I almost always have it set to Sticky).

A Complete Skeleton and Rigid Skinning

Let's build a simple skeleton. Open the scene:

[screenshot: MART_T1L08_html_m24b116d8]You will find a simple polymesh biped, which we will try to rig. Use the joint tool to create his legs in the same way as we did earlier (you could template the layer that the polygon object is on, so that it doesn't select when you try to click on a joint). Now create a series of joints to be his spine: wherever the character needs to bend (e.g. his neck) should be a joint (right).

ALWAYS draw joint chains in an orthographic view (e.g. front view for the legs) and then switch to a perspective view to move them in the other axis. If you try and draw them in a perspective view, all hell will break loose.

Now draw one of the arms in a top view, then again switch to a perspective (or front, if you prefer) and move each of the joints up individually (remember, pressing Insert means that the children of the joint won't be affected).

Now that we have all of the parts of our rig complete, we need to put them all together. Put the arms and legs into the hierarchy of the spine in the way that you see best: the fact that a bone will be created when you parent one joint to another should help you figure out what should be parented to where.

[screenshot: MART_T1L08_html_1835f0f8]Our finished basic skeleton should look something like the one shown here. It is important to realize at this point that it doesn't matter how close to a real skeleton we make this: so long as it moves well and deforms well, the fewer joints the better. Spend a little while now adding IK to the legs (only go as far as the ankle, not the toe), and try animating a walk. Before you start, keyframe everything as it is on frame 0, and Set Preferred Angle as well. Generally you should not animate the translate of a joint, only it's rotation and scaling: translating the root of a skeleton (our hips joint) is acceptable (especially because we have such a simple skeleton), but you should consider locking the translate channels of the other joints.

When you have spent ten minutes or so animating the joints, we'll have a go at skinning. Skinning is a way of making an object move with the skeleton. It takes as input the root of a skeleton, as well as the object to deform: select both of these (you may have to untemplate the skin first) and then go to Skin → Bind Skin → Rigid Bind ❐. Click Color Joints, and then Bind Skin. Now play the animation, and see the skin move. Notice the new operators (one for each joint) that have appeared in our construction history.

The rigid bind essentially parents each vertex to a joint in the skeleton. This works reasonably, except where the crossover happens from a vertex being parented to one joint to a vertex being parented to another: this causes very sharp creases, and looks bad. The alternative is to use smooth binding: this uses multiple joints, with smooth changes in weighting between them to give a much smoother deformation.