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.
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.
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.
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.
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.
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
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.
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.
not a bug per se this is exactly why we have the BABYLON.Animation.AllowMatrixDecomposeForInterpolation=false property (@Cedric has the correct explanation)
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.