Why, thank you! I had not been aware the maths was around here, and it’s actually a lot less scary than I’d expected. Analytical geometry has been a large part of my job for the last seven years, so this might be something where I can actually contribute.
So, it seems that @anon41087856 is using a 4th order polynomial for the shadow and highlight ranges, and those are unfortunately prone to overshooting (unless constrained wisely, which is not always an option).
Oh, and he posted Python code (here), isn’t that comfortable for me… except there’s an reference to an undefined callable “setup_spline()”, but I think I’ll be able to do something with that …
Some quick remarks:
1: fourth-order polynomials like that can be solved analytically. I know this is just Python PoC code. So I hope that DT is not running a linear solver to deal with those constraints. If it does: Let me know, I’ve just worked out the analytical solution.
2: Why is the curvature of the “roll-off” polynomials constrained to that of the middle curve (i.e. to zero)? In aerodynamics that would be very important but I doubt anyone could visually notice if the rate at which the rate of the brightness gradient changes had a small jump… heck, there are still people constructing aeroplane components from circles and straight lines.
3: Is it necessary to have the gradient at the bottom and top end constrained to zero, too? There might be a good reason based on colour science (which I wouldn’t be aware of), or maybe that’s how actual film reacts?
4(and then I’ll shut up for tonight): I’d bet that actual film has some kind of exponential or hyperbolic curve. The upper end might look something like this in real life. That’s the activity curve of enzymes as a function of the concentration of “food” they are given.