Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Eagar <joeedh@gmail.com>2020-03-25 04:34:13 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-03-25 17:45:24 +0300
commit035a3760afd23c3b28a845ba23f500931799e52b (patch)
treef7dd4df519133f0f0edc03c2e1400626efbe241a /source/blender/draw/engines/eevee/shaders
parentb4c05a9c89358fb14715009923241efdd007d3dc (diff)
Alpha hash support for hair in EEvee
This patch adds support for alpha hash for hair rendering in EEvee. Here's a comparison of with alpha hashing: {F7588610} And no alpha hashing: {F7588615} Note that this needs "soft shadows" enabled, otherwise shadows will be noisy; here's a render with soft shadows disabled: {F7588621} Reviewed By: fclem Differential Revision: https://developer.blender.org/D5221
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders')
-rw-r--r--source/blender/draw/engines/eevee/shaders/shadow_vert.glsl29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
index 6b06aab34d2..c42f905cf7e 100644
--- a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
@@ -9,6 +9,14 @@ out vec3 worldNormal;
out vec3 viewNormal;
#endif
+#ifdef HAIR_SHADER
+out vec3 hairTangent;
+out float hairThickTime;
+out float hairThickness;
+out float hairTime;
+flat out int hairStrandID;
+#endif
+
void main()
{
#ifdef GPU_INTEL
@@ -18,13 +26,34 @@ void main()
gl_Position.x = float(gl_VertexID);
#endif
+#ifdef HAIR_SHADER
+ hairStrandID = hair_get_strand_id();
+ vec3 world_pos, binor;
+ hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
+ ModelMatrixInverse,
+ ViewMatrixInverse[3].xyz,
+ ViewMatrixInverse[2].xyz,
+ world_pos,
+ hairTangent,
+ binor,
+ hairTime,
+ hairThickness,
+ hairThickTime);
+
+ worldNormal = cross(hairTangent, binor);
+#else
vec3 world_pos = point_object_to_world(pos);
+#endif
+
gl_Position = point_world_to_ndc(world_pos);
#ifdef MESH_SHADER
worldPosition = world_pos;
viewPosition = point_world_to_view(worldPosition);
+# ifndef HAIR_SHADER
worldNormal = normalize(normal_object_to_world(nor));
+# endif
+
/* No need to normalize since this is just a rotation. */
viewNormal = normal_world_to_view(worldNormal);
# ifdef USE_ATTR