Game Development Reference

In-Depth Information

Given our point positions
v
, our reference joints
R
, posed joints
P
, and matrix

of weights
W
, we can compute the deformed vertex positions
v
according to the

following equation:

n

R
−
1

j

v
i
=

W
ij

·

P
j

·

·

v
i
.

j
=1

In practice, the matrix
W
is sparse since it rarely makes sense to attach a vertex

to more than four joints. Knowing that, it's a good idea to check
W
ij
to see if it is

zero, and if so, that joint is skipped in the summation. Additionally, the matrix
R

remains constant so its inverse is also constant and can safely be pre-computed.

13.3.2 Understanding Skinning

Skinning can be understood on an intuitive level. The product of
P
j
R
−
j
v
i
results

in a vector that translates our input vertex as though it were attached to the single

joint
j
. To prevent a double transformation, we only want the difference between

the reference pose
R
and the current pose
P
, which is why we multiply
P
j
by the

inverse of
R
j
(effectively subtracting the rest pose from the final pose, giving us

a delta transformation).

This delta matrix records how much the joint has moved/rotated/scaled from

its original pose. The delta transformation
P
j
R
−
j
is then applied to the original

vertex
v
, resulting in a new position that represents how that joint would affect
v

if it had 100% influence over it.

But this is
smooth
skinning, not
rigid
binding. So we need to scale this vector

by
W
ij
and sum it with the contributions from all the other joints. Think of the

final vertex
v
as being the
weighted sum of a series of delta transformations
.

Technically, this is a weighted linear interpolation of intermediate points, each of

which is generated by a single influencing joint.

13.3.3 The Problem with Smooth Skinning

Everyone who has used smooth skinning knows that if we twist a joint towards

180
◦
, we get the infamous candy wrapper deformation. If we can picture this

algorithm as blending transformed points together (as described in the previous

section), we will immediately understand where this problem comes from.

Imagine a vertex weighted between just two joints. The resulting blended po-

sition lies somewhere on a line that passes through two points, each point coming

from the transformation of one of the influencing joints (see
Figure 13.1
)
. So a

weight of 0.5 to each joint with a 180 degree twist (along the length of the bone)

would have the final blended position lying at the halfway point on the line be-

tween the twisted point (from the twisted joint) and the original point (from the