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>2019-05-17 19:17:14 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-05-17 19:17:23 +0300
commit0c4ce8e55e93c76c81f70db64dc8dee52b30a9f3 (patch)
tree73ede483d98e284882193b154b7c0d31db4aee36 /source/blender/draw/engines/workbench/shaders
parentec3940ab0a05e99a01b74c1c7e834e3f448a5d48 (diff)
Eevee / Workbench: Fix hair normals
Hair normals were not behaving correctly. This corrects their looks and fix the node shader geometry that was showing the flat normal.
Diffstat (limited to 'source/blender/draw/engines/workbench/shaders')
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl11
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
index 5d4153999c0..7872c1380ed 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
@@ -46,12 +46,11 @@ vec3 srgb_to_linear_attr(vec3 c)
vec3 workbench_hair_hair_normal(vec3 tan, vec3 binor, float rand)
{
/* To "simulate" anisotropic shading, randomize hair normal per strand. */
- tan = normalize(tan);
- vec3 nor = normalize(cross(binor, tan));
- // nor = normalize(mix(nor, -tan, rand * 0.1));
- // float cos_theta = (rand * 2.0 - 1.0) * 0.2;
- // float sin_theta = sqrt(max(0.0, 1.0 - cos_theta * cos_theta));
- // nor = nor * sin_theta + binor * cos_theta;
+ vec3 nor = cross(tan, binor);
+ nor = normalize(mix(nor, -tan, rand * 0.1));
+ float cos_theta = (rand * 2.0 - 1.0) * 0.2;
+ float sin_theta = sqrt(max(0.0, 1.0 - cos_theta * cos_theta));
+ nor = nor * sin_theta + binor * cos_theta;
return nor;
}