New film-like tone mapping curves - tests/feedback needed



Did you happen to turn on hue matching in curves or tone mapping? That causes the artifacts on the Christmas lights. I never use it because it is too risky for me.


Shadow clipping on


(Gustavo Adolfo) #43

No, I didn’t.
I think it was caused by two tone mapping layers, the later with screen mode. When I turn this one off, the artifacts disappear.

Thanks anyway!

(Carmelo Dr Raw) #44

I have just introduced yet another version of tone mapping operator, but this time with the goal of greatly simplifying the workflow.

After having spent several weeks on the subject, I have come up with a relatively simple solution that seems to give good results even in cases with very high dynamic ranges.

The new tool is composed of two parts:

  • a dynamic range compression step based on a logarithmic curve,
    with separately adjustable strengths for shadows and highlights
  • a S-shaped contrast curve with adjustable slope and
    shoulder shape

The old tool with the various tone-mapping curves is still available, and is now called “Tone mapping old”.

Here is an example, to give you an idea of what can be obtained (the diagonal line splits the previous/after versions):

Pre-compiled PhotoFlow binaries should become available in a little while…

I’d really love to have your feedback!


The new TM module and its defaults aren’t bad. One thing I have noticed is that the processing starts when I start moving the slider. It would be great if it started after I settled on the adjustment. Didn’t notice this issue before in the other modules.

PS Noticed that you have added Jzazbz into the soup. Do you have any plans for it?

PPS Example OFF / ON (default). Not bad.

(Gustavo Adolfo) #46

Thanks for the good work!

I did a quick edit with it and got these two strange things:
1 - The curve bended;
2 - Lots of artifacts appeared

I think these only appeared after some back and forth attempts

Follow dng and pfi (licensed under CC BY-NC-SA 4.0)
IMG_4989.DNG (17.8 MB)

IMG_4989-new.pfi (23.5 KB)


It is the same kink problem from filmic+log, which is usually in the toe but could be in the linear section too when parameters are pushed to the extreme.

There are also points when areas in the preview turn black with artifacts at the edges. Sometimes they go away after processing; other times they stay.

(Gustavo Adolfo) #48

Maybe, but I often used linear+log - including for this image - and never got that.


I am just better at testing things, bringing PF to its knees! :slight_smile: Actually, maybe @chroma_ghost is because PF crashes like no tomorrow for him.

(Carmelo Dr Raw) #50

@afre @gadolf I am trying to fix/mitigate the “kink problem” right now. The main reason for it is that currently the higher the slope, the wider is the toe (the red part of the curve). To the point where it goes beyond the linear range…

(Gustavo Adolfo) #51

Please, take your time.
I like the “old” linear+log module, so I’ll keep using it with my real edits.
I don’t have much trouble with all its parameters. (Not saying that I understand what they mean, but I tweak them in an intuitive way, and it works for me)

(Carmelo Dr Raw) #52

Is that always related with large values of the slope parameter?


I think so. I actually don’t use PF’s tms often enough to know for sure. I mostly use them to see what is possible and then let that inform the rest of my post-processing workflow.

(Carmelo Dr Raw) #54

Here is a preview of the next feature that I am introducing in the tone mapping module: local contrast.

The shoulder in the tone mapping curve can nicely recover highlight details, but micro-contrast gets flattened on the way. The local contrast adjustment allows to re-introduce some of the flattened textures. If pushed too far, it can generate the classic “fake HDR look”, but used with a grain of salt it can really give some extra pop that remains natural-looking.

This is the initial image:

Tone mapping, flattens the textures in the highlights:

Local contrast pushed to the maximum, too much…:

A reasonably good compromise:

What do you think?

(Gustavo Adolfo) #55

At least from this image, it seems that the maximum local contrast completely recovers details lost by other processing, so I’d say that it should be set at 100% always (you’re not adding more local contrast, you’re just recovering it as it was originally)
On the other side, maybe I don’t want to always compress the dynamic range to 100%, so isn’t it better to separate local contrast from the compression amount applied?
Not sure if I made myself clear enough…


I am still uncomfortable with your tm (old and new) slider labels. In particular, amount doesn’t mean anything in particular. If you are calling it local contrast here, it should probably be called that in your app. detail may also be an apt name. I say this half-jokingly but you could even call some of the sliders by the colours of the curve.

(Carmelo Dr Raw) #57

Personally I find that a bit of local contrast loss in the compressed highlights is not bad, and looks quite natural instead… so I prefer to leave the amount adjustable.
If the curve is straight (no compression or contrast increase at all) the amount slider has no effect, because one is effectively removing and re-introducing local contrast to the same image.

I am open to suggestions! In the amount case the slider is supposed to be inserted in a “local contrast” frame where there will be also two sliders for the radius and threshold of the guided blur filter…

(Gustavo Adolfo) #58

Here’s one more test.
This time, I’m comparing a small region of an image where I know there’s a thick layer of dust on the wall. The dust is seen as brownish splotches.
The comparison is between Darktable’s filmic and linear+log tm (I tested with all other tone mapping curves and the result is the same - regarding the dust layer), and Photoflow seems to desaturate it more than Darktable, specially on the region marked by the green circle.


I exagerated saturation to make the difference more visible.
Follow respective sidecar files:
IMG_5427_alt.pfi (27.8 KB)
IMG_5427.DNG.xmp (4.2 KB)
IMG_5427.DNG (17.8 MB)

When zooming out both programs, the overall difference between both seems to be a little less vibrancy in PhotoFlow.

I know it’s hard to compare different algorithms from different programs. Because of that, I tried tweaking PF’s tone mapping settings to recover that brownish blotch, but all i got was a dark one. Somehow the color seems to be missing.

(Carmelo Dr Raw) #59

@gadolf As far as I can see, the increased saturation in DT comes from the “preserve chrominance” setting, which generates an image that is over-saturated compared with a similar region of the original image that is simply brightened with an exposure compensation.

Remember: exposure compensation, if applied correctly, preserves both the hue and the saturation of the original colors. It is equivalent to an in-camera adjustment of the shutter speed…

I wonder if this is closer to what you were looking for:

I have reduced the contrast and the knee strength of the tone mapping curve a bit, to avoid darkening the shadows too much, and I have used the “color correction” module for saturation boost. This uses the saturation adjustment algorithm recommended for ASC-CDL, while the “basic adjustments” tool is still based on a legacy HSV colorspace…

Getting rid of this bit of mess is part of the work I have ahead of me!

(Carmelo Dr Raw) #60

I have yet another update of the filmic curves, with further improvements.

There is now a first section with two sliders that allow to control the global dynamic range compression, for shadows and highlights separately.

The second section has sliders to control the shape of the tone-mapping curve, as before.

The last section groups the sliders for the adjustment of the local contrast.

This is how it looks like:

@gadolf @afre since you played quite a bit with the old tone mapping curves, I would be really interested to know if you can easily obtain similar results with the new interface…

(Gustavo Adolfo) #61

@Carmelo_DrRaw As soon I have a spare time I’ll check that.

Meanwhile, I noticed that the OCIO filmic still shows those squares if I don’t set LC_NUMERIC manually.
Another thing that I noticed just now (by looking at your last screenshot, is that the popped out tools don’t show the close, minimize, maximize buttons. Maybe some Ubuntu/Gnome stuff interfering here… it’s kind of weird when I want to get back to the main window, I have to drag the tool out of sight so that I can see the main window