Inconsistent glTF Exports Between Babylon 5 and Babylon 6

Hi, everyone! It appears that when exporting a scene to glTF from Babylon 5 I get different transform information than when I export it from Babylon 6. I’ve put together a really simple playground to demonstrate what I mean.

Running that playground on WebGL2 with Babylon version 6.25.1 exports a visually identical, but actually very different scene when compared to running it with WebGL2 with Babylon version 5.71.1.

The scene consists of a plane and two cubes; one parented to the other.

Exporting with Babylon version 5.71.1, nodes which have no parent (the plane and one cube) and are unrotated within Babylon, when exported to glTF both have a:

position: (x: 0, y: 0, z: 0) // no difference
rotation: (x: 0, y: 180, z: 0)
scale: (x: 1, y: 1, z: 1)

The same nodes exported with Babylon version 6.25.1 have:

position: (x: 0, y: 0, z: 0) // no difference
rotation: (x: 0, y: 0, z: 180)
scale: (x: 1, y: -1, z: 1)

Nodes which do have a parent (the other cube) also differ between versions, but differently than the un-parented nodes.

Child cube exported from 5.71.1:

position: (x: 1, y: 1, z: -1)
rotation: (x: 0, y: -45, z: 0)
scale: (x: 1, y: 1, z: 1) // no difference

Exported from 6.25.1:

position: (x: 1, y: 1, z: 1)
rotation: (x: 0, y: 45, z: 0)
scale: (x: 1, y: 1, z: 1) // no difference

What is the purpose of this difference between the exported transform data between versions? Is this an expected behavior? I appreciate any help in advance! Thanks!


@bghgary did we do changes on the export between 5 and 6?

Yes, this PR changes the way we convert handedness. @mclevenger Is this causing issues for your scenarios?

It is. We allow our users to get path traced renders of their scenes by exporting the scene to a glb and sending a request to our rendering service referencing that glb as content. In order to reuse glbs which have already been exported, we also pass overrides for nodes within the scene in the render service request. These overrides are just a selection of node properties from the running Babylon scene. For example, we can take the transform of a node that had moved in the Babylon scene since exporting to glb and apply it to the node in our rendering service. This all worked just fine until updating to Babylon 6. I thought it may have had to do with handedness and so I began to treat our overrides as though they were right handed transform data when applying them in the rendering service. This almost works, but not quite.

1 Like

Is there any way to reverse this locally/easily?

No, there is not unfortunately. The code that was there originally was buggy in a number of ways. Would you be able to provide a repro showing what you are doing so that I can look for a solution?

1 Like

I don’t have something like that at the moment and it might be a bit involved to put together in a playground. The basic issue though is that we are building a scene in Babylon, exporting it to glTF, going back to the Babylon scene and moving nodes around, and then applying the changes to the glTF later, such that the Babylon scene and the glTF are still identical even though the export was done before the changes were made. Sort of using the glTF as a snapshot to which changes can be applied. Applying those changes used to get us to an identical scene, but now it totally breaks things as you can imagine. I’ll see if I can put something together that resembles what we’re doing.

Would be amazing, just a cube/or a capsule would be more than perfect.