filmic v4 on the way

I was still unhappy about filmic RGB/v3. Highlights desaturation wasn’t as minty as it should have been. Plus highlights reconstruction in darktable still sucked : either reconstructing out-of-gamut colors or producing hard transitions between valid and clipped areas.

You saw me, on the fast workflow live editing, use low-pass filter to bloom highlights, but it’s still Lab non-smooth blurring.

Then, negadoctor brought me knew knowledge on film and gave me new ideas.

So, all in all, it was time for a new iteration. Test the code and see samples:

What’s new ?

  1. highlight reconstruction in RGB wavelets space, using 3 different cumulative strategies (which you can weigh using sliders), that can replace any other highlights or color reconstruction in dt:
    1. copy valid details from non-clipped RGB channels, if any, or inpaint details at each wavelets scales, to fill holes,
    2. bloom highlights by inpainting the wavelets residual (same as film), or reconstruct details,
    3. favor a more monochromatic or more colorful reconstruction (useful if you got magenta or out-of-gamut highlights),

Capture d’écran du 2020-04-23 21-19-49
Notice the highlights thresholding produces a mask you can display and soften using the mask button on the highlights clipping transition slider, because I hate hidden masks.
2. new desaturation strategy, not using Y but directly the RGB ratios, to make the light more or less spectrally pure. Also, the desaturation curve stays at 0% for pure black and pure white no matter what, instead we drive the mid-tones resaturation.
3. using the same saturation strategy, there is a simple gamut mapping in the pipeline working RGB space, that penalizes RGB ratios for out-of-gamut until they fall back in line.
4. middle grey settings (scene and display) are hidden by default, to stop people confusion, and set to 18.45%. On fourth thought, it’s better. There is an option to show them again:
Capture d’écran du 2020-04-23 21-18-55
5. some less used geeky stuff has moved to “options” tab, hoping it will stay hidden for the kind of people who doesn’t read manuals.

Extra screenshots (not on Github, for the rest follow the link above):

Highlights clipping mask:

Output with filmic highlight reconstruction (detail from a Playraw I don’t recall):

Output without filmic reconstruction (notice the magenta highlights almost desaturated due to filmic gamut-mapping and desaturation):

Same pic with no filmic, no nothing, simple exposure compensation to normalize in 0-100%:



What does this mean? We are going to add light green to all highlights?


Having a clean and graceful gradient to pure white was a struggle and the “no chroma preservation” mode was better on that regard.

But, basically, yeah, to get rid of magenta highlights, you need more green :smiley:


I read minty as a pun for new, clean and green. :slight_smile:

I read minty as a pun for new, clean and green.

So do I… :slight_smile:

Aside from that, thanks a lot for this new update!

Great work – as usual – Aurelien! Could you post how the new filmic module handles this extreme example? That one always comes to my mind when I hear (broken) highlight reconstruction.

That picture was actually one of my test bench for this new algo.

Here you go:


I’m happy this feature is still there. Thank you.

if you want to test on osx: File on MEGA


It’s still a poisonous gift though.

1 Like

Just pulled down the branch and I’m really impressed by the results. In my opinion handling blown highlights was probably the weakest part of darktable. Now I’d say darktable is one of the best RAW editors for dealing with blown highlights. Thanks for your awesome work Aurelien!

filmic v4 seems like a great improvement overall. Even after a half hour of practice I’m able to get better results faster than I could previously with filmic. One thing I’m not completely sold on, however, is the naming of the brightness slider which doesn’t behave like a traditional brightness setting (but makes a lot of sense if you think about it as a paper grade selector). Now that the middle-grey slider is hidden by default I wonder if some users may end up confused expecting the brightness slider to have a similar effect.


I’m not set on the brightness name. It’s sort of another flavor of contrast, in the sense of the paper grade, but I can’t find a proper way to name it. Hardness perhaps ?

Coming up with a good name for the setting is definitely tricky. “Simulated paper grade” seems like the most descriptive but assumes the user is familiar with darkroom printing. Hardness seems like a decent option, a vague maybe but that might inspire the user to read the tooltip :slight_smile:. “Tonal range” or something like that might work too.

Wait so why is filmic itself doing the highlight reconstruction? Why couldn’t it just use data from a different highlight reconstruction method as the input?

Based on my testing with Filmulator using the RawTherapee-derived color propagation highlight reconstruction, you shouldn’t need to end up with the massive desaturated-to-gray area of the sky that you got.

(though it does need some processing, like impulse NR, to kill the phase detect pixels in the clipped area)

Because the highlights clipping threshold is derivated from filmic white bound, and because the whole reconstruction method is deepling inspired by film highlights blooming.

Clipped highlights should be achromatic, there is no other way around. White is supposed to be achromatic by definition.

Coloring highlights makes no sense, cyan clouds make no sense and are ugly, and any RGB space you pick has a zero saturation available in gamut at 100% luminance. So, coloring highlights is how you create out-of-gamut non-data.

Achromatic is what clipped highlights should ultimately look like, the only choice you get is the stiffness of the gradient to achromatic.

1 Like

The cyan clouds I admit I didn’t spend any time massaging away (I’d simply apply less negative exposure comp to hide it) but the idea that “coloring highlights makes no sense”…

Clipped highlights turning gray but retaining luminance information is what makes no sense to me and looks ugly.

Maybe it’s just a matter of opinion. Or a matter of perspective?

In Filmulator, highlight reconstruction is something done to fix bad data and make it represent the original scene more accurately. Only once I have a more complete depiction of the original scene, then the film simulation runs, changing the tone response and applying some tonemapping to style the image.

I don’t see why the highlight reconstruction should be something performed during the stylistic transformation of the image.

I will agree to that if you can find me a screen that can display actual blue at 100% luminance. Medium white is white thus achromatic. Whatever color you have in highlights is a by-product of some gamut-clipping artifact. You might be used to it or even like it, but it is wrong nonetheless, and I would actually be interested to see how that blue compares to the original scene chromaticity.

The grey vs. colorful reconstruction is parametric in my algo, so you can choose which reconstruction strategy you want to favor, but in this case, choosing the colorful one yields magenta highlights because of clipping + white balance (of course, there is still the option of clipping the whole pixed if any channel is clipped, so you avoid magenta in there, but that limits the reconstructing power too).

Same here, highlights recovery happens before tonemapping (in the same module, but still before). The difference is we don’t necessarily try to recover the original scene, but rather to blend clipped and valid areas in a more subtle way. So, in that regard, it makes sense to bound the clipping threshold to the right bound of the dynamic range.

Filmulator tries really hard not to clip hard (i.e. allow things to hit zero or full white), so what it gives you is an attenuation of chromaticity as you approach pure white. The closer you get to white, the less saturated it gets, in a way I prefer by default, though it can be tweaked.

In this case, actually, the magenta was phase detect pixels being wonky, not normal highlight clipping. So maybe if those were handled better, you wouldn’t have noticed the magenta and reacted by desaturating it as heavily as you did.

Instead of trying to desaturate them, I used RawTherapee’s impulse noise reduction to totally get rid of them in post.

The magenta highlights happen with Bayer CFA too and disappear on X-Trans and Bayer alike if you disable the white balance at all. I don’t have such patterns in dt on the X-Trans image anyway. This is solely on the WB factors, that mute the green channel a lot.

Same here.

Hmm, my experience is that magenta highlights happen:

  • when the actual sensor saturation point is lower than the white point used to clip the raw data (LibRaw doesn’t give per-ISO white points)
  • when phase detect pixels throw a wrench into things
  • when purple fringing influences color propagation

When none of those three are present, I never get magenta highlights, even with white balance.