diff options
author | Stefan Werner <stefan.werner@tangent-animation.com> | 2018-11-23 15:08:15 +0300 |
---|---|---|
committer | Stefan Werner <stefan.werner@tangent-animation.com> | 2018-11-23 15:19:53 +0300 |
commit | 071f4f4ce0b9520ab0c73d6d68365ad449ca8b80 (patch) | |
tree | 9f37bfcac669366b9ad5fb7605f2fbbed9b71b0a /source/blender/blenlib/intern/math_vector_inline.c | |
parent | 0a2b2d59a5897212ba3771503feb6770fb636bc8 (diff) |
Cycles: Improved robustness of hair motion blur.motion_curve_fix
In some instances, the number of control vertices of a hair could change mid-frame.
Cycles would then be unable to calculate proper motion blur for those hairs. This adds
interpolated CVs to fill in for the missing data. While this will not necessarily result in
a fully accurate reconstruction of the guide hair, it preserves motion blur instead of disabling it.
Reviewers: #cycles, sergey
Reviewed By: #cycles, sergey
Subscribers: sergey, brecht, #cycles
Tags: #cycles
Differential Revision: https://developer.blender.org/D3695
Diffstat (limited to 'source/blender/blenlib/intern/math_vector_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 715e2e65c96..37eab44c6e8 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -1087,24 +1087,23 @@ MINLINE bool compare_v4v4_relative(const float v1[4], const float v2[4], const f MINLINE bool compare_len_v3v3(const float v1[3], const float v2[3], const float limit) { - float x, y, z; - - x = v1[0] - v2[0]; - y = v1[1] - v2[1]; - z = v1[2] - v2[2]; - - return ((x * x + y * y + z * z) <= (limit * limit)); + float d[3]; + sub_v3_v3v3(d, v1, v2); + return (dot_v3v3(d, d) <= (limit * limit)); } MINLINE bool compare_len_squared_v3v3(const float v1[3], const float v2[3], const float limit_sq) { - float x, y, z; - - x = v1[0] - v2[0]; - y = v1[1] - v2[1]; - z = v1[2] - v2[2]; + float d[3]; + sub_v3_v3v3(d, v1, v2); + return (dot_v3v3(d, d) <= limit_sq); +} - return ((x * x + y * y + z * z) <= limit_sq); +MINLINE bool compare_len_squared_v4v4(const float v1[4], const float v2[4], const float limit_sq) +{ + float d[4]; + sub_v4_v4v4(d, v1, v2); + return (dot_v4v4(d, d) <= limit_sq); } /** |