Fix T66165: RGB Curve node generates too bright color

The issue was that the end point would be extrapolated and it would lead to
very high values if the curve had a near inf slope. Now we use the actual end
point value and only extrapolate values that are outside of the start and
endpoint range.

Differential Revision: https://developer.blender.org/D5151
This commit is contained in:
Sebastian Parborg 2019-07-03 16:20:20 +02:00 committed by Brecht Van Lommel
parent 82990ce2b5
commit 5277557755

@ -769,8 +769,17 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
point += 2;
}
/* Check if we are on or outside the start or end point. */
if (point == firstpoint || (point == lastpoint && cur_x >= point[0])) {
cmp[a].y = curvemap_calc_extend(cuma, cur_x, firstpoint, lastpoint);
if (compare_ff(cur_x, point[0], 1e-6f)) {
/* When on the point exactly, use the value directly to avoid precision
* issues with extrapolation of extreme slopes. */
cmp[a].y = point[1];
}
else {
/* Extrapolate values that lie outside the start and end point. */
cmp[a].y = curvemap_calc_extend(cuma, cur_x, firstpoint, lastpoint);
}
}
else {
float fac1 = point[0] - point[-2];