Exporting a skinned mesh those skeleton is rigged by another skeleton

Now this is more a note than a question, and maybe more related to Blenders gltf Exporter than to Babylonjs itself, sorry in advance.
But chances are that there are other creators arround here that will maybe deal with the same problem…

My current workflow for animated characters that are about to be exported looks like this (this could be not even Blender-specific):

  • Skinned Mesh(s), bound to a minimum skeleton via (vertex) weight groups
  • The minimum skeleton, controlling the meshes
  • More skeletons (“rigs”) controlling the minimum (why one would do this is another topic, but its pretty handy for complex animations such as walk cycles)

With this setup, only the controlling rigs will be animated and baked to actions.

But when exporting to gltf, my animations got lost most of the time, unless i put it all into a single successive, global animation and divded the actions after the import by frame number sagain. Pretty ugly.

The exported actions did not have any impact on the skinned meshes, because the minimum skeleton was not affected by animations in Blender directly, but only through constraints.

Finally i came up with the solution to bake all actions once more into the minimum skeleton manually, doing Visual Keying and Bake Data to Pose when Bake Action… in Blender.

Until now i did not find a way to prevent the export of the rigs completely, but at least the meshes are affected now by the (manually) baked actions as expected and occur as animation groups in the gltf.

I hope this saves someone some time of frustration as it really took me a while to figure out the problem and solution…

Adding @PirateJC and @JCPalmer but I feel like it is not supported (at least cannot skin skeletons)

Thanks :slight_smile: But as i said, i think the problem is rather on the Blenders gltf Exporter side.

It was very frustrating to not see the expected animation (-groups) that could be observed in Blender through the Bone Contraints (that are not supported in glft im afraid of)

Maybe im gonna write a script to fix this issue automatically, currently i simply bake every animation another time in the direct, minimum skeleton…

If anyone knows about a better way let me know.

Sounds like your control rig with constraints is what I would term an IK rig. Like the JSON / .babylon exporter, baking is going to be required. It is very bulky, I know, but the biggest problem is you can only “replay” stuff, not generate infinite animation based on little input, just loop.

The .babylon exporter does one form of optimization, though. If a bone does not change from the previous frame, it is skipped in the file.

In my own work, I use my own JS generator, which inlines geometry right in the Mesh constructor, so I can make Mesh sub-classes. I can also export / generate a key frame pose file from a Blender Pose library. On the JS side, I have an animation system, which can take those poses & interpolates the intermediate frames on the fly.

Still that was not enough, so last year I modified the animation system to add an IK editor right in BJS. It shortened the workflow both in steps & removed debugging requirements as it was made in BJS to begin with. What is now stored as “the animation” is the changes to the controls not bones, and just the key frames.

Unfortunately, this has taken me literally years, and really can not recommend this route. The only reason I can pull it off is I also wrote the modern version of the Blender exporter, and I structured it with the eye of generating files of different formats.