From 5277557755eb32a527addbf47e09de3a781f96ed Mon Sep 17 00:00:00 2001 From: Sebastian Parborg Date: Wed, 3 Jul 2019 16:20:20 +0200 Subject: 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 --- source/blender/blenkernel/intern/colortools.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/colortools.c') diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index cbd6ff46933..863d6351738 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -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]; -- cgit v1.2.3