DirectionalLight, backFaceCulling, and StandardMaterial lighting

playground: https://playground.babylonjs.com/#Q9VZS9#1544

I noticed that a textured single plane mesh with StandardMaterial and backFaceCulling=false will show its texture on both sides, but it only does lighting on the side the normal faces (at least with a DirectionalLight). See playground above.

Is that pretty much expected? In my project, I’m using some buildings made of planes with backFaceCulling off and this situation surprised me. No point in using a single plane if the lighting doesn’t work. I can double up the faces in Blender but I just thought I’d check with the experts to see if I’m missing anything. Thanks

I’m not sure I understand, both sides are lit in this PG:

Maybe what you need is Material.twoSidedLighting?

2 Likes

Not sure exactly why you would want to have a plane textured and lit from both sides and then cull the backface (of a plane)? Seems like conflicting to me. :thinking: Want both sides textures and lit? I would say simply remove ‘backFaceCulling = false’ and I believe it should work as expected, doesn’t it? (sorry if I misunderstood)

YES! twoSidedLighting is what I was missing. It fixes my problem – THANK YOU

Yes, a misunderstanding. I don’t want backFaceCulling. I want the texture to show on both sides, and the lighting to be correct when either side is facing the light. As you can see in my original playground, the lighting on the face is only correct when the front face (the one with the normal indicator) is facing the light. When the backside is facing the light, the backside is all black. I had assumed that turning off backFaceCulling would be enough to make BJS treat both sides equally, but the twoSidedLighting is also required to get the effect I wanted and that’s what I didn’t know about until now. Playground with the fix: https://playground.babylonjs.com/#Q9VZS9#1547 See how both sides light up correctly when they are facing the light

1 Like