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:
authorClément Foucault <foucault.clem@gmail.com>2018-06-02 14:02:13 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-06-02 22:16:40 +0300
commit98e4d548a16c6533eadbe619f78cf1dda1a5c7a4 (patch)
treefaa3c46f400afa969271ea7083601c691834b45b /source/blender/gpu/shaders
parent119423b252c405b674c790b85962e5321882a9f4 (diff)
Eevee: Hair: Make SSR works with hairs.
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 6f253a48f86..4c77dd038af 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -2558,7 +2558,23 @@ void node_output_world(Closure surface, Closure volume, out Closure result)
/* EEVEE output */
void world_normals_get(out vec3 N)
{
+#ifdef HAIR_SHADER
+ vec3 B = normalize(cross(worldNormal, hairTangent));
+ float cos_theta;
+ if (hairThicknessRes == 1) {
+ vec4 rand = texelFetch(utilTex, ivec3(ivec2(gl_FragCoord.xy) % LUT_SIZE, 2.0), 0);
+ /* Random cosine normal distribution on the hair surface. */
+ cos_theta = rand.x * 2.0 - 1.0;
+ }
+ else {
+ /* Shade as a cylinder. */
+ cos_theta = hairThickTime / hairThickness;
+ }
+ float sin_theta = sqrt(max(0.0, 1.0f - cos_theta*cos_theta));;
+ N = normalize(worldNormal * sin_theta + B * cos_theta);
+#else
N = gl_FrontFacing ? worldNormal : -worldNormal;
+#endif
}
void node_eevee_specular(