Animation Blending System

By: Michael Stewart

 

         Introduction

My program will accept a model in a T-pose, and two animations. It will play animation one, then at a set frame blend between animation 1 and 2 along an arbitrary curve. Systems like this have many uses but are primarily used in video games. A controllable character will have a set of animations each associated with a user input. As the user changes input instead of snapping into the next animation immediately many game studios will have a blending system to make the transition smoother.

 

Math Behind It All

      The animation files extracted give a series of 82 bones which are matrices in World Space Coordinate system. I created a data structure to store all bones in relation to their parent. I then got all matrices in the coordinate space of their parents. This will allow better interpolation between animations, because the interpolation is between relationships rather than just xyz position. To render and Chart, radar chart

Description automatically generatedutilize the blending function created in A5 I needed to get the blended animation bone matrices back in world space. For this I recursively blended the matrix for animation 1 and 2 then multiplied by the blended matrices of that bones parent. This will execute all the way until the root bone which does not have a parent and will have matrix in world space. This results in a blended world space coordinate matrix for that specific bone.

 

Calendar

Description automatically generated with low confidence

 

Features

This system is meant to give the artist as much control as possible when blending. My program can accept any two animations of arbitrary length. The user can edit variables in the init() function of main. They can control how many frames are offset before the second animation starts, the blending period, the rate at which the blending occurs(by default it is linear), and how far before the second animation starts the blending should take place(which would allow you to start blending into the first frame of the second animation).

My program also includes some nifty ways to visualize the blending. I have made it so that animation one and two are colored and appear at 50% opacity, while the blended animation is in full color at 100% opacity.

The user can advance one frame at time forward of backwards with the arrow keys to check the results.

 

Controls

 

Mouse

Left Click – Rotate view

Ctrl Click – Zoom in/out

Shift Click – Translate view

Key Board

1 – Display only animation 1

2 – Display only the blended animation

3 – Display only animation 2

0 – Display all animations

9 – Display all animations in a cycle in order

K – Advance through the bone structure

L – Decrement through the bone structure

 

DEMO

 

Animation 1                                                           Animation 2

 

 

Blended Animation

 

 

All At Once                                      Framing Through