Mesh out-of-place in my GLB Exported file

Hello,

This is a follow-up to my previous post about mesh positions changing in the scene during GLB export: Unexpected Mesh Transformations on GLB Export

I’m using GLTF2Export, and when I open the generated .glb file in the babylon sandbox, some of the meshes are out-of-place.
In the previous post, alexchuber suspected pivots in some of the meshes, which are not supported in the glTF exporter

Here is a playground with my project : https://playground.babylonjs.com/#OVGL4F#6

Thanks again,

Max

1 Like

After taking a closer look, it turns out the issue is indeed related to pivot points.

While it’s technically possible for the glTF exporter to support pivot points, implementing it wouldn’t be straightforward for a few reasons:

  • glTF doesn’t have a native concept of pivots. Instead, it relies on using a parent node to define a mesh’s center of transformation.
  • User expectations vary. Depending on the use case, a pivot could be baked into the mesh’s transform, applied directly to the vertex data, or represented as a separate parent node.
  • There are tricky edge cases. Animations and instancing, for example, introduce additional complexity.

For now, I think it’s safer for users handle pivot adjustments in their own pre-processing step. That said, it might be worth opening a feature request to see what others think :slight_smile:

In the meantime, I’ve added a pre-processing step convertPivots to your playground to make the mesh export visually correct. It restructures the scene by converting each pivot point into a new parent node, which glTF can handle natively:

2 Likes

Thank you so much! The convertPivots function that you’ve added has unblocked me, so I’ll be able to continue with my project. It’s perfect, thank you for your help and your explanations.

Have a nice day

Max

2 Likes