(I tried to create a Playground to show this issue but was running into CORS issues trying to load an external GLB file )
ISSUE
The lighting is on the wrong side of the reflected mesh β this seems to only happens w/ loaded meshes. Specifically GLB meshes (which is the only type Iβm using). When I look at both sides of a GLB mesh I can see that the light source in the reflection is coming from the opposite direction(s). (Iβm using a DirectionalLight)
Hopefully the screenshots below explains the issue better!
I also decided to try out a loaded OBJ mesh to see if it was the same issue β but it seems the OBJ has no reflection at all?
Please let me know if thereβs anything I can try, to fix this on my end. Thanks!!
ββββββββββ
GLB Front Side View β Lighting on wrong side of GLB mesh
GLB Back Side View β Lighting on wrong side of GLB mesh
ββββββββββ
OBJ Example β No reflection
Hey @sebavan, I saw you were helping with another MirrorTexture bug. Do you happen to know anything about this issue Iβm running into?
obj are using an additive reflection, so black would not be visible cause not added.
In pbr reflection is controlled with metalness but the highlights would not reflect as a symetrical value. They would only be where the light hits the faces which could be what you are experiencing in the first case.
A repro would really help to ensure it is what is happening.
Thanks for getting back to me!
Hereβs a repro β https://playground.babylonjs.com/#B9UHX6
β’ Small box = Babylon
β’ Middle / Wood Box = GLB
β’ Other box = OBJ
The light is coming from one direction. All boxes are lit correctly. The reflection is correct for the Babylon mesh and OBJ mesh but not for the GLB mesh. As you rotate around the scene youβll see that the light is hitting the opposite side of the OBJ mesh thatβs being reflected.
Figured it out
I was able to fix it by setting:
material.twoSidedLighting = false
This made me realize that this comes directly from Blender. So if anyone else runs into this you can either modify the twoSidedLightning
property in Babylon or in your Blender material turn ON Backface Culling before exporting
Ohhhh yes this would not help