diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-06-27 17:52:20 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-06-27 17:52:20 +0300 |
commit | 14f056144e3e1a94188034eae71bd56c3a1feec9 (patch) | |
tree | 1104556af9935dcaaed78ed8738ecf7b0b7058cf /source | |
parent | 9466d1579df37e108ef52e03984b88c64c926dbe (diff) |
Bendy Bones Instability Fix - Second Attempt
So the error seems to be in cubic_tangent_factor_circle_v3(),
which was introduced with D2001.
I've tweaked the most obvious culprit here - the epsilon factor.
It used to be 10^-7, but I've reduced it down to 10^-5 now,
and it's looking a lot more stable now :)
---------
BTW, about the derivation of the magic 0.390464 factor I briefly subbed back
as a workaround for this bug, see:
http://www.whizkidtech.redprince.net/bezier/circle/
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 99c9d0a0a79..b59618f46b2 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -634,11 +634,7 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB } { -#if 0 // <--- this is currently unstable, disabling until we find a good fix - const float circle_factor = length * (cubic_tangent_factor_circle_v3(h1, h2) / 0.75f); -#else // <--- temporary workaround, using the old hardcoded value - const float circle_factor = length * 0.390464f; -#endif + const float circle_factor = length * (cubic_tangent_factor_circle_v3(h1, h2) / 0.75f); const float hlength1 = bone->ease1 * circle_factor; const float hlength2 = bone->ease2 * circle_factor; diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 124f0c7abb8..82f527942e8 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -5002,7 +5002,9 @@ float cubic_tangent_factor_circle_v3(const float tan_l[3], const float tan_r[3]) BLI_ASSERT_UNIT_V3(tan_l); BLI_ASSERT_UNIT_V3(tan_r); - const float eps = 1e-7f; + /* -7f causes instability/glitches with Bendy Bones + Custom Refs */ + const float eps = 1e-5f; + const float tan_dot = dot_v3v3(tan_l, tan_r); if (tan_dot > 1.0f - eps) { /* no angle difference (use fallback, length wont make any difference) */ |