From cf6ee13fabc13031913cff21f0a599ee7d41d53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 8 May 2020 15:51:18 +0200 Subject: EEVEE: Make lit_surface_vert.glsl usable for depth pass --- .../engines/eevee/shaders/lit_surface_vert.glsl | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) 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 } -- cgit v1.2.3