Commit: 14f056144e3e1a94188034eae71bd56c3a1feec9
Author: Joshua Leung
Date:   Tue Jun 28 02:52:20 2016 +1200
Branches: master
https://developer.blender.org/rB14f056144e3e1a94188034eae71bd56c3a1feec9

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/

===================================================================

M       source/blender/blenkernel/intern/armature.c
M       source/blender/blenlib/intern/math_geom.c

===================================================================

diff --git a/source/blender/blenkernel/intern/armature.c 
b/source/blender/blenkernel/intern/armature.c
index 99c9d0a..b59618f 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 124f0c7..82f5279 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) */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to