Weird imported/exported GLB structure

Hi guys,

I found a problem when importing/exporting GLTF model. My model has several nodes that contain sub-meshes that I exported it from Unity for testing. In Unity, PlayCanvas, and Blender, they all display the “single_node_multi_submeshes_*” node as a single node (with sub-meshes) information, but in Babylonjs this node is displayed as a TransformNode with multiple mesh nodes in it.

In PlayCanvas
image

In Babylonjs
image

Then when exporting the imported file (GLB export function in Debug Layer), the exported file is not in the same structure as the original model file. The “single_node_multi_submeshes_*” mesh is converted to GLTF’s node and its sub-meshes become individual meshes rather than primitives. This issue also happens in the newly created “box_merged” which has 2 submeshes I created at runtime.

Check it out
GLB import and export - submeshes problem | Babylon.js Playground (babylonjs.com)

Any suggestion?

cc @bghgary

This is a well-known problem with loading glTF into Babylon.js. It is unfortunately not a 1-to-1 mapping between the primitives of glTF and the submeshes in Babylon.js as it is currently implemented. We tried a few times in the past to make it work, but there were too many edge cases that failed. In the end, we decided to split them. Unfortunately, right now, there is no good solution for round-tripping glTF with multiple primitives at the moment with Babylon.js. It is something that has come up before, so maybe we can investigate a better solution for the next release.

3 Likes