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 00:10:23 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-06-02 22:16:40 +0300
commit4430bd36446beb1338da2001b0b236e0e440c386 (patch)
tree6fd23a028860e4c996420f84b5d638e5ad5c2f30 /source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
parent0736460dfb923eab901ebda240c76a4600578b56 (diff)
Eevee: CodeStyle: Fix naming and confusion about the hairs vectors.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl28
1 files changed, 8 insertions, 20 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
index accecaacbde..ad975957be9 100644
--- a/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lit_surface_frag.glsl
@@ -178,30 +178,18 @@ void CLOSURE_NAME(
vec4 rand = texelFetch(utilTex, ivec3(ivec2(gl_FragCoord.xy) % LUT_SIZE, 2.0), 0);
#ifdef HAIR_SHADER
+ vec3 B = normalize(cross(worldNormal, hairTangent));
+ float cos_theta;
if (hairThicknessRes == 1) {
- /* Random normal distribution on the hair surface. */
- vec3 T = normalize(worldNormal); /* meh, TODO fix worldNormal misnaming. */
- vec3 B = normalize(cross(V, T));
- N = cross(T, B); /* Normal facing view */
- /* We want a cosine distribution. */
- float cos_theta = rand.x * 2.0 - 1.0;
- float sin_theta = sqrt(max(0.0, 1.0f - cos_theta*cos_theta));;
- N = N * sin_theta + B * cos_theta;
-
-# ifdef CLOSURE_GLOSSY
- /* Hair random normal does not work with SSR :(.
- * It just create self reflection feedback (which is beautifful btw)
- * but not correct. */
- ssr_id = NO_SSR; /* Force bypass */
-# endif
+ /* Random cosine normal distribution on the hair surface. */
+ cos_theta = rand.x * 2.0 - 1.0;
}
else {
- vec3 T = normalize(cross(hairTangent, worldNormal));
- /* We want a cosine distribution. */
- float cos_theta = hairThickTime / hairThickness;
- float sin_theta = sqrt(max(0.0, 1.0f - cos_theta*cos_theta));;
- N = normalize(hairTangent * cos_theta + T * sin_theta);
+ /* Shade as a cylinder. */
+ cos_theta = hairThickTime / hairThickness;
}
+ float sin_theta = sqrt(max(0.0, 1.0f - cos_theta*cos_theta));;
+ N = normalize(N * sin_theta + B * cos_theta);
#endif
/* ---------------------------------------------------------------- */