diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-02-04 20:29:26 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-02-04 20:35:40 +0300 |
commit | 8efd8046853e3a994237b8efe6567bf35ee7d812 (patch) | |
tree | 296eb6aa2fe990f4f2e95061a0474e4b41d9618b /source/blender/draw/intern/shaders | |
parent | 370a6175e09302cc4c38d57ce0a013c24b35e266 (diff) |
Fix T72504 EEVEE: Crash when rendering Instance Collection with hair
This was caused by a double free of the instance data. Remove the need
of the instance data fix the issue.
Diffstat (limited to 'source/blender/draw/intern/shaders')
-rw-r--r-- | source/blender/draw/intern/shaders/common_hair_lib.glsl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/draw/intern/shaders/common_hair_lib.glsl b/source/blender/draw/intern/shaders/common_hair_lib.glsl index cbcdc947bc7..ffff631e34b 100644 --- a/source/blender/draw/intern/shaders/common_hair_lib.glsl +++ b/source/blender/draw/intern/shaders/common_hair_lib.glsl @@ -26,7 +26,7 @@ uniform float hairRadTip = 0.0; uniform float hairRadShape = 0.5; uniform bool hairCloseTip = true; -uniform mat4 hairDupliMatrix; +uniform vec4 hairDupliMatrix[4]; /* -- Per control points -- */ uniform samplerBuffer hairPointBuffer; /* RGBA32F */ @@ -159,8 +159,11 @@ void hair_get_pos_tan_binor_time(bool is_persp, wtan = wpos - texelFetch(hairPointBuffer, id - 1).point_position; } - wpos = (hairDupliMatrix * vec4(wpos, 1.0)).xyz; - wtan = -normalize(mat3(hairDupliMatrix) * wtan); + mat4 obmat = mat4( + hairDupliMatrix[0], hairDupliMatrix[1], hairDupliMatrix[2], hairDupliMatrix[3]); + + wpos = (obmat * vec4(wpos, 1.0)).xyz; + wtan = -normalize(mat3(obmat) * wtan); vec3 camera_vec = (is_persp) ? camera_pos - wpos : camera_z; wbinor = normalize(cross(camera_vec, wtan)); |