Advertisement Jump to content
Sign in to follow this  

Animation Blending

This topic is 4985 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have made an animation blending system, that can successfully blend a run and a walk animation, so it goes from running to walking. This works because both animations affect the same bones. However, when I try to blend a running animation with a waving one, it doesn't work anymore. Running steps will be half as long, and the wave will also only be half. I do it like this: I store the final result for each bone in quaternion+vector form. The result is in bone space. To the final result I add animations, scaled by the blending factors: final += animation1 * factor1 final += animation2 * factor2 The factors will together be 1.0f. This works as intended, and Im not surprised or anything to see the half animations. But what do I do if I want full weight of each animation? After all, they animate different parts, that doesn't interfere with each other, so it shouldn't be a problem. The system doesn't take kindly to me multiplying by 1.0f twice :) Has anyone been through this problem?

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
i've been through this.

the various solutions i've seen are:

1) treat "whole skeleton" anims and "sub skeleton" anims separately.

in this solution, which is what i ended up using, blends can be between a full anim and a sub-anim, as long as the hierarchies "match" -- the waving anim knows that it comes out of a larger hierarchy, and it has an offset that it will start updating at. i use a "pose" structure to hold results, so i would do this:

fill pose structure with walking anim
fill sub-pose structure with waving anim.
blend pose and new anim, but only some entries in the hierarchy

you can reuse your full anim blending code to blend sub skeleton anim poses, as long as the sub-skeletons match too. it's just when you combine the full and sub that you need to use a special offset (which i store with the animation data).

in this case, you generally want the "waving" anim to update a whole subtree of your skeleton -- not arbitrary bits of it.

2) dirty mask.

i explored this for a while: you could keep a dirty bit somewhere on the pose structure. (either with each result or then you have conditionals when blending. however, the conditionals make your code ugly, and i wasn't happy with this solution. it does support anims having "arbitrary" joints animated or not.

3) bigger more complex data structure.

you could build a bigger, more complex data structure of the animations you're using -- it's more graceful solution than the dirty bit. group your animation data per joint; then when you setup you animations for blending, you can setup lists of "animation data" that effects a particular joint. then you compute blend coefficients based on the amount of this data (2 animations, 1 animations, etc) and then run your blend code down the list.

does that give you any interesting ideas? i'm curious to see what other people have done too.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!