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-11-26 17:34:10 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-11-26 23:25:33 +0300
commit14ea3130ee40ad7c5b538b01f07ee3a1d19a3025 (patch)
treea2a875716302756acf7cc233d39752a7403fe4bd /source/blender/draw/modes/shaders/common_hair_lib.glsl
parent408cdf0cbacb39a29934818dc6c656517f15a6a5 (diff)
DRW: Hair: Fix hairs not working properly with duplis
Fix T55355 Instanced hair not working well for EEVEE and workbench
Diffstat (limited to 'source/blender/draw/modes/shaders/common_hair_lib.glsl')
-rw-r--r--source/blender/draw/modes/shaders/common_hair_lib.glsl5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/draw/modes/shaders/common_hair_lib.glsl b/source/blender/draw/modes/shaders/common_hair_lib.glsl
index c0c5f84d166..594a7b31f0b 100644
--- a/source/blender/draw/modes/shaders/common_hair_lib.glsl
+++ b/source/blender/draw/modes/shaders/common_hair_lib.glsl
@@ -26,6 +26,8 @@ uniform float hairRadTip = 0.0;
uniform float hairRadShape = 0.5;
uniform bool hairCloseTip = true;
+uniform mat4 hairDupliMatrix;
+
/* -- Per control points -- */
uniform samplerBuffer hairPointBuffer; /* RGBA32F */
#define point_position xyz
@@ -150,6 +152,9 @@ void hair_get_pos_tan_binor_time(
wtan = wpos - texelFetch(hairPointBuffer, id - 1).point_position;
}
+ wpos = (hairDupliMatrix * vec4(wpos, 1.0)).xyz;
+ wtan = mat3(hairDupliMatrix) * wtan;
+
vec3 camera_vec = (is_persp) ? wpos - camera_pos : -camera_z;
wbinor = normalize(cross(camera_vec, wtan));