three-gpu-pathtracer icon indicating copy to clipboard operation
three-gpu-pathtracer copied to clipboard

Ensure normal is reported on the right side

Open gkjohnson opened this issue 2 years ago • 1 comments

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.

gkjohnson avatar Apr 11 '22 06:04 gkjohnson

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

bhouston avatar Jun 22 '22 20:06 bhouston