From: Andy Belle-Isle Date: Sat, 7 Sep 2019 05:15:51 +0000 (-0400) Subject: Flips the X axis of the normal map instead of the light direction when model is flipped X-Git-Tag: v0.2-alpha~30 X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=c9f8936fcb1afb07ead095f5c560473dc97eb3f6;p=clyne%2Fgamedev2.git Flips the X axis of the normal map instead of the light direction when model is flipped --- diff --git a/Shaders/world.frag b/Shaders/world.frag index c97c880..2b5ab5e 100644 --- a/Shaders/world.frag +++ b/Shaders/world.frag @@ -34,13 +34,13 @@ void main() for (int i = 0; i < LightNum; i++) { vec3 LightDir = vec3(LightPos[i].xy - fragCoord.xy, LightPos[i].z); - if (Flipped == 1) - LightDir.x = -LightDir.x; float D = length(LightDir); vec3 N = normalize(NormalMap * 2.0 - 1.0); vec3 L = normalize(LightDir); + if (Flipped == 1) + N.x = -N.x; vec3 Diffuse = (LightColor[i].rgb * LightColor[i].a) * max(dot(N, L), 0.0);