Recently I have been working on film-like tone-mapping curves, trying to derive analytical expressions that provide enough flexibility with few parameters, and a nice-looking compression of highlights.
For the moment I came up with two alternative parameterisations, one that tries to mimic the characteristic curve of invertible (slide) film using only two parameters, and another with more control over the shape but with no direct connection with actual film response.
Slide film emulation
In this case the input values are first converted to Log10 encoding, and then the Log10 values are converted in “simulated film density” using a reverse-S curve similar to the actual response of slide film:
The horizontal Log10 scale is defined such that the “0” point corresponds to 18% gray input (mid-gray), and is mapped to a 18% output density. In other words, mid-gray is preserved in the tone mapping.
The output density D is mapped back to linear luminance in this way:
Y = 1 / 10^D
The direct relationship between linear input/output RGB values is shown in the UI of the tool, with the axes converted to perceptually uniform coordinates to better see the shadows region. The horizontal axis goes from 0 to 2, with mid-gray at 0.5, while the vertical axis goes from 0 to 1:
Linear + log tone mapping
This more flexible parameterisation is composed of three parts:
- a linear section in the middle, with a configurable slope and end point
- a knee that smoothly connects the linear section to the origin, with an adjustable shape
- a shoulder that compresses the highlights using a logarithmic function, with two parameters to control the shape and the end point (at which the output reaches 1).
Here are few plots that show the effect of the different parameters:
linear slope
linear range
compression
shoulder shape
knee strength
The default parameters are adjusted to roughly match Blender’s “Medium High Contrast” filmic preset:
Here are few examples of the new curves in action:
Local contrast restoration
One of the drawbacks of the highlights compression is that is also reduces the local contrast in the bright areas. This effect can be mitigated by applying the tone mapping to a blurred version of the image, and then re-introducing the high-frequency components of the original image in the final tone-mapped result. The effect is often subtle, but noticeable. here is a without/with example:
No local contrast restoration
With local contrast restoration
I am currently working to include the “local contrast protection” into the tone mapping module, so that the same procedure can be a applied with any of the available tone mapping curves…
I would be very much interested in feedback about this new curves and the resulting tone-mapped images…
The code has been pushed to the “stable” branch on GitHub, and new pre-compiled packages should become ready in a short while.
Thanks a lot in advance!