Darktable 3: Strange hard edge on gradient mask

IMG_20200118_112458.dng (23.3 MB) IMG_20200118_112458.dng.xmp (21.4 KB)
Hi,

I’m having a great time with the new Darktable version 3, and especially the new Filmic RGB and other RGB modules which are simply fantastic.

But now I’ve come across an issue which I can’t really explain. In one photo I have a very bright sky and so I want to use the Exposure module with a gradient mask to select the sky and not the ground. I set the gradient to roughly match the horizon and fade into the sky over an area of perhaps 40-50 pixels.

I then dial down the exposure. And I do that quite a bit, I think down to the full range of -3 ev. Mostly just because I wanted to see how much I could recover.

Anyway, what I see is that at the exact point where the gradient part of the mask stops and the “solid mask” begins, there is a very hard edge. The top part of the sky is darkened down by -3 ev, and then it very abruptly goes up to perhaps -1 ev and fades out to 0 ev at the horizon. Right where the actual gradient begins there is a sudden jump in brightness that I can’t explain.

I wish there was some way to attach files here. I have the image and the history stack and it is quite easy to see and reproduce.

I wanted to report this as a bug but as usual the redmine issue system at darktable isn’t working and won’t let anyone log in or register. So I’m hoping that someone in this forum has an idea about what’s going on.

-Michael

Welcome aboard…you actually can attach files here…just drag them into your post.

Issues can be reported here: https://github.com/darktable-org/darktable/issues/new?assignees=&labels=&template=bug_report.md&title=

I just uploaded the image along with its sidecar.

If you open it you will see the “Exposure 1” module dialing down the exposure of the sky with about -3 ev which is the maximum. It shouldn’t look like that in the final image of course, but it makes the issue very obvious.

Anyone know why the gradient looks like that?

Looks like a bug to my. You can mitigate the effect by using “feathering” for the mask.

yes, to some extent but the feathering creates halos around the branches of the small trees in the foreground so that isn’t really desirable.

Mask contrast also has a somewhat positive effect but if you push it out past 0.67 the hard edge just appears somewhere else in the gradient.

I haven’t really been able to find any way to get a good result with “extreme” exposure compensation (-3ev). Works fine if I just keep it down a bit (-1) but it still feels like a bug.

There seems to be a general problem with the masking. I used a tone curve with masking on a complete gray image. As you see below, there are steplike gradients (Halos?).

In case anyone wants to follow this further, I filed this as a bug report here:

Yes and I also see in your screenshot that the transition from grey into the gradient itself is not smooth at all but pretty hard. It very quickly gets down to 50% or lower and from there on it fades to 0% over a much longer distance.

I tried on a white image with exposure set to -2.0 and went through all the different shapes, brush, circle, ellipse, path and gradient with the histogram set to waveform, just to see what actually happens. And Actually, for some of the shapes the transition is exactly linear all the way through in stead of a softer toe and shoulder:

This is true for gradient, path and brush. Circle and ellipse have a small roll-off on the outer edge, but the inner edge is sharp:

I don’t think this is anything new, I seem to remember seeing it before, even years ago but I have never bothered to dive into it to see what’s actually happening. Also, I don’t really know whether it is good or bad. A bit of feathering or mask blur will round off the transition and puts the user in control of how much softening to use. So as long as we are aware of it I guess it’s good.

2 Likes

There is nothing good about a gradient mask that isn’t gradient. It is not useful in any scenario I can think of - I mean just think of my sky gradient. Which, by the way, does not support your findings as clearly my gradient is not linear.

And no a mask blur won’t fix this problem, because it blurs the entire mask including areas that have been parametrically fenced off. In my case a mask blur will create glowing halos around the tree branches in the sky.

The report I filed has been classified as a high priority bug now.

Just to follow up the issue has now been fixed. See the relevant commit here:

2 Likes