Graphics Reference
In-Depth Information
Mathematics of Skinning
Bind poses are constructed primarily to allow the content creator to have a simple, easy-
to-understand method of creating the model. However, the use of bind poses has some
implications for the mathematics of our solution. When the vertices are created and placed
around a model, the positions are defined relative to the coordinate space of the entire
object—not with respect to its bone. This means that before we can apply the hierarchical
bone transformation matrix to a vertex, it must be converted from an object space position
into a bone space position. However, since there are multiple bones allowed per vertex, this
can't be done in the modeling package. Instead, this must be performed during runtime,
when each bone transformation matrix is created.
Fortunately, matrix transformations can easily perform this kind of operation.
Essentially, we are trying to "undo" the bone transformations of the bind pose, and then
reapply the bone transformations of the currently desired pose. This is done by creating a
transformation matrix that applies the inverse of the bind pose transformation before ap-
plying the desired pose transformation matrices. This is shown in Equation (8.8), where the
final transformation matrices for each bone are the product of the inverse of the bind pose
and the current bone transformation matrix:
(8.8)
We can visualize what this series of transforms does by considering the vertices as-
sociated with a hand bone. In the bind pose, the vertex positions are specified in the object
space of the model. When the inverse of the bind pose is applied to the vertices, the hand
bones moves to the origin of the coordinate space, so that it would be sticking out of the
origin at the wrist. Then the current bone pose transformation moves the hand bone to the
desired location. Since the bind pose is always the same throughout the lifetime of an ap-
plication, it can be calculated once at startup and then simply applied to the hierarchical
bone transformation matrices that are calculated for each frame of animation.
8.2.2 Implementation Design
With a clear concept in mind about how vertex skinning works, we can now design an
implementation to be used with Direct3D 1 1. We can use a similar rendering configuration
to what we saw in the static mesh rendering section, with two exceptions: we need to incor-
porate the new per-vertex data into the vertex structure, and then the portion of the vertex
shader that transforms the vertices must be updated to use an array of bone matrices and
perform the bone-weighting interpolation. We will take a closer look at each of these steps.
The updated algorithm layout is shown in Figure 8.12 for reference during the discussion.
Search WWH ::




Custom Search