Book Image

Hands-On C++ Game Animation Programming

By : Gabor Szauer
Book Image

Hands-On C++ Game Animation Programming

By: Gabor Szauer

Overview of this book

Animation is one of the most important parts of any game. Modern animation systems work directly with track-driven animation and provide support for advanced techniques such as inverse kinematics (IK), blend trees, and dual quaternion skinning. This book will walk you through everything you need to get an optimized, production-ready animation system up and running, and contains all the code required to build the animation system. You’ll start by learning the basic principles, and then delve into the core topics of animation programming by building a curve-based skinned animation system. You’ll implement different skinning techniques and explore advanced animation topics such as IK, animation blending, dual quaternion skinning, and crowd rendering. The animation system you will build following this book can be easily integrated into your next game development project. The book is intended to be read from start to finish, although each chapter is self-contained and can be read independently as well. By the end of this book, you’ll have implemented a modern animation system and got to grips with optimization concepts and advanced animation techniques.
Table of Contents (17 chapters)

Crossfading animations

The most common use case for blending animations is crossfading between two animations. A crossfade is a fast blend from one animation to another. The goal of the crossfade is to hide the transition between two animations.

Once a crossfade is done, the active animation needs to be replaced by the animation that you are fading to. If you are fading to multiple animations, they are all evaluated. The ones that end the soonest are removed first. Animations that are requested are added to a list, and animations that have faded out are removed from the list.

In the following section, you will build a CrossFadeController class that takes care of the crossfade logic. This class provides a simple intuitive API that makes fading between animations simple with just one function call.

Creating helper classes

When fading an animation into an already-sampled pose, you need to know what the animation being faded is, it's current playtime, the length of the...