Exported GLB not correct

I’ve moved the armature of an object then changed its skeleton but when I export to GLB the result is not the same as what’s in the scene. I have a playground here to demonstrate https://playground.babylonjs.com/#AI95IU#22 In the image the one on the left is from the BabylonJS scene and the one on the right is the GLB file that I’ve opened in Blender

Here You are changing the node name Armature which my have some specific properties when loading a glb as it is the common root between the skeleton and the model. I wonder if this might be the cause.

@bghgary could help confirming this one ?

In the final result there is only one skeleton. Not sure if that info helps.

My guess is it is a situation we can not necessarily represent. @bghgary talked to me about such a case once and I wonder if it is what we are facing here.

It looks like some meshes are being put under the wrong tree. I’m not sure why it’s doing that yet.

EDIT: It’s actually the loader doing this, but it’s expected.

The problem is that this scene structure is not exportable to glTF.

From https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#joint-hierarchy:

Only the joint transforms are applied to the skinned mesh; the transform of the skinned mesh node MUST be ignored.

Babylon applies both the skinned mesh and the bone/joint transforms but glTF ignores the skinned mesh transform (in your case, it’s the 0.2 you added to the y position). We probably can/should add a warning to the export when this happens.

Also, see here for some docs on glTF skinning in Babylon.js: glTF 2.0 Skinning | Babylon.js Documentation (babylonjs.com)

1 Like

Thanks a lot for confirming @bghgary !!!

Thank you for that info @bghgary You wouldn’t happen to know a workaround for this? Like is there some other way I can move the mesh and have that reflected in the GLB?

I think you can create another skin with similar joints except with an additional parent joint that is offset.

Do you know if that’s possible to do in realtime? I tried creating a bone then setting root’s parent as that new bone and moving that bone but that doesn’t work properly.

Can you send a PG with you tried? I can try to make it work.