Hey guys,
It does look like a bug to me but I’m not 100% sure.
I’ve been importing a gltf file exported from 3dsmax. Everything looks great as long as I leave the materials exported from 3dsmax (are these by default pbr materials btw?).
If I create a new pbr material it seems like the faces get flipped.
I tried with a few examples in the playground and get the same behavior.
https://www.babylonjs-playground.com/#PN1NNI#146
Let me know what you think.
Thanks!
Chris
It is intented as you need to at least set the sideOrientation as the gltf loader would:
pbr.sideOrientation = scene.useRightHandedSystem ? BABYLON.Material.CounterClockWiseSideOrientation : BABYLON.Material.ClockWiseSideOrientation;
It is to account for the winding order difference existing in gltf
Thanks that works but I’m not sure to understand the explanations…
So should I always use that anytime I’m creating a pbr material that I’m planning to apply on a gltf imported mesh?
Is that specific to gltf and doesn’t happen on Babylonjs files?
Thanks for your help
Gotta say that would be extremely difficult to do, if you were trying to do it on purpose.
Thing is no matter where you take a model from, some specifities might be set in the materials. Winding Order is one of them as culling would be.
So in order to swap materials you need to at least rely on compatible materials. In the case of your current scene, the sideOrientation is the main property, on other materials, it might have been different.
So it is specific to the material that was previously applied to the mesh.
Noted thanks for your help!