Game Engine Architecture

(Ben Green) #1

566 11. Animation Systems


transitioning from one clip to another or from one complex blend to another,
the approach is always the same: We simply introduce a new, binary LERP
node at the root of the blend tree for the duration of the cross-fade.
We’ll denote the blend factor of the cross-fade node with the symbol λ as
before. Its top input is the source tree (which can be a single clip or a complex
blend), and its bott om input is the destination tree (again a clip or a complex
blend). During the transition, λ is ramped from zero to one. Once λ = 1, the
transition is complete, and the cross-fade LERP node and its top input tree can
be retired. This leaves its bott om input tree as the root of the overall blend tree,
thus completing the transition. This process is illustrated in Figure 11.55.

11.10.5. Animation Pipeline Optimization
Optimization is a crucial aspect of any animation pipeline. Some pipelines
expose all of their nitt y-gritt y optimization details, eff ectively placing the re-
sponsibility for proper optimization on the calling code. Others att empt to
encapsulate most of the optimization details behind a convenient API, but
even in these cases, the API still must be structured in a particular way so as to
permit the desired optimizations to be implemented behind the scenes.
Animation pipeline optimizations are usually highly specifi c to the archi-
tecture of the hardware on which the game will run. For example, on mod-
ern hardware architectures, memory access patt erns can greatly aff ect the
performance of the code. Cache misses and load-hit-store operations must be
avoided to ensure maximum speed. But on other hardware, fl oating-point op-
erations might be the bott leneck, in which case the code might be structured
to take maximum advantage of SIMD vector math. Each hardware platform

Tree
A Output Pose

LERP Output Pose

Tree λ
A

TreeB

TreeB Output Pose

Cross -FadeBefore

During
Cross -Fade

Cross -FadeAfter

Figure 11.55. A cross-fade between two arbitrary blend trees A and B.
Free download pdf