diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-05-08 16:51:18 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-05-14 17:46:18 +0300 |
commit | cf6ee13fabc13031913cff21f0a599ee7d41d53e (patch) | |
tree | 40c0c9368a4e8abc8c812089ac203efb9879110d | |
parent | 4f89f4e1b046ef6fb2548bae8b0c9717f6fb5a66 (diff) |
EEVEE: Make lit_surface_vert.glsl usable for depth pass
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl | 27 |
1 files 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 } |