Game Development Reference
In-Depth Information
For an accurate (based on the physical definition of the strain tensor) simula-
tion, Chapter 10 provides much better results.
Although the calculations could be applied to the mesh during a preprocessing
stage to reduce computational effort, the technique is very well-suited for real-
time processing for the benefit of interactivity of the animation. The skeleton-
driven vertices can be subject to external forces of any kind (see Figure 14.13 ).
Special collision-detection algorithms might be needed here [Teschner et al. 05],
which is unfortunately a lot more computationally intensive. This is beyond the
scope of this chapter.
Appendix: Calculating the Optimal Rotation
For the shape-matching algorithm, a rotation is needed that best matches a given
set of points to another set of points (with an equal number of points) by mini-
mizing their distance-squares.
Since we already matched the centers of mass (so there is no translation nec-
essary for optimization anymore), we define the relative locations by
q i = x i
x cm
p i = x i
x cm
We start off by searching for a linear transformation A such that c i = Aq i +
x cm matches x i best, and then we try to extract the rotation that A contains. The
quantity we have to minimize can now be written as
m i ( Aq i p i ) 2 .
i
We should now focus on the contribution of one neighbor i and omit the mass
for now. We can simplify our notation for the next few calculations to
p ) 2 =( Aq
p )( q T A T
p T ) .
( Aq
Now we write out the multiplications component-wise (take care: u, v, w are
matrix and vector entry indices now, not particle indices):
=
u
2
A uv q v
p u
A uw q w
p u
A uv q v
u
v
v
k
2 p u
v
A uv q v +
u
p u .