# Babylon 5.0.2 Mesh.MergeMeshes flips backface of GLB Models

**URL:** <https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043>\
**Category:** Bugs\
**Tags:** mesh, glb\
**Created:** [April 3, 2022, 5:56pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043 "2022-04-03T17:56:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [April 3, 2022, 5:56pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/1 "2022-04-03T17:56:16Z")

</div>

[This PG](https://playground.babylonjs.com/#YIU90M#781) shows an imported GLB file that gets all meshes merged into one (used to work in v5.0.0-beta.2 - I don’t know since what version it broke).

[PG of the bug](https://playground.babylonjs.com/#YIU90M#782) → now with v5.0.2 release, all glb meshes render from the backface after merging meshes (see ERROR---------- comment part).

cc @Deltakosh

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [April 3, 2022, 6:18pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/2 "2022-04-03T18:18:57Z")

</div>

When was 5.0.0 beta2?  
I’m also having a merged meshes issue (with clones) since about 3 weeks. I remember it happened after a nightly update on a friday (I think 3 weeks ago).  
@RaananW is aware of it and said he would have a look into merged meshes next week. May be this can be added to it. May be it’s part of the same.

---

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [April 3, 2022, 6:20pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/3 "2022-04-03T18:20:12Z")

</div>

> [@mawa](#):
>
> When was 5.0.0 beta2?

about two months ago

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [April 3, 2022, 6:21pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/4 "2022-04-03T18:21:20Z")

</div>

OK, well my problem occured as I said only about friday 3 weeks ago. Before that was working fine.  
Edit: Apologies, time is running 😉  
From my files, the problem occured since February 26. If this can help track it.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 4, 2022, 3:31pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/5 "2022-04-04T15:31:01Z")

</div>

Cc @bghgary

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 4, 2022, 4:00pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/6 "2022-04-04T16:00:53Z")

</div>

I’m actually having a look right now 🙂

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 4, 2022, 4:15pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/7 "2022-04-04T16:15:56Z")

</div>

Ok fix is there:  
[fix mergemesh when using RH by deltakosh · Pull Request #12334 · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/pull/12334)

---

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [April 4, 2022, 6:00pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/8 "2022-04-04T18:00:46Z")

</div>

Awesome, thanks for lightning fast fix ).

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [April 5, 2022, 9:07am UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/9 "2022-04-05T09:07:34Z")

</div>

Does this fix solve your issue as well?

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [April 5, 2022, 12:59pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/10 "2022-04-05T12:59:45Z")

</div>

Sadly no, not just now. I believe I will have to check on it again.

---

<div class="post-metadata">

**Author:** ![Jukka](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@Jukka](https://forum.babylonjs.com/u/Jukka)\
**Post date:** [April 7, 2022, 11:57am UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/11 "2022-04-07T11:57:28Z")

</div>

I run to this same problem when merging meshes after importing GLB-file. I’m using BabylonJS v5.1.0.

> **[Babylon.js Playground](https://playground.babylonjs.com/#E99FHV)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 7, 2022, 4:22pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/12 "2022-04-07T16:22:35Z")

</div>

cc @syntheticmagus or @ryantrem as I think we may have a bug in how we use the transform here (in 5.1.0 the mesh is not where it should be)

Edit: It is not related to transform. The transform is actually correct. The material orientation seems off. I’m working on it

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 7, 2022, 5:25pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/13 "2022-04-07T17:25:09Z")

</div>

Ok I have a fix 🙂  
PR: [Removed flip faces for MergeMeshes by deltakosh · Pull Request #12360 · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/pull/12360)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 9, 2022, 1:21am UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/14 "2022-04-09T01:21:48Z")

</div>

> [@ecoin](#):
>
> PG of the bug

Ok sorry it will be fixed with next release 🙂

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 9, 2022, 1:32am UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/15 "2022-04-09T01:32:03Z")

</div>

> [@ecoin](#):
>
> PG of the bug

This [PG of the bug](https://playground.babylonjs.com/#YIU90M#782) does not work and it is expected because you need to reset the overrideMaterialSideOrientation:  
[Blender Mesh Test | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#YIU90M#794)

`mesh.overrideMaterialSideOrientation = null;`

This is because that value works with the previous material but as you removed the material you do not need to override the side orientation anymore

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [April 9, 2022, 1:52pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/16 "2022-04-09T13:52:00Z")

</div>

I’m still having a problem with my merged clones in my project  
[https://media-geneva.ch/demos/bjs/motorcycle/motorcycle-cdn-preview.html](https://media-geneva.ch/demos/bjs/motorcycle/motorcycle-cdn-preview.html)

Are yours @Deltakosh @RaananW now done with the fix of merged meshes? Should I return investigating (what was working prior to release of v5) or should I still wait for a fix to come? Thx,

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 9, 2022, 2:14pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/17 "2022-04-09T14:14:29Z")

</div>

Once my pr will be merged you should be good

So let’s say you can retry on Tuesday?

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [April 9, 2022, 2:54pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/18 "2022-04-09T14:54:57Z")

</div>

Got it. will do. Meanwhile, have a great WE.

---

<div class="post-metadata">

**Author:** ![Jukka](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@Jukka](https://forum.babylonjs.com/u/Jukka)\
**Post date:** [April 11, 2022, 8:31am UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/19 "2022-04-11T08:31:34Z")

</div>

With latest version of BJS MergeMeshes seems to work now as expected - thanks @Deltakosh !!! 👌

---

<div class="post-metadata">

**Author:** ![ecoin](https://avatars.discourse-cdn.com/v4/letter/e/8e7dd6/32.png) [@ecoin](https://forum.babylonjs.com/u/ecoin)\
**Post date:** [April 15, 2022, 11:25pm UTC](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043/20 "2022-04-15T23:25:21Z")

</div>

> [@Deltakosh](#):
>
> This [PG of the bug](https://playground.babylonjs.com/#YIU90M#782) does not work and it is expected because you need to reset the overrideMaterialSideOrientation:  
> [Blender Mesh Test | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#YIU90M#794)

Isn’t this going against backwards compatibility?  
In 4.2 it only works without **mesh.overrideMaterialSideOrientation = null;**  
but now in 5.2, it only works with **mesh.overrideMaterialSideOrientation = null;**

I checked using your PG.

Having upgraded Babylon three times, now I’m really afraid of it, because something always breaks.

Each time I wasted at least one to two days of unnecessary debugging. Then followed by several days waiting for the released fix to be on npm. Usually accompanied by dirty quick fixes while waiting (manually changing code in npm node\_modules before bundling) in order to release to production.

I mean breaking changes between versions is normal, as long as they are clearly stated in Change logs, and without promising people that it’s backwards compatible.

[Next page](https://forum.babylonjs.com/t/babylon-5-0-2-mesh-mergemeshes-flips-backface-of-glb-models/29043.md?page=2)
