6a473bdc535651be7226dc2af80e2dac36d18578
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.
Description
AI powered Game Engine
23 MiB
Languages
C#
97.8%
GLSL
1.8%
Shell
0.2%
PowerShell
0.2%