diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-17 19:17:14 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-17 19:17:23 +0300 |
commit | 0c4ce8e55e93c76c81f70db64dc8dee52b30a9f3 (patch) | |
tree | 73ede483d98e284882193b154b7c0d31db4aee36 /source/blender/draw/modes/shaders/common_hair_lib.glsl | |
parent | ec3940ab0a05e99a01b74c1c7e834e3f448a5d48 (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/modes/shaders/common_hair_lib.glsl')
-rw-r--r-- | source/blender/draw/modes/shaders/common_hair_lib.glsl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/draw/modes/shaders/common_hair_lib.glsl b/source/blender/draw/modes/shaders/common_hair_lib.glsl index 1c0a31c59fd..f9c3df34658 100644 --- a/source/blender/draw/modes/shaders/common_hair_lib.glsl +++ b/source/blender/draw/modes/shaders/common_hair_lib.glsl @@ -160,9 +160,9 @@ void hair_get_pos_tan_binor_time(bool is_persp, } wpos = (hairDupliMatrix * vec4(wpos, 1.0)).xyz; - wtan = mat3(hairDupliMatrix) * wtan; + wtan = -normalize(mat3(hairDupliMatrix) * wtan); - vec3 camera_vec = (is_persp) ? wpos - camera_pos : -camera_z; + vec3 camera_vec = (is_persp) ? camera_pos - wpos : camera_z; wbinor = normalize(cross(camera_vec, wtan)); thickness = hair_shaperadius(hairRadShape, hairRadRoot, hairRadTip, time); |