Proposal for a linear + highlight roll-off tonemapping

First some rgb-ratio filmic considerations.

I found there are three main big issues with filmic that could be avoided with a linear+highlights roll off tonemapping operator:

  1. too much desaturation in the shadows and midtones, this is how rgb-ratio works, it preserve the saturation in the highlights but I think it shouldn’t be used with a sigmoid/filmic/s-curve tone mapping.
    Actually the midtone saturation in DT doesn’t solve this issue and introduces itself other issues.

  2. It’s not easy to use color balance before filmic because the highlights recovery slider in filmic will change too much brightness and contrast of the image

  3. too much aggressive desaturation in the highlights, ideally there should be a slider for the amount of shadow desaturation and one for highlights desaturation. We should discuss about this desaturation, for example it should be applied before or after the tone mapping?

Some example for the first issue

Darktable rgb ratio filmic

Photoflow exposure-gamma and linear tone mapping (chroma preserving)

Darktable rgb ratio filmic

Photoflow exposure-gamma and linear tone mapping (chroma preserving)

Second and third issues:
darktable, after that I have got the right amount of contrast I can’t recover highlights without totally change the image and restart again tweaking sliders , totally white highlights where I want to recover some saturation details (there is a strange pink hue shift too)


However a linear tonemapping is pratically just a highlights roll-off tone mapping curve where we could set the knee point ( where to start to compress highlights) and the amount of desaturation.

Not tone-mapped crop

Linear tone-mapped crop


I have always thought that filmic in dt does more than it should, though as a package, it greatly simplifies the workflow. As you say, I see issues with saturation; however, your images aren’t satisfactory either.

It’s not a generic issue, there are many specific issues with saturation, in the shadows for a reason and in the highlights for a different reason.

And saturation isn’t the only issue that I’ve addressed.

They are there to show and alternative tone mapped version.
After the tonemapping they don’t look gray, don’t have totally white highlights and I don’t need to redone contrast adjustment.

This kind of tonemapper will preserve shadows and midtones, isn’t this usefull ?

Then i would like to control the amount of desaturation

Edit: not directly related to raw files but if we import in darktable a graded HDR image and we want to tonemapping it, this “highlights roll off only” tonemapper is the most preferred choice because it not mess with contrast

Why is it that most examples against filmic have clipped hightlights?

1 Like

@age To my understanding, my point and yours is the same: that filmic makes decisions that we don’t want it to. I highlighted saturation because that seems to be the thrust of your post.

To both saturation and contrast, I would say that filmic has a canniness to it. I often have to do a double take whenever I view a filmic entry in PlayRaw. In a way, it may actually be a good thing because it means that filmic (with all its technicalities) is close BUT no cigar, as the expression goes.

In contrast, other methods are more sensible as in we get what we expect from the operation. Unfortunately, none of them appear truthful to me. I guess for that, we need to be at the scene, comparing the two, and being extra careful with everything.

too much desaturation in the shadows and midtones, this is how rgb-ratio works, it preserve the saturation in the highlights but I think it shouldn’t be used with a sigmoid/filmic/s-curve tone mapping.

Gee… I wonder why the desaturation is so aggressive in mid-tones and highlights ? Maybe because there is no room for chroma left ? As in “pointy gamut”, whatever space you pick…

Notice the desaturation has nothing to do with the RGB ratios, it’s an additional processing step. The core algo is only meant to preserve those ratios.

It’s not easy to use color balance before filmic because the highlights recovery slider in filmic will change too much brightness and contrast of the image

Then learn. It’s easy, I don’t know what you are doing, but you must be doing it wrong.

for example it should be applied before or after the tone mapping?

It should be applied through the tone mapping, tone and gamut mapping are the 2 sides of the same problem. Ideally, the tone mapping would probe the export space to see where the color would end, and remap them to the closest in-gamut point using chroma and saturation strategies using the chromaticity before tone mapping.

Unfortunately, since darktable pipeline allows shit between filmic and output color profile for display-referred compatibility, that’s not possible yet, so the #1 priority for now is to finish re-writting all the display-referred modules that cloag the [filmic ; output profile] part of the pipe.

Focusing on what filmic does or doesn’t is counter-productive. It’s full of bad trade-offs that are made necessary by the mandatory support of legacy display-referred. You need to think the pipeline as a whole.

Wanna do something productive ? Rewrite local contrast, contrast equalizer, color zones, etc. in Ych. Until that is done, filmic is stale. I don’t put polish on broken car.


BTW @age, I liked your older PlayRaws more than your recent ones. Something changed; i.e., they feel too saturated. Admitted, my screen is definitely off, but it is the same one I used to view your other images.

1 Like

I wonder if people not familiar with filmic get confused with the whites slider expecting it to act as a highlights recovery slider. It behaves very differently, affecting the dynamic range and all tones. I wonder if this could be made clearer in the labelling if there is space. I tend to do most of these adjustments in tone equaliser and leave filmic alone unless the picture has extreme dynamic range.

1 Like

at OP. ‘filmic highlight recovery’… Do you mean the ‘recovery’ tab? Because AFAIK that is only for when stuff is clipped. As long as you can put the white-slider low to bring the highlights ‘in range’ you don’t need that. It’s only if you’re trying to find a balance.

Turn the ‘latitude’ slider to make that ‘highlight’ and ‘shadow’ part shorter, that means that less is desaturated.

I’d like to play with the pictures, but you didn’t post any RAW files to try.

Having said that: I think everybody would agree that filmic is not always the answer for everything, and it can have ‘a look’ to its down which you might not like. So if you get your result a different way, that’s always OK.

I think the two photos above come from playraw posts…I am sure I have seen both before…

Nothing wrong, moving the white relative exposure slider will change the values under middle gray.

Could you define in-gamut point?

There are negative rgb values that are really out of gamut colors, filmic push colors to be OOG with the midtone saturation slider.

There are rgb values > 1 , these are in-gamut but just too bright to be displayed.

We could decide how much saturation vs luminance preserve keeping the hue constant

This is a good paper about recover information above 1 after tone mapping

This could be easily extended to implement chroma clipping , basically detect the rgb pixels where at least one value is negative and desaturate it until it becomes 0.

original + saturation

chroma clipping

chroma clipping + lch hue blend

original.pfi (15.0 KB)

This is the g’mic code for the chroma clipping, it’s really fast
-fill i=i;lum=(i0+i1+i2)/3;min=min(i0,i1,i2);f=(0.00001-lum)/(min-lum);f=if(f<0,0,f);f=if(f>1,1,f);i=if(min<0,(i-lum)*f+lum,i);

For the values above 1.0 (not really OOG) the film_like clip is another good option because it reduces and preserve some saturation



DSCF9668.pfi (21.3 KB)

yes, 50 code value in lab color space is middle gray, values below middle gray are increased when the white relative exposure slidere is moved to the right

Right, I now understand what you say.

Moving the white relative exposure moves the right bound of the dynamic range which encompasses the wole luminance range. Who said “white” was anything like an highlights compression ? White, black, those are 2 bounds. You set them. Between them is the dynamic range. We handle it as a whole, because it is.

Don’t use that shit, it’s easy. You have better ways to increase saturation sooner in the pipe.

Whatever coordinate inside the gamut boundaries that minimizes the distance with the original color.

Using which color model ?

This is not hue-linear.

1 Like

The trouble is that that ‘shit’ is the default. When someone starts using a software as complex as darktable, a useful piece of advice is ‘go with the defaults, only tweak stuff you understand’. So, users will either leave that slider alone, or, even worse, will think they can yank it around. Shipping an application with a default setting that the principal developer of a module considers ‘shit’ is quite weird.

And a question: is it possible to set mid-tone saturation boost to 0, and save a preset, without that also saving the current black & white levels, which are, if I understand correctly, normally automatically set based on exposure (e.g. exposure compensation set in the camera) when the module is initialised?


Very counter-intuitive, in fact

You have to thank the worshippers of the OOC JPEG look for that. That default is to make them shut up. If I set the default to 0, I will get all the “filmic desaturates images” all over again. If I put a notice about needing to tweak saturation manually somewhere else in the soft, I will get other messages in tune with “why do I need to manually adjust saturation” ? (Answer : changing luminance at same chromaticity might not produce the result you expect).

There is no solution except sending some range of the user base to hell and stopping to listen.

Wanna go the manual way ? Set midtones saturation to 0 and carry on editing.
Wanna OOC JPEG-ish look ? Defaults should cover it fairly.
Wanna both ? Go annoy someone else. I’m tired of that shit.

Apparently, OOC JPEG is the Truth®, so what do I know…

That’s because you are the ones sitting on your arse, commenting and having opinions, and not the one taking shit from the internet after 8h of coding.


Oh you will love this one then… Scene referred, display referred, and the Colour Science of Canon/Fujitsu/Nikon/etc. in Darktable (filmic-rgb module in particular) - #6 by OK1

You thought “intuitive” was bad now you can have “photo intelligence”


I understand your irritation. How about Set filmicrgb default mid-tones saturation level in preferences · Issue #9183 · darktable-org/darktable · GitHub ?


Why do you need a preference when you can create a simple automated filmic preset that applies to all your images ?
With a bunch of custom presets, you can get a nice default look tweaked to your own style and taste.