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/
This commit is contained in:
Joshua Leung 2016-06-28 02:52:20 +12:00
parent 9466d1579d
commit 14f056144e
2 changed files with 4 additions and 6 deletions

View File

@ -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;

View File

@ -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) */