Problem with animation blending

I’m seeing a strange behavior with animation blending that I can’t make sense of. Here is playground link:

I am trying to blend walk and idle animations. But one bone (mixamorig:RightShoulder) has a strange artifact. Suddenly, the scale and rotation change inexplicably.

I think this is a bug in babylon.js, but perhaps I’m just doing something wrong.

@thomlucc has done some work with animation from Mixamo.

He might be able to help out here.

1 Like

Adding @Evgeni_Popov who is also really well versed in this regards,

1 Like

Hi @nmrugg, welcome to the Babylon forum and community! @Evgeni_Popov will definitely be the of deeper advices here, but I can share my experience in case it can help:

I was struggling to combine several Mixamo animations into one model until I found this video that shows how to import all the FBX files coming from Mixamo into an empty Blender project and exports to a .GLB file.

You can find the details of my experience here: Animating Characters | Babylon.js Documentation ( I didn’t use animation blending but I’m thinking that, maybe in your case like in mine, it could be the animation rigging/combination into a single 3D file that introduced some issues.

1 Like

Thanks for the replies, guys.

I have seen that video, and it is helpful. But I found that importing the file as a .GLB and using animation groups was much less preformant, so I was trying to use the .babylon file. I didn’t try animation blending with animation groups. I will try to make another playground with that to see how that compares.

It seems weird to me that the animation works fine without blending, but even 0.01 causes noticeable glitches.

Your PG is quite similar to which does work. So it would seem it has something to do with the model or more probably the animations… I can’t help more, unfortunately.

Note that for the 2nd animation you should do:

walkAnim = scene.beginWeightedAnimation(res.meshes[0].skeleton,
    animations[1].from, animations[1].to, 0, true, 1);


walkAnim = scene.beginWeightedAnimation(res.meshes[0].skeleton,
    animations[1].from + 1, animations[1].to, 0, true, 1);
1 Like

Thanks for the help everyone!

There might be issues with the animation or mesh; however, I don’t think that is the whole picture because animation blending does work fine when I blend the animations in Blender.

I experimiented a bit.

I found that deleting the Z quaternion rotation key frames for mixamorig:RightShoulder in Blender and then exporting it as .bablyon produced good animation blending.

It seems odd to me that deleting rotation data fixed not only the bad rotation but also the bad scale values in the animation blending. Is it just me, or does that sound like a bug?

I also was able to get around the glitch by adjusting the Z quaterion rotation values. If I adjusted all of the values to be below 0 or far above 0, then there were no issues with animation blending.

Original values (broken)

Below 0.0 (working)

Above 0.0 (working)

The problem could be with the Blender to Bablyon exporter.

About the “animations[1].from + 1”, I found that if I didn’t do that then the animation didn’t loop properly. That could also be a problem with the exporter, perhaps.

1 Like

You could try to export the model as a .glb to know if the problem could come from the .babylon exporter.

I couldn’t actually figure out how to do animation blending with animation groups, but I did discover that setting BABYLON.Animation.AllowMatrixDecomposeForInterpolation=false fixes the glitch in animation blending!


I ran into the same problem with animation blending when using .babylon files.

This seems like a bug to me.

Trying to see if I get the same issue when using gltf. Now I’m struggling to get animation ranges with gltf.

Yeah. Something is wrong with Matrix.DecomposeLerp. There is a bug in there somewhere.

Could you share a playground reproducing the issue ? this is almost impossible to fix without one.

The playgrounds in this thread still show the problem. As you can see from this playground, when AllowMatrixDecomposeForInterpolation is on, the animation is messed up.

Maybe @Cedric would have an idea ?

I had an issue kinda like this 1 a while ago. Basically, when decomposing matrix, it’s impossible have only 1 solution. A same matrix can be obtained with different scale and orientation. When this happen, you get a flip. The solution so far was to provide the node and keep the same scale so only the rotation was updated.

see preserveScalingNode?: TransformNode

1 Like

I wonder if this should be applied in the animation code by default ? @Deltakosh any thoughts ?

not a bug per se :slight_smile: this is exactly why we have the BABYLON.Animation.AllowMatrixDecomposeForInterpolation=false property :slight_smile: (@Cedric has the correct explanation)

1 Like

I’ve since moved on to using gltf instead of babylon file export.

The issue I had with BABYLON.Animation.AllowMatrixDecomposeForInterpolation=false is that my model was scaling weirdly when it wasn’t supposed to be scaling at all.

1 Like