three-gpu-pathtracer
three-gpu-pathtracer copied to clipboard
Ensure normal is reported on the right side
If normals are somehow incorrectly generated we could force them to the same side as the face normal in the shader with the following change:
normal *= side;
normal *= sign( dot( faceNormal, normal ) );
But we'd have to see if tangents need to be flipped, as well.
I think this is a data problem and doesn't have to be fixed within the renderer, instead it could be some type of preprocessing that occurs within Three.js. I think the main thing to do properly is that if the determine of the transform matrix is negative, we still render the object properly. This was discussed and addressed here: https://github.com/mrdoob/three.js/issues/4904