fix: flip normals when facing away from light/view — fixes cube lighting
Root cause: cube.obj has inconsistent winding order. Many faces have normals pointing inward (e.g. back face normal = +Z instead of -Z). With cullMode=None, both sides render, but inward normals cause: - No diffuse lighting (NdotL < 0 → max() = 0) - Wrong shadow bias (slope-dependent bias uses wrong NdotL) - Inconsistent shadow edges on cube faces Fix: in fragment shader, flip normal if dot(N,L) < 0 or dot(N,V) < 0 This is the standard approach for double-sided rendering with non-watertight geometry or inconsistent winding order.
This commit is contained in:
Binary file not shown.
Reference in New Issue
Block a user