fix: flip normal only by view direction — fixes both cubes and spheres
Previous fix flipped normal by both light AND view direction: if (dot(N,L) < 0) N = -N; if (dot(N,V) < 0) N = -N; This double-flip broke spheres: when light is behind sphere, front faces get N flipped by light (now facing away from camera), then flipped back by view — but back faces get flipped once, causing inconsistency. Correct approach: flip ONLY by view direction: if (dot(N, V) < 0.0) N = -N; This ensures the normal always faces the camera. Faces pointing away from light naturally get NdotL=0 (no lighting) — correct behavior. Spheres keep smooth normals, cubes get inward normals fixed.
This commit is contained in:
Binary file not shown.
Reference in New Issue
Block a user