# GLB Export - displaced geometries and flipped orientations

**URL:** <https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592>\
**Category:** Bugs\
**Tags:** glb\
**Created:** [April 3, 2025, 7:38am UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592 "2025-04-03T07:38:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cyberphil](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cyberphil/32/28399_2.png) [@cyberphil](https://forum.babylonjs.com/u/cyberphil)\
**Post date:** [April 3, 2025, 7:38am UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/1 "2025-04-03T07:38:09Z")

</div>

Hi,  
we experiencing a problem with our scene in left handed coordinate system and I think it is cause of the changes in [GLTF Serializer rework. by SergioRZMasson · Pull Request #15869 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/pull/15869)

[GLB Export problem | Babylon.js Playground](https://www.babylonjs-playground.com/#BXC241#1)

 ![table](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/1/f1cb2f268c3363879ae2ddd871331eaf552f3df3.png)

Flipped orientation you see at the feets

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 3, 2025, 7:54am UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/2 "2025-04-03T07:54:15Z")

</div>

Hello,

Since the overall mesh looks fine except 2 feets out of 3, are you sure the problem isn’t already here on the original file ?

---

<div class="post-metadata">

**Author:** ![cyberphil](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cyberphil/32/28399_2.png) [@cyberphil](https://forum.babylonjs.com/u/cyberphil)\
**Post date:** [April 3, 2025, 8:41am UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/3 "2025-04-03T08:41:41Z")

</div>

actually it worked before updating babylonjs  
in the original the normals and positions are all correct.

after converting the tubes are misplaced (but not all of them) We have a lot of negative scalings inside.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 3, 2025, 9:36am UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/4 "2025-04-03T09:36:39Z")

</div>

cc @srzerbetto

---

<div class="post-metadata">

**Author:** ![srzerbetto](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/srzerbetto/32/20941_2.png) [@srzerbetto](https://forum.babylonjs.com/u/srzerbetto)\
**Post date:** [April 3, 2025, 1:38pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/5 "2025-04-03T13:38:45Z")

</div>

cc @alexchuber

---

<div class="post-metadata">

**Author:** ![alexchuber](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alexchuber/32/52000_2.png) [@alexchuber](https://forum.babylonjs.com/u/alexchuber)\
**Post date:** [April 3, 2025, 5:20pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/6 "2025-04-03T17:20:52Z")

</div>

To clarify, are you talking about the misplacement of the LinesMeshes here?

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/7/97b9b6bb19d7acf3a9d0f56db82a70ffa137d5c9.png)

---

<div class="post-metadata">

**Author:** ![cyberphil](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cyberphil/32/28399_2.png) [@cyberphil](https://forum.babylonjs.com/u/cyberphil)\
**Post date:** [April 4, 2025, 6:29am UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/7 "2025-04-04T06:29:12Z")

</div>

yes these are misplaced.

and

 ![f1cb2f268c3363879ae2ddd871331eaf552f3df3_2_690x391](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/6/7678e9e330979e97963ce78e67daeaab244aa671.png)

have flipped orientations

---

<div class="post-metadata">

**Author:** ![alexchuber](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alexchuber/32/52000_2.png) [@alexchuber](https://forum.babylonjs.com/u/alexchuber)\
**Post date:** [April 4, 2025, 4:13pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/8 "2025-04-04T16:13:35Z")

</div>



---

<div class="post-metadata">

**Author:** ![alexchuber](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alexchuber/32/52000_2.png) [@alexchuber](https://forum.babylonjs.com/u/alexchuber)\
**Post date:** [April 7, 2025, 5:56pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/9 "2025-04-07T17:56:53Z")

</div>

Gotcha, I see the issue now. The left-handed negative scales, used to mirror geometry, are leading to exports with:

1. incorrect winding orders (and/or side orientations) in a few places, including the feet’s edges
2. flipped transformations in the tubes

Will investigate this week, but it will take some thought. Mirrored geometry is a tricky case to get right when rendering and exporting.

Probably not feasible for you to do, but throwing it out there anyway: these problems can be avoided entirely by mirroring your nodes via rotations instead of negative scales.

---

<div class="post-metadata">

**Author:** ![alexchuber](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alexchuber/32/52000_2.png) [@alexchuber](https://forum.babylonjs.com/u/alexchuber)\
**Post date:** [April 8, 2025, 9:12pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/10 "2025-04-08T21:12:18Z")

</div>

Fortunately, the flipped signs weren’t because of the negative scales. This should fix your issue: [glTF Exporter: Fix LH -\> RH vertex data conversion bug by alexchuber · Pull Request #16456 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/pull/16456)

---

<div class="post-metadata">

**Author:** ![alexchuber](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alexchuber/32/52000_2.png) [@alexchuber](https://forum.babylonjs.com/u/alexchuber)\
**Post date:** [April 8, 2025, 9:12pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/11 "2025-04-08T21:12:43Z")

</div>



---

<div class="post-metadata">

**Author:** ![cyberphil](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cyberphil/32/28399_2.png) [@cyberphil](https://forum.babylonjs.com/u/cyberphil)\
**Post date:** [April 9, 2025, 6:43am UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/12 "2025-04-09T06:43:40Z")

</div>

good job!

---

<div class="post-metadata">

**Author:** ![cyberphil](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cyberphil/32/28399_2.png) [@cyberphil](https://forum.babylonjs.com/u/cyberphil)\
**Post date:** [April 22, 2025, 12:57pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/13 "2025-04-22T12:57:30Z")

</div>

Not sure if it is a similar problem after the glb export the bottom of the chair is a little bit flipped. it seems that the rotation of the bottom of the chair does not get exported at all. 2 Meshes are not rotated correctly

[GLB Export problem | Babylon.js Playground](https://www.babylonjs-playground.com/#BXC241#4)

problem:

 ![Screenshot 2025-04-22 145108](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/b/abfff564540007d0c28c181448cc78cb46b55ccd.png)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [April 22, 2025, 8:03pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/14 "2025-04-22T20:03:05Z")

</div>



---

<div class="post-metadata">

**Author:** ![alexchuber](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alexchuber/32/52000_2.png) [@alexchuber](https://forum.babylonjs.com/u/alexchuber)\
**Post date:** [April 23, 2025, 4:19pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/15 "2025-04-23T16:19:36Z")

</div>

Thanks, that was an amazing catch!

> <https://github.com/BabylonJS/Babylon.js/pull/16522>
>
> Our previous heuristic worked well for the most common cases (a bit surprising i…n hindsight), but it was incorrect.
> This new implementation is derived from a change the basis of the quaternion. It is the simplification off the following equation:
> \`q' = to\_quaternion(M \* to\_matrix(q) \* M^-1)\`
> \* where M is the conversion matrix \`convertHandednessMatrix\`, M^-1 is its inverse, 
> \* q is the input quaternion, q' is the converted quaternion.
> \* to\_matrix() and to\_quaternion() are derived from \[the figures and methods here\](https://d3cw3dd2w32x2b.cloudfront.net/wp-content/uploads/2015/01/matrix-to-quat.pdf)
>      
> It's possible to simplify further, but less readable IMO, so I've left its structure as similar as possible to the reference above.

---

<div class="post-metadata">

**Author:** ![alexchuber](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alexchuber/32/52000_2.png) [@alexchuber](https://forum.babylonjs.com/u/alexchuber)\
**Post date:** [April 23, 2025, 4:20pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/16 "2025-04-23T16:20:19Z")

</div>



---

<div class="post-metadata">

**Author:** ![cyberphil](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cyberphil/32/28399_2.png) [@cyberphil](https://forum.babylonjs.com/u/cyberphil)\
**Post date:** [April 24, 2025, 6:02am UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/17 "2025-04-24T06:02:45Z")

</div>

Thanks for your work!

When we find more problems, we let you know.

---

<div class="post-metadata">

**Author:** ![cyberphil](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cyberphil/32/28399_2.png) [@cyberphil](https://forum.babylonjs.com/u/cyberphil)\
**Post date:** [April 24, 2025, 6:23am UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/18 "2025-04-24T06:23:37Z")

</div>

Now something else, which worked before is wrong

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/e/deb841e52f273e9bdd8e67b21fb3032821ddffa1.png)

I will create a babylon scene

---

<div class="post-metadata">

**Author:** ![cyberphil](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cyberphil/32/28399_2.png) [@cyberphil](https://forum.babylonjs.com/u/cyberphil)\
**Post date:** [April 24, 2025, 7:07pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/19 "2025-04-24T19:07:34Z")

</div>

the table was our fault. We still had some workarounds before exporting cause of the issues. I removed them completely but we have a problem with the chair castors.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/a/fa4d7ef3b674640db9881d7f4de05f6a6dc8a38e.jpeg)

[GLB Export problem | Babylon.js Playground](https://www.babylonjs-playground.com/#BXC241#5)

---

<div class="post-metadata">

**Author:** ![alexchuber](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alexchuber/32/52000_2.png) [@alexchuber](https://forum.babylonjs.com/u/alexchuber)\
**Post date:** [April 24, 2025, 7:14pm UTC](https://forum.babylonjs.com/t/glb-export-displaced-geometries-and-flipped-orientations/57592/20 "2025-04-24T19:14:58Z")

</div>

Once this is merged, you should be good to go. I missed a sign when redo-ing our conversion function, which was important for managing zero-rotation cases 🙂

> <https://github.com/BabylonJS/Babylon.js/pull/16525#pullrequestreview-2792221312>
>
> Without this, we fail the zero rotation (and/or identity quaternion) cases :)
