Problem with animation blending

I’m seeing a strange behavior with animation blending that I can’t make sense of. Here is playground link: https://playground.babylonjs.com/#14XU5B

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.

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

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 (babylonjs.com). 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.

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 https://playground.babylonjs.com/#IQN716#9 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);

not:

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. https://playground.babylonjs.com/#14XU5B#3

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.

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! https://playground.babylonjs.com/#14XU5B#6