[Bf-blender-cvs] [cf6ee13fabc] tmp-eevee-material-refactor: EEVEE: Make lit_surface_vert.glsl usable for depth pass

Clément Foucault noreply at git.blender.org
Thu May 14 16:58:57 CEST 2020


Commit: cf6ee13fabc13031913cff21f0a599ee7d41d53e
Author: Clément Foucault
Date:   Fri May 8 15:51:18 2020 +0200
Branches: tmp-eevee-material-refactor
https://developer.blender.org/rBcf6ee13fabc13031913cff21f0a599ee7d41d53e

EEVEE: Make lit_surface_vert.glsl usable for depth pass

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

M	source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl

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

diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
index cf20b3ff5b9..1b94fc2bee1 100644
--- a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
@@ -4,11 +4,12 @@ in vec3 pos;
 in vec3 nor;
 #endif
 
+#ifdef MESH_SHADER
 out vec3 worldPosition;
 out vec3 viewPosition;
-
 out vec3 worldNormal;
 out vec3 viewNormal;
+#endif
 
 #ifdef HAIR_SHADER
 out vec3 hairTangent;
@@ -41,22 +42,28 @@ void main()
                               hairThickness,
                               hairThickTime);
   worldNormal = cross(hairTangent, binor);
-  worldPosition = pos;
+  vec3 world_pos = pos;
 #else
-  worldPosition = point_object_to_world(pos);
-  worldNormal = normalize(normal_object_to_world(nor));
+  vec3 world_pos = point_object_to_world(pos);
 #endif
 
-  /* No need to normalize since this is just a rotation. */
-  viewNormal = normal_world_to_view(worldNormal);
+  gl_Position = point_world_to_ndc(world_pos);
 
+  /* Used for planar reflections */
+  gl_ClipDistance[0] = dot(vec4(world_pos, 1.0), clipPlanes[0]);
+
+#ifdef MESH_SHADER
+  worldPosition = world_pos;
   viewPosition = point_world_to_view(worldPosition);
-  gl_Position = point_world_to_ndc(worldPosition);
 
-  /* Used for planar reflections */
-  gl_ClipDistance[0] = dot(vec4(worldPosition, 1.0), clipPlanes[0]);
+#  ifndef HAIR_SHADER
+  worldNormal = normalize(normal_object_to_world(nor));
+#  endif
 
-#ifdef USE_ATTR
+  /* No need to normalize since this is just a rotation. */
+  viewNormal = normal_world_to_view(worldNormal);
+#  ifdef USE_ATTR
   pass_attr(pos);
+#  endif
 #endif
 }



More information about the Bf-blender-cvs mailing list