I know on material there is a function twoSidedLighting(). Looks it not working for all light types right? For example, it works directional lights but not environment (hdr) lights, etc.
Is there a solution making twoSidedLighting() working for environment lights as well?
Two sided lighting works by negating the normal if the current face is a back face. As the environment lighting reflect the view direction according to the normal, negating the normal does not change the result.
That’s because the formula for the reflection is: I - 2.0 * dot(N, I) * N.
If you negate N in the formula, you will see that you get the same result.
No, I’m asking what you think two sided lighting should do in the case of environment lighting ((if I’ve understood correctly, you think the rendering should be different)?
I found for some particular meshes, the two sided lighting with environment textures dont work well.
You can check this PG out:
In the PG, the entire shirt is a single sided mesh. The shirt collar is the back faces. The collar area reacts to the HDR textures wrongly (looks dark):
I’m just expecting both of the shirt and collar can be illuminated the same way by HDR textures. While with regular directional lights I don’t see the problem. (I disabled the direction light, you can turn it on to check out)
It is not that expensive but adds extra shader instruction which are useless with back face culling for instance (this case is by the way optimized in the material) but in general I would only enable it if needed.