From 25f71bc9d1fa59c3cc7e91e4556b5f14f162bfec Mon Sep 17 00:00:00 2001 From: Ky Date: Sat, 2 Dec 2023 18:40:30 -0800 Subject: [PATCH] Use normalized normal vectors instead of unnormalized ones --- webgl/lessons/webgl-3d-lighting-point.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webgl/lessons/webgl-3d-lighting-point.md b/webgl/lessons/webgl-3d-lighting-point.md index 112ba9f31..4321d08f6 100644 --- a/webgl/lessons/webgl-3d-lighting-point.md +++ b/webgl/lessons/webgl-3d-lighting-point.md @@ -98,8 +98,8 @@ and so would not be a complete unit vector vec3 surfaceToLightDirection = normalize(v_surfaceToLight); - - float light = dot(v_normal, u_reverseLightDirection); - + float light = dot(v_normal, surfaceToLightDirection); + - float light = dot(normal, u_reverseLightDirection); + + float light = dot(normal, surfaceToLightDirection); outColor = u_color;