diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2019-07-03 17:20:20 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-07-03 18:18:13 +0300 |
commit | 5277557755eb32a527addbf47e09de3a781f96ed (patch) | |
tree | 5ed316c959ea20182405c40ee5ddf0517af04863 /source | |
parent | 82990ce2b51c083e318e77ef76ccf8f929d427e9 (diff) |
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
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 11 |
1 files changed, 10 insertions, 1 deletions
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]; |