Fix T63729 Eevee: Bump does not follow normal direction
authorClément Foucault <foucault.clem@gmail.com>
Thu, 6 Jun 2019 17:32:43 +0000 (19:32 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Thu, 6 Jun 2019 20:26:27 +0000 (22:26 +0200)
source/blender/gpu/shaders/gpu_shader_material.glsl

index 0840c704f3f0117228ce9131df97493e58ce17f3..4135151050e488a5673565afdf8fb4c63e55f790 100644 (file)
@@ -3376,7 +3376,7 @@ void node_bump(
     float strength, float dist, float height, vec3 N, vec3 surf_pos, float invert, out vec3 result)
 {
   N = mat3(ViewMatrix) * normalize(N);
-  dist *= invert;
+  dist *= gl_FrontFacing ? invert : -invert;
 
   vec3 dPdx = dFdx(surf_pos);
   vec3 dPdy = dFdy(surf_pos);