565
Let’s assume that the walk movement is produced by a three-way average
between clips A, B, and C, and that the jump movement is produced by a two-
way average between clips D and E.
We want the character to look like he’s smoothly transitioning from walk-
ing to jumping, without aff ecting how the walk or jump animations look indi-
vidually. So during the transition, we want to ramp down the ABC clips and
ramp up the DE clips while keeping the relative weights of the ABC and DE clip
groups constant. If the cross-fade’s blend factor is denoted by λ, we can meet
this requirement by simply sett ing the weights of both clip groups to their de-
sired values and then multiplying the weights of the source group by (1 – λ)
and the weights of the destination group by λ.
Let’s look at a concrete example to convince ourselves that this will work
properly. Imagine that before the transition from ABC to DE, the non-zero
weights are as follows: wA = 0.2, wB = 0.3, and wC = 0.5. Aft er the transition, we
want the non-zero weights to be wD = 0.33, and wE = 0.66. So, we set the weights
as follows:
(1 )(0.2), (0.33),
(1 )(0.3), (0.66).
(1 )(0.5),
AD
BE
C
ww
ww
w
= −λ =λ
= −λ =λ
= −λ
(11.17)
From Equations (11.17), you should be able to convince yourself of the fol-
lowing:
When 1. λ = 0, the output pose is the correct blend of clips A, B, and C,
with zero contribution from clips D and E.
When 2. λ = 1, the output pose is the correct blend of clips D and E, with
no contribution from A, B ,or C.
- When 0 < λ < 1, the relative weights of both the ABC group and the DE
group remain correct, although they no longer add to one. (In fact, group
ABC’s weights add to (1 – λ), and group DE’s weights add to λ.)
For this approach to work, the implementation must keep track of
the logical groupings between clips (even though, at the lowest level, all
of the clips’ states are maintained in one big, fl at array—for example, the
Ogre::AnimationStateSet in Ogre). In our example above, the system
must “know” that A, B, and C form a group, that D and E form another group,
and that we wish to transition from group ABC to group DE. This requires ad-
ditional meta-data to be maintained, on top of the fl at array of clip states.
11.10.4.2. Cross-Fades with Expression Trees
Implementing a cross-fade in an expression-tree -based animation engine is a
bit more intuitive than it is in a weighted average architecture. Whether we’re
11.10. The Animation Pipeline