MergeMeshes on loaded glb cause faces to not display correctly

Hi, I’ve encountered a weird bug when using MergeMeshes that causes faces to not render properly. This didn’t happen previously, I’ve run into this upgrading from 5.0.0-alpha.48 to 5.2.0 (and it still doesn’t work in 5.20.0)

See - you can comment/uncomment lines 42/43 to see mergemeshes breaking the mesh

@Deltakosh - I remember you fixed a similar issue on mergemesh (after the code change). Go some input here?

This very much sounds and matches the version for a similar bug I had/have and is also still not fixed.
I did not have more time (nor desire) to investigate. Ended-up using the latest working version (5.0.0-beta11).
I had the feeling it could be related to the materials upon merge. I eventually managed to fix some of the issues by changing the order of merged meshes according to whether they were using a single or multimat. But then, eventually, on another use case with no multimats, I got the same bug. Something, just something must have gone wrong with this update done (if I recall properly) after February 26.

I posted in this post which is I believe somehow related:

You can override the side orientation before merge

This works as a temporary fix, but this is still a bug+has perf costs, right?

This happens to me with every glb exported from the tool kenney shape so unless the tool is setting some weird properties on the glb this isn’t a small edge case

Exactly like it was the case here Babylon 5.0.2 Mesh.MergeMeshes flips backface of GLB Models - #20 by ecoin

Unfortunately the override parameters needs to be unset before merging meshes: