GlTFLoader will copy extra empty nodes during loading

When exporting the model using Sandbox, there will be duplicate empty nodes appearing when reloading.

This is the original sandbox URL:
https://sandbox.babylonjs.com/?assetUrl=https://models.babylonjs.com/alien.glb

Loading the original Sandbox model:

Reload the exported model using Sandbox:

Is this reasonable?

cc @alexchuber

1 Like

It’s actually the loader introducing the duplicate nodes
E.g., in the original glTF, there is only one node for “AlienHead”, but there are two in the scene hierarchy once imported. I assume this has to do with how we load skeletal animations? cc @ryantrem

It is true, though, that the exporter does its best to remove extra nodes created by the loader. Just not these-- they’d be messy to do at best.

This is by design at the moment.

See glTF 2.0 Skinning | Babylon.js Documentation near the bottom:

Furthermore, the skinned mesh is allowed to have child nodes that have meshes or additional hierarchies. Thus, in additional to creating a skinned mesh, the glTF loader also creates a node that represents the glTF node with the skinned mesh, in case this node is animated or has additional child nodes.

2 Likes