[Bf-blender-cvs] [f16bdf1075b] master: Fix T61380 Geometry normal node incorrect for backfacing faces in Eevee

Clément Foucault noreply at git.blender.org
Tue Mar 12 22:02:42 CET 2019


Commit: f16bdf1075b04ced7918d6f367e66d2f39f56724
Author: Clément Foucault
Date:   Tue Mar 12 18:49:02 2019 +0100
Branches: master
https://developer.blender.org/rBf16bdf1075b04ced7918d6f367e66d2f39f56724

Fix T61380 Geometry normal node incorrect for backfacing faces in Eevee

===================================================================

M	source/blender/gpu/shaders/gpu_shader_material.glsl

===================================================================

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 422487d075d..6c645cb9d22 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -1780,7 +1780,7 @@ void node_tangentmap(vec4 attr_tangent, mat4 toworld, out vec3 tangent)
 void node_tangent(vec3 N, vec3 orco, mat4 objmat, mat4 toworld, out vec3 T)
 {
 #ifndef VOLUMETRICS
-	N = normalize(worldNormal);
+	N = normalize(gl_FrontFacing ? worldNormal : -worldNormal);
 #else
 	N = (toworld * vec4(N, 0.0)).xyz;
 #endif
@@ -1809,8 +1809,7 @@ void node_geometry(
 
 	position = worldPosition;
 #  ifndef VOLUMETRICS
-	normal = normalize(worldNormal);
-
+	normal = normalize(gl_FrontFacing ? worldNormal : -worldNormal);
 	vec3 B = dFdx(worldPosition);
 	vec3 T = dFdy(worldPosition);
 	true_normal = normalize(cross(B, T));



More information about the Bf-blender-cvs mailing list