Open KevinJW opened 1 year ago
refers to #6
I solved this in v030 by not letting the quadratic coefficient 'a' go smaller than 0.001.
While I was doing v032-pex prototype version I was playing with the gamut mapper's cusp-to-mid-blend and distance values, but I couldn't push the values where I wanted them because I was starting to get also NaNs from the gamut mapper. I traced it to the quadratic curve:
float J0 = sqrt(b * b - 4 * a * c); <------------- NaN
float J1 = (-b - J0) / (2 * a);
J0 = (-b + J0) / (2 * a);
float projectJ = project_from.x < focusJ ? J0 : J1;
The subtraction inside the sqrt() goes negative and out comes NaN. The projectJ ends up being NaN.
we should try an alternate formation of the quadratic solve, here is a python gist I was looking at, with suitable scaling of the a parameter in the surrounding code we can probably use the normalised form.
I guess I should say the alternate is don't use a quadratic, but something else with a similar shape!
Kevin
I’m not sure I consider it as “using a quadratic curve”. Rather the equation for the slope at a given J intersection has the form of a quadratic when combined with the JM value it needs to pass through, therefore the J intersect values for given JM are the roots of that quadratic.
Here's the M component as a plot. The input is the Dominant Wavelength ramp image. The ramp, in this case, goes from ACEScct 0 to 1.42.
M after chroma compression:
M after gamut mapping:
Notice how colorfulness strangely jumps higher as a result of gamut mapping at the top end. Some values come out as NaNs.
During the meeting 8th February 2023 It was highlighted that some values near J of 0 and 100 and M also near 0 we were experiencing black output values.
this could be due to