Game Engine Architecture

(Ben Green) #1

524 11. Animation Systems


the sampled frames available in the animation data. We can also use temporal
animation blending to smoothly transition from one animation to another, by
gradually blending from the source animation to the destination over a short
period of time.

11.6.1. LERP Blending

Given two skeletal poses {}


1
( ) 0
skel N
A Aj j


PP= = and {}

1
( ) 0
skel N
B Bj j


PP= = , we wish
to fi nd an intermediate pose PLERPskel between these two extremes. This can be
done by performing a linear interpolation (LERP) between the local poses of
each individual joint in each of the two source poses. This can be writt en as
follows:
(LERP) LERP ( ) , ( ) ,

(1 )( ) ( ).

jAj B j

Aj Bj

=β⎡⎤⎣⎦

= −β +β

P PP


PP


(11.5)


The interpolated pose of the whole skeleton is simply the set of interpolated
poses for all of the joints:

(^) {}
skel^1
LERP (LERP) 0.
N
j j

PP= = (11.6)
In these equations, β is called the blend percentage or blend factor. When
β = 0, the fi nal pose of the skeleton will exactly match PAskel; when β = 1, the
fi nal pose will match PBskel. When β is between zero and one, the fi nal pose
is an intermediate between the two extremes. This eff ect is illustrated in Fig-
ure 11.10.
We’ve glossed over one small detail here: We are linearly interpolating
joint poses , which means interpolating 4× 4 transformation matrices. But, as we
saw in Chapter 4, interpolating matrices directly is not practical. This is one of
the reasons why local poses are usually expressed in SQT format—doing so
allows us to apply the LERP operation defi ned in Section 4.2.5 to each compo-
nent of the SQT individually. The linear interpolation of the translation com-
ponent T of an SQT is just a straightforward vector LERP:
( LERP) LERP[( ) , ( ) , ]
(1 )( ) ( ).
jAj B j
Aj Bj

= −β +β


T TT


TT


(11.7)


The linear interpolation of the rotation component is a quaternion LERP or
SLERP (spherical linear interpolation):
(qLERP) LERP[(q ) , (q ) , ]
(1 )(q ) (q )

jAj B j
Aj Bj


= −β +β

(11.8a)

or
Free download pdf