3.4 Scene-referred workflow bad bokeh highlights reconstruction

I have read through all the replies of this interesting thread. Thanks to everyone. I learned a few things.

Now, the default in Highlight Reconstruction module is clip highlights, should it be changed? AT least if the user’s default is scene referred.

1 Like

IMHO, no. It’s a sensible default when you are not using highlight reconstruction in filmic, and it gives a decent results when you have small clipped areas (like lamps) that you might not want to bother to correct.

As larger clipped areas are either an error while taking the image, or a (necessary) trade-off, highlight reconstruction should be rather rare. No reason to have a default adapted to a less common situation.

you can define a preset to be applied as a default:

1 Like

Remember it’s always harder (and sometimes impossible) to recover clipped highlights than underexposed shadows or midtones.

ART
exposure -1.3EV, tone curve, some local contrast on heads

detail

2 Likes

huh, the ART/RT color reconstruction is quite good. @agriggio could you point me toward the source code of that feature ?

Happy New Year !

3 Likes

This comes straight from RT:

Although I can follow the basic idea of the algorithm (well, easy since the main steps are documented…), I could never figure out its details sufficiently well to be able to fix some of the artifacts it produces in some cases… :frowning:

1 Like

It’s also in librtprocess, which is probably easier to use stand-alone:

1 Like

Thanks ! From afar, the box blur - image is actually an highpass, then it deals with RGB ratios and propagate gradients in the clipped areas, so it’s very similar in principle to the filmic reconstruction. I wonder why the results are so different.

My half-drunk guess (oops, the bottle of Champagne is dry adready ?) is:

    constexpr float threshpct = 0.25f;
    constexpr float maxpct = 0.95f;
    constexpr float epsilon = 0.00001f;

should probably not be hardcoded if you want to adapt to any case. But then… you would have to add more technical GUI sliders, which is not ART’s philosophy.

What I’m interested most is avoiding the harsh transitions that sometimes occur from unclipped to clipped. I tried various sorts of blurring, but that’s a sort of band-aid which works only in some cases… so far, I have not managed to pinpoint the actual cause of the discontinuities, which would be the first step towards a proper fix.

Indeed, I’d prefer to avoid that. But first, I need to have a deeper understanding of the code, not just a superficial one like I have now

It seems that this transition is driven by the threshold:
float hipass_ave = 2.f * hipass_sum / (hipass_norm + epsilon);
in which epsilon is hardcoded, so I bet you need to change the epsilon value.

1 Like

I had a stab at it, thanks for the practice image! XMP attached, Darktable 3.4:

Bokeh details:

hilights2

hilights1

XMP:

A7C02846.ARW.xmp (25.5 KB)

3 Likes

I tried as well, seems I still struggle to get a good colorCal…
Besides lights are ab tad too yellowish (compared to other renditions, anyway I havn’t been on scene), I am quite satisfied…

darktable 3.5.0+291~g204bf8a7b


A7C02846.ARW.xmp (15,8 KB)

Hi again,

Hmmm…my understanding was that epsilon here is only a safeguard against div by zero, but of course I might be wrong. However, I tried changing it and it doesn’t affect the kind of artifacts I’m after. I’ll post a few examples asap to show what I’m talking about

Here’s an example. Using this raw:

Here’s what happens:

That red fringe is completely artificial. There are some ways to mitigate this with some post-processing tricks, but I would like to figure out why it happens in the first place…

Here’s the same image with “blend” highlight recovery:

ART
exposure -1.3EV, tone curve, some local contrast on heads

Thanks, I found this to be very interesting. Best result in this thread (subjective, I know). I’ve been attempting too leave Lightroom, at least for my personal projects. I need local adjustmens, so I’ve ended up with darktable (I know ART has it too). I’ve found that highlight recovery in darktable is not on par with the “competition”. As demonstrated in this thread there are at least 10 ways of achieving the same thing with sliders and options all over the place. Still, I have not been able to replicate the quality of the highlight reconstruction in RawTherapee. It would be more than awesome if the hilite_recon code in RawTherapee could be used to better the reconstruction in darktable.

1 Like

It’s not only a trick to avoid division by zero, it’s also a gradient thresholding, since the (hipass_norm + epsilon) denominator defines the pivot where hipass_sum gets increased (so (hipass_norm + epsilon) < 1.0) or decreased (so (hipass_norm + epsilon) > 1.0). You find that kind of regularization a lot in numeric variational methods.

I’d like to get that fixed too. If you unclip the channels in that raw, it appears that the clipping transition is very smooth, but the reconstruction algorithm doesn’t preserve that.

Unclipped: