Jump to content
  • Advertisement
Sign in to follow this  
judeclarke

Blending two animations

Recommended Posts

I have implemented basic animation into my engine and now I would like to blend two animations together. The way I have it set up is there are 

 

AnimtionClip

  • This is a serialized data containing its skeleton and bone information

AnimationInstance

  • Keeps track of how long it has been running, and the final transforms of the animation clip. Along with if it was active and if it is looping

AnimationController

  • Has an array of AnimationInstance's

 

Assuming that I wanted to blend two animations that had the same skeleton, I am not sure how I would. My first naive attempt was to take two AnimationInstance's and multiple their final transforms together. This didn't get quite what I was looking for, as they would blend but the character would double in size. Am I only supposed to multiple certain parts of the final transforms together?

Share this post


Link to post
Share on other sites
Advertisement

Commonly this is done by taking two produced poses and blending between those. A basic start would be to lerp() between the two poses' bone transformations. Avoid doing this at the matrix level, but rather on the SRT level (scale, rotation, translation) of each bone in the skeleton.

For example:

finalSkelPose[boneIndex].translation = lerp(skelPose1[boneIndex].translation,skelPose2[boneIndex].translation, t);

Where t is your blend weight between 0 and 1.

Do the same for rotation (SLERP) and scaling (if you support it) then convert the final outcome to skin matrices.

Good luck!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!