10. Skeletons, Part II
By now, you have learned how to create a skeleton, how to bind the mesh to it,
and how to reshape the skeleton and mesh together. All of this is easy to do, but
there's more going on than meets the eye. In this chapter, we will look at the
process a little more closely.
Select a vertex in your mesh and choose "Edit Points..." from the Mesh menu.
You will notice two items in the window called IK Bone and
IK Weight. IK stands for inverse kinematics, which is the name for
the way the skeleton bends to follow your movements as you drag a joint around
the screen.
The first option allows you to specify which bone of the skeleton this particular
vertex is bound to. Any time that bone moves, the vertex will move with it. By
repeatedly selecting vertices, choosing "Edit Points...", and setting bones for
them, you can manually bind the mesh to the skeleton. You usually will not need
to, since the "Bind Points to Skeleton..." command does this for you automatically.
If you simply bound each vertex to a bone, the results would not be very satisfying.
When you adjusted the skeleton, sharp creases or distortions would appear in the mesh
around every joint, as the vertices bound to one bone moved in a different direction
from those bound to the next bone over. To reduce this problem, a vertex can be
"partially bound" to two bones at once. That is what the IK weights are for. If
you bind a vertex to a bone with a weight of 1, it is completely bound to that bone.
As you reshape the skeleton, its position will be entirely determined by the motion
of that bone. On the other hand, if you set its weight to 0, it will not be bound
to that bone at all. Instead, it will be entirely bound to that bone's parent
in the skeleton. And if you assign a weight between 0 and 1, it will be partly
bound to each of the two bones, and its motion will be determined by a weighted
average of their respective positions. By using intermediate weights around each
joint, you can smooth out the distortions in the mesh and create much more
satisfactory results.
Most of the time, you do not need to worry about any of this. The "Bind Points to
Skeleton..." command generally does a fairly good job of figuring out which bone to
attach each vertex to and what weight to use. There may be times, however, when you
are not satisfied with its assignments, and in these cases you will want to adjust
them by hand.
One other command that is very useful is "Temporarily Detach Skeleton" in the Skeleton
menu. Suppose you have carefully bound your mesh to its skeleton, adjusting weights
until you are satisfied with the result. Then you decide you want to change the
position of the skeleton slightly without affecting the mesh. You could
select all the points, set them to be not bound to any bone, move the skeleton,
and then manually reattach them again. That would be a huge amount of work, however.
Instead, you can simply select "Temporarily Detach Skeleton". Whenever this
option is selected, moving the skeleton has no effect on the mesh regardless of
whether points are bound to it or not. When you are done moving the skeleton, you
can simply deselect the option again.
Now let's look at a single bone in more detail. Select a bone and choose the
"Edit Bone..." command from the Skeleton menu. (Of course, it is really a joint
you are selecting, but this is one of those cases where things make far more sense
if you think in terms of selecting bones, not joints. For example, if you want to
control how a character's arm bends at the elbow, you do not select the elbow,
but instead select the joint at the end of the arm. This seems bizarre if you think
in terms of joints, but makes sense if you think in terms of bones. You want to
control the motion of the forearm. Therefore you want to select the forearm, which
means clicking on the joint at its end.) A window will appear which
looks something like this:
Who would have guessed that a single bone could have so much information to display
and edit! The window is divided into four sections, one for each of the bone's
four degrees of freedom. A degree of freedom is a way in which the bone can
move or change.
The first two, X Bend and Y Bend, describe the orientation of the
bone relative to its parent bone. To understand these, hold your arm pointing
straight out to one side. Move the arm slowly up and down. You are changing its
X Bend angle. Now move it slowly forward and backward. You are changing its Y
Bend angle. Make sense?
The third degree of freedom, Twist, describes a rotation of one end of the
bone relative to the other around the axis of the bone. To understand this, hold
your arm straight out in front of you with the palm facing down. Now rotate your
hand so the palm faces upward. That is your forearm's twist degree of freedom.
Notice how one end of your forearm (the end connected to your wrist) rotates by
180 degrees, while the other end (the end connected to your elbow) hardly moves
at all.
Of course, real bones are solid objects whose ends cannot rotate relative to each
other. Your forearm actually contains two different bones which rotate around each
other to create the twist of the arm as a whole. For our purposes, however, it
is much easier to use only a single bone and allow it to have an internal twist.
The final degree of freedom is Length. Once again, real bones are solid
objects which cannot change in length. But why should you be bound by reality?
So what are all of those options for each degree of freedom? First and most
importantly is the actual value for the angle (or distance in the case of length).
You can edit it by typing in a new value, or by dragging the handle on the dial
next to it.
Next there is the "Lock" checkbox, which allows you to lock a particular degree
of freedom so that it cannot be changed. Each degree of freedom represents a
way in which the bone can move, and different bones move in different ways. For
example, your upper arm can rotate up and down (X Bend) and forward and back
(Y Bend), but it cannot twist or change length. Your forearm can bend at the
elbow in one direction (X Bend) but not in the other direction (Y Bend). Imagine
how strange it would look if an animated character had elbow joints that could
bend in any direction, just like a shoulder joint!
Next, you can restrict the range of motion for a degree of freedom. For example,
your forearm can go from being completely straight (0 degrees) to being quite sharply
bent inward (perhaps 150 degrees). But it cannot bend inward any further than that,
nor can it bend outward at all. Setting ranges for each degree of freedom is important
for making an animated character move in a realistic fashion.
If you want still more control over the motion of a degree of freedom, you can set a
comfort range for it. This is a subset of its allowed range over which it
moves most easily. As it moves outside its comfort range, it becomes stiffer and moves
less easily. Thus, although it can still move all the way to the end of its allowed
range, it will usually tend to remain within the comfort range.
Finally, you can set an overall stiffness for each degree of freedom which
determines how easily it moves. Suppose, for example, you are modelling an animal
with a long tail, and you place a series of several bones along the length of the
tail so that it can bend freely. To bend the tail, you want to simply lock the
joint at the base of the tail, select the end of the tail, and drag it. You may find
that you are not satisfied with the way it bends, however. Perhaps it bends too
much at the end and not enough near the base. You can fix this by increasing the
stiffness of the joints near the end. Or perhaps it bends too much near the base and
not enough at the end. In that case, you would increase the stiffness of the joints
near the base.
If all of these options sound a little overwhelming, don't worry! You can safely
ignore most of them, especially the stiffness values and comfort ranges. They are
a handy tool once you get more comfortable working with skeletons, but they are only
that: a tool which you can use or not as you choose.