Wrong sideOrientation during importing GLTF with backfaceCulling === false (regression)

4.2.0-alpha.12
I use 2 gltf models, one attached to bone in another. Scene.useRightHandedSystem is off. In material on attached mesh sideOrientation is counterclockwise. In version 4.0.3 sideOrientation was clockwise.

In my opinion it’s because in revision 0e5389659afcb290d06e2409f9bd2390e2f839b4 in src/Meshes/mesh.ts:1774 overrideMaterialSideOrientation property use only if backface culling is on.

In previous revision or if I just delete backfaseCulling checking in source code - all works as expected.
If I change backfaceCulling in inspector just once or invert sideOrientation in inspector - all works as expected.

Sorry for my english

Could you provide a repro in the playground as it is really hard to repro on my own :frowning:

Adding @bghgary in case he has more clue than me without repro ?

@sebavan
https://playground.babylonjs.com/#FQV6WD#2

lights on model material is inverted in latest version, but normal in 4.0.3

but if I toggle sideOrientation on material or change backfaceCulling twice in the inspector - all is fine

@bghgary could you have a look ? I wondering if it comes from some of the 4.1 fixes.

I looked at it briefly. Certainly seems like a bug. Touching the debug settings in the inspector also resets the lighting.

I think I agree the issue comes from this change. @Deltakosh I don’t understand this change well enough to know what is happening. Can you take a look when you are free?

I ll have a deeper look today.

Will be fixed in the next nightly.

5 Likes