The curve is applied per-channel (not to the luminance value). The topic of per-channel vs luminance is discussed briefly here, there are links to more detailed articles: https://bruop.github.io/tonemapping/
Let’s be patient
I think @kofa started this as a project for fun and learning so I think we all need to be careful and not suck the “joy” out of it for him… I am really enjoying it and having fun experimenting but at the same time I have no expectations …tinker away @kofa and we will take it as it comes
I don’t understand the desperation for this new tone mapping technique. Dt works just fine for me as it is. Sure this looks great, but I prefer the technical details to be worked out first.
I thinkt that is one approach. Another approach is chromaticity preservation, like in the " A Decision Taken For Granted" section of the article you linked earlier. And there are interim solutions.
The questions is not about whether you can achieve some result in Darktable — either filmic or sigmoid are sufficiently flexible that if you apply just two other modules (eg tone equalizer + color balance rgb) you can do pretty much anything conceivable. The quest for better tonemappers is about minimizing the effort it takes to get good results for a wider variety of cases.
Yes and no. I’m following the discussion here and see some hope for a new (better/easier) tone mapper. But as @kofa said, all this is POC and we don’t want POC in darktabke master we want a final well thought module on master. It can have bugs, sure but certainly not some random implementation that we could change later. So yes, let’s be patient.
At the moment on master there is already a large set of clean-up and stability fixes done by @Jens-Hanno_Schwalm. Those are making dt in an even better position for the future. Yes I took this thread as an opportunity to thanks him !
We are always desperate for new tools, that’s what darktable is about. Darktable equals innovation. It’s not about „it works just fine like it is“.
Darktable also puts a lot of emphasis on backwards compatibility with its modules. It would be a mess to release a rushed AgX tone mapper and then have to iterate through multiple versions of it and have a fragmented UI, just like it happened with filmic where it was constantly changing and now there’s like 6 versions in the codebase.
Filmic had a better justification to do it since dt was moving away from display referred and needed a tone mapper, which is not the case now where we already have two good ones, so we can take our time with this.
I will enthusiasically second this… I pop in and out of the github discussions and the amount clean-up, optimization and future proofing work that is being done by @hannoschwalm is fantastic… fixing and improving OpenCL as well…really unsung work … Big thanks from me and i am sure one echo’d widely by others…
We have @kofa sharing his journey of discovery into tone and gamut mapping and others contributing in so many other ways…
A big thanks to everyone…
I just thought I’d give my thoughts on the above after several days of experimenting with the latest version of the module. These are just some personal thoughts as a user in the hope that @kofa finds them useful for his experimentation/fun.
Offset slider – my thoughts: move Offset above Slope like in Color Balance RGB.
In the most recent version, this slider has reverted to its former behaviour of shifting the whole tonal range in a linear fashion if all other sliders are at default. Therefore, it should ideally be set before Slope, otherwise you will need to adjust Slope again after adjusting this.
White/Black relative exposure sliders - my thoughts: We don’t need these sliders. We can already set the white/black points, and the toe/shoulder/linear sections can be adjusted with other sliders.
- Their current behaviour affects the whole range, acting a bit like dynamic range compression/expansion sliders. Is this correct? Or should they be more restricted to just the highlights/shadows respectively? With their current behaviour, they significantly change any adjustments made to Slope/Offset/Power in the module’s first section, so they are more of an either/or option, rather than to be used in addition to SOP.
- Like Filmic RGB, they are supposed to do two things at once: They set the white/black points, and they set the number of stops between middle gray and pure white/black. These functions can be found with other sliders, and I personally prefer these functions to be separated.
- Also, the names “white/black relative exposure” are not very clear. I always found these sliders a bit confusing in Filmic RGB, and I would rather not see them again in this module.
All other sliders - my thoughts: I think they could all be really useful once working properly.
There are perhaps some issues at the moment because at certain values, the behaviour reverses, e.g. Output min past 0.45, Output max past 1.5. But with tweaks to the behaviour, I really like the option to essentially split the curve into 3 sections and fine-tune each section.
Overall thoughts:
To me, the strength of this module could lie in its dual nature:
- The first part of the module – Slope, Offset, Power (+ a couple of colour adjustment options) – can be used to get great results quickly, similar to just enabling Sigmoid currently.
- The second part of the module, which I envisage as a dropdown section, can be used to tweak the curve for more advanced use. In this section, I like the idea of having the current sliders without black/white relative exposure. In other words, it is designed for tuning contrast in the midtones (linear slope), shadows (toe) and highlights (shoulder).
I know this is starting to sound a lot like Filmic RGB, but that module has far too many tabs, and doesn’t offer the fine tuning of the toe and shoulder.
Again, these are just the thoughts of a user/photographer, and I fully realize that @kofa’s project does not have a clear goal yet. The module may change significantly or not even be implemented. But I’m having fun trying out whatever gets added to dev builds. Thanks again @kofa !
@kofa, I hope the enthusiasm for this proof of concept wasn’t too overwhelming. Personally, I was impressed by how much I could accomplish with just four basic sliders and I appreciate the opportunity as a non-technical user help to prove this out.
I think I understand the workflow where the Look section sets the basic parameters and then Sigmoid allows fine tuning. I’ve played with a couple dozen images and if I was using it I could do everything I needed with only the Look sliders and plus the sliders for Toe and Shoulder power and Slope of linear portion (which I might call contrast) as a bare minimum.
The full Sigmoid section is fine, possibly as a drop down. It would be great if the white and black points could be fixed as set so the Slope of linear portion slider wouldn’t change the dynamic range. I understand the intent of the transition lengths but I could live without them. I like the Output min/max sliders, but would place them by themselves at the bottom. At the same time I think it would be hard to visualize the effect of all these sliders without some sort of display like we have with Filmic. But that might make the effort too complex.
Thanks again for sharing.
Hi, thanks for the feedback, everyone!
The way I see it, you set the black/white points using exactly those sliders.
Without those sliders, the black … white range was fixed at -10 EV … + 6.5 EV. If you had anything darker, it was clipped to 0, with no way to recover it raise it. Similarly, anything above +6.5 EV was forced to white, and recovery was not possible (as far as the curve is concerned – it was your responsibility to get your input data inside those bounds). That is not necessarily a bad thing, though: the larger dynamic range you map, the more compromise you’ll have to make regarding contrast.
If you meant to set the white/black points using the ‘look’ sliders (offset, scale, etc.): those only change where the 0 and 1 output values of the curve are moved, but that’s after clipping/clamping. So, if you had a value at -12 EV, it would be clamped to 0, which then you could lift up to, say, 0.01. However, all values between -12 EV and -10 EV would be mapped to that same value. That’s not the same as recovering the range between -12 EV and -10 EV.
That is the same thing, in my understanding. Black is something you choose as your cutoff point for darks, and you specify it relative to some value, in this case the pivot (mid-grey). Same for whites. This is what white/black relative exposure means.
I would love to remove output min and max. What are they used for (that’s an honest question)? I added them for completeness, but with sigmoid, I only ever saw Boris use them to work around the fact that the logistic function used in that module converges to 1 asymptotically, with a gradient of 0, no angle, so no contrast. He used the target white to create an overshoot (so the function would converge to, say, 1.3), and thus still have a gradient > 0 (that is, retain some contrast) near y = 1. The toe and shoulder controls of the sigmoidal curve in this module can be adjusted to hit the y = 1 line at an angle (have contrast in highlights).
Please explain, I don’t understand the exact problem. What you ask may not be possible. Try playing with the plotter at Desmos (linked above several times). If you have a straight line on the graph, there are 3 possibilities:
- it connects the origin (0, 0) with (1,1). You have no choice of contrast, it is 1, by definition.
- you choose a contrast less than 1. Either the line won’t pass through the origin, or it pass through (1,1), or it won’t pass through either. You have no shoulder, or no toe, or neither.
- you choose a contrast > 1. Depending on the length of the linear section and the position of the pivot relative to (0, 0) and (1, 1), you may get a nice S curve, or you may not (one such case is illustrated in Blender AgX in darktable (proof of concept) - #198 by kofa).
I think a way to lay out the controls would be to have the look controls at the top, like now. In what order they should be arranged, we can figure out together. Boris said he adjusts saturation first; adjusting blacks also sounds logical. We should maybe check video editors, which often use these controls.
Then, the more detailed sigmoid tuning functions could be collapsed. If desired, one could change the black/white relative exposure (black and white clipping point), the contrast in the midtones (linear section), the location of the pivot (normally, mid-grey), and shadow/highlight roll-off (shoulder and toe power + length). The lengths are currently absolute numbers; it may make more sense to turn them into fractions (e.g. ‘60% of the range above the pivot should remain linear, 40% should gradually taper off’ – same for the toe).
Again, thanks for the feedback. If there are more questions, do not hesitate to ask. If you have not tried tweaking the params at Desmos, please do: you’ll get a better understanding of what is possible, and what is not.
I’ve created a copy of the plot, and added some more hints regarding where the linear section would go without toe and shoulder:
since blender 4.4 got released today
is your code already updated to AgX from 4.4?
Thanks @kofa for your comments/answers and patience with all our feedback!
Ok, well I’m going to play more and see if I can see the workflow the way you envisage it, because so far I haven’t found that these sliders easily set the black and white points. It might just be me but I’ve never liked these sliders in Filmic RGB either. The way the Black slider comes in from the right and the White slider comes in from the left just doesn’t feel intuitive to me either (highly subjective I know). It’s almost like they are the wrong way round for my brain, which is expecting black on the left and white on the right… Also, the Black relative exposure slider seems to significantly affect the highlights, and vice versa, which doesn’t seem to be the case with Filmic RGB. Are they working how they’re supposed to?
You’re probably right from a technical point of view, and the maths probably needs to take this into account. But what I wanted to express as a user is that I don’t see setting the white point and black points as relative to anything. To me, they are just a limit. I just want to set the black and white points and say “don’t go over/below that point”. I then move on to the toe, shoulder and linear sections afterwards. At this point, I’m thinking of the curve in 3 sections (toe, linear, shoulder), rather than white to mid-grey, black to mid-grey.
I’d be happy for them to be removed if they are redundant, and I would see them as redundant if there is maximum control over the black and white points elsewhere in the module. My pet peeve is setting my black/white points, and then having to readjust them several times later on after moving some other sliders. So, I was seeing the Output sliders as a last chance to set the hard limits for black and white if they needed tweaking. Again, I know this is personal preference and maybe some people don’t mind the dance of the sliders, but I learned on Lightroom, so it’s a pretty ingrained habit for me to want to set hard limits for black and white points right from the get-go.
I have been playing with the Desmos tool, and I’ll go back to it again to do more experimentation. A lot of what I’m saying is just my “working thoughts”. They evolve as I learn more about the underlying principles and the way everything works together. What I initially find non-intuitive may also evolve. So obviously this is all just 1 person’s opinions.
Thanks again for your work @kofa. Ultimately, this is your module. Do what you want with it, and I’ll keep playing with it!
I’m not too concerned about the order of the sliders. It makes sense how @s7habo was working it, but it would be nice to ultimately have them placed in order that requires the fewest iterations to set the tone… what ever that works out to be. But I really do hope we can avoid hopping back and forth between tabs because that gets tiring.
I think the output min and max can help in tone conditioning where you don’t want pure black or white, as described in Sigmoid. But you can do that elsewhere, and this POC is already pretty heavy with sliders.
I looked at Desmos and I agree that anchoring black and white points might not be possible. But here’s the problem that I saw:
Increasing the Linear power can cause the curve to overshoot, and you have to use the Shoulder power to bring it back down. But it looks like you can’t do that using White relative exposure
If you use White relative exposure to bring the highlights down then you reduce the contrast that was set earlier, which defeats the purpose. So you have to use the shoulder and toe power to keep everything within range.
And that’s why I’m concerned that a user could get lost with all these controls unless you had some sort of visual like we have with Filmic. It’s not so easy to recognize all these interrelationships on an actual photo.
But maybe I’m getting ahead of things once again.
Thanks again for letting us participate in the early stages… it’s been a learning experience even if it doesn’t go anywhere.
I agree with this. I’ve done a lot of my experimenting on the same gradient picture as you, and it clearly shows how the curve is affected by the sliders, just like the Deimos tool. It’s much harder to know what the sliders are doing on an actual photo.
I’ve also done a video of the White and Black Relative Exposure sliders. Notice on the waveform how the whole dynamic range is compressed and expanded when moving one of these sliders. Unless I’ve misunderstood these sliders, I don’t see how to reliably set the black and white points when both sliders affect both points.
I haven’t used agx tone mapper yet, but these sliders in filmic are necessary, and you shouldn’t use the other sliders until you’ve set these. There’s a reason why they are in the first tab, they solve the issue of both clipping, and dynamic range compression. Since dynamic range is from light to dark, its expected that they will affect the whole range.
However, looking at screenshots I notice they are not placed first in kofa’s agx module. I personally would change that, unless they work fundamentally different in agx than they do in filmic.
I’m guessing output min and max are equivalent to both filmic and sigmoid’s target black and white? If so, perhaps having the same name might help users be familiar with their function? And perhaps putting them side by side, and last in order, might help also.
I like filmic’s tabbed layout since it helps separate the different functions, and order of operations. For agx, the equivalent looks like:
filmic ‘scene’ tab = white and black relative
filmic ‘look’ tab = saturation, slope, offset, power, hue, toe, shoulder
filmic ‘display’ tab = output min, output max
That allows a lot of people to simply ignore the ‘display’ tab, since they won’t touch the default values.
Yes, I’ve seen that behavior where adjusting white relative exposure impacts the shadows.
What I’ve done in test is to set dynamic range using the Look controls and adjust power to set the image “vibe”. Then play with Linear slope under Sigmoid for contrast and use the shoulder and toe power sliders to deepen or open the highlights and shadows. That’s basically seven sliders all in the same module without a lot of cross talk.
I can get similar results with the current Sigmoid and Color Balance RGB modules, but without all the hopping around from one module and tab to another.
I’m following this thread and seeking to understand it without testing the module.
One question of mine that I hope someone could clarify:
I’m aware that color balance rgb is positioned in the pixelpipe in front of the tone mappers / compressors Sigmoid/filmic rgb/AgX. But the Slope, Offset, and Power controls of AgX seems anyhow to evolve around much of the same as the controls of the 4-ways tab. So what are the relationship / difference between the luminance sliders at the 4-ways tab and similar controls on AgX?
Is the thinking in reality back to what was the case when the original filmic module was launched in dt 2.6 in 2018 and release notes said about the module that it was “able to manage most aspects of the tone of an image in a single module”.
It’s based on the original Python scripts from 2022, plus the adjusted matrices from EaryChow (using Rec 2020 instead of Rec 709).