[Bf-blender-cvs] [5277557755e] master: Fix T66165: RGB Curve node generates too bright color

Sebastian Parborg noreply at git.blender.org
Wed Jul 3 17:20:22 CEST 2019


Commit: 5277557755eb32a527addbf47e09de3a781f96ed
Author: Sebastian Parborg
Date:   Wed Jul 3 16:20:20 2019 +0200
Branches: master
https://developer.blender.org/rB5277557755eb32a527addbf47e09de3a781f96ed

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

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

M	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];



More information about the Bf-blender-cvs mailing list