@@ -121,7 +121,8 @@ bool SoftenTarget(const IKTwoBoneJob& _job, const IKConstantSetup& _setup,
121
121
const SimdFloat4 lengths =
122
122
Sqrt (SetZ (SetY (_setup.start_mid_ss_len2 , _setup.mid_end_ss_len2 ),
123
123
start_target_original_ss_len2));
124
- const SimdFloat4 start_mid_ss_len = lengths;
124
+ const SimdFloat4 start_mid_ss_len =
125
+ SplatX (lengths); // Makes sure no NAN in .yzw
125
126
const SimdFloat4 mid_end_ss_len = SplatY (lengths);
126
127
const SimdFloat4 start_target_original_ss_len = SplatZ (lengths);
127
128
const SimdFloat4 bone_len_diff_abs =
@@ -149,6 +150,7 @@ bool SoftenTarget(const IKTwoBoneJob& _job, const IKConstantSetup& _setup,
149
150
if ((comp_mask & 0xb ) == 0xb ) {
150
151
// Finds interpolation ratio (aka alpha).
151
152
const SimdFloat4 alpha = (start_target_original_ss_len - da) * RcpEstX (ds);
153
+
152
154
// Approximate an exponential function with : 1-(3^4)/(alpha+3)^4
153
155
// The derivative must be 1 for x = 0, and y must never exceeds 1.
154
156
// Negative x aren't used.
@@ -171,8 +173,8 @@ bool SoftenTarget(const IKTwoBoneJob& _job, const IKConstantSetup& _setup,
171
173
172
174
// The maximum distance we can reach is the soften bone chain length: da
173
175
// (stored in !x). The minimum distance we can reach is the absolute value of
174
- // the difference of the 2 bone lengths, |d1-d2| (stored in z). x is 0 and z
175
- // is 1, yw are untested.
176
+ // the difference of the 2 bone lengths, |d1-d2| (stored in z).
177
+ // Hence: x is 0 and z is 1, yw are untested.
176
178
return (comp_mask & 0x5 ) == 0x4 ;
177
179
}
178
180
0 commit comments