Blender AgX in darktable (proof of concept)

I echo your comments 100%…

3 Likes

:smiley: You really got me worried there - did I break something that badly? :smiley:

Thank you for your comment. I’m reading more about the subject. My primary aim was to learn from this, but of course, if people like it, it could become a ‘real’ module.

Maybe we won’t need it, after all, if @flannelhead can tweak sigmoid. I hope that if the offset/power/slope could be added to sigmoid, and he tweaks the params, we wouldn’t need yet another module, just a few presets to sigmoid, avoiding further bloat.

6 Likes

I absolutely agree. The less redundant modules the better. And sigmoid is already very good.

2 Likes

I’d take a new module for something this good.

6 Likes

So far I really like it.

I can see some differences especially in the treatment of contrasts, highlights and also the colors. The treatment of saturation in highlights is also different.

There are some photos where I can’t get such nice results with Sigmoid as with AgX. Or at least not as fast.

Here is an example. In Sigmoid (right snapshot) I had to make some adjustments to get a similar result as AgX (left):

6 Likes

Ok, guys, probably I’m now making a complete idiot out of me. I tested a lot and compared a lot.
…and probably I shouldn’t have done that. After all, I have to say, the results leave me a little bit puzzled.

Comparing AgX with sigmoid and tone curve, here are some further observations, some probably stupid questions (sorry I’m just a user not a developer nor a physician) and an example which is hopefully useful to the developers.
…and maybe to bring some theoretical science to my brain.

  • Colour handling is completely different in AgX. Especially visible on blue tones, where hue differs from the other edits. (I corrected this as far as possible in the other edits)
  • The saturation slider in AgX Module does more than only changing the saturation but also lifts the shadows.
  • In sigmoid, you have to use the exposure slider to get an as bright picture as with AgX, even so offset is set to zero.
  • On pictures with high dynamic range, simoid tends to desaturate to an enormous extent. The same counts for AgX, but you have the saturation slider, which is anyway useful to manage the high contrasts (as it lifts the shadows)
  • With AgX you need less modules to achieve a similiar result (compared to sigmoid)
  • The tone curve result is a bit more crispy, especially in the darker areas, I would prefer this but I easily could achieve this on the other edits with increasing the local contrasts a little bit.

So here are the stupid and probably provoking questions:

  • Why are tone mappers better than using a tone curve?
  • Why are tone mappers treating colours so differently (mostly saturation but partly as well hue)

And here is my example - you know it already from the Play Raw category. I tried to use as less modules as possible to get a pleasing, natural result, which should be as similar as possible on all three renders

I started with AgX and then tried to achieve the same result with the other methods. I used two instances of local contrast and shadows and highlights to get a for me pleasant result. The settings for these modules are the same on all three edits. Any further module in use was only to get a similar result to the AgX edit.

20240303-1244-8321.cr3 (34,6 MB)


20240303-1244-8321_11.cr3.xmp (9,2 KB)


20240303-1244-8321_14.cr3.xmp (10,4 KB)


20240303-1244-8321_15.cr3.xmp (10,0 KB)

1 Like

I’m sure you will get a better answer but the simple one or at least how I think about it is in terms of DNR… The tone curve is a tool “primarily” used to manage contrast of the image in the existing DNR where as tone mappers are about impacting DNR of the image and the required math to do that… If you don’t need to manipulate DNR in your image to a great extent then do you really need a tonemapper??

Way over simplified but I think that is generally the case…

1 Like

Traditional tone curves take input from 0…1 and take it to 0…1.
The curves in filmic, sigmoid and agx_ do the same, but:

  • they transform the input into log space
  • edit: importantly, the input it not limited to 0…1 (thanks, @rvietor )
  • normalise the display-referred result into 0…1

You can actually do something similar with the base curve module, where you can use the scale to compress the x axis (devoting more space to shadows, less to highlights, similar to what log would do). You just have to drop the exposure to make sure the input fits into 0…1. Note: this is with the base curve set to linear (essentially disabled):

Then, with the base curve turned on:

This is very hard to handle, though – notice, how steep that curve is, even though I used the maximum value for scale.

sigmoid and agx don’t show the curve, but filmic does:

Note that the dynamic range exceeds 16 EV. But instead of dealing with values ranging from
0.0000152587890625 (2^-16, so -16 EV) … 1, the logarithm will handle values ranging from -9.81 to 6.84 (relative to middle grey). Even if you were to edit it by hand, it would be much easier than with the base curve.

5 Likes

Well, at least filmic and sigmoid are not limited to inputs below 1, that’s the whole point of those modules and scene-referred editing…
That what made me switch to filmic, before I had to ensure that scene values were actually in the range 0…1 before basecurve, not having to worry as much about the input range made editing a lot easier…

1 Like

You are absolutely correct, I forgot to highlight that difference. I’ve updated the description.

I know we often have discussions about reducing the number of modules and simplifying the user experience, but I’m always happy for more choices, and it’s one of the things I love about Darktable. Perhaps the ideal would be to merge the strengths of both Sigmoid and AgX into a single tone mapper, but if that’s not possible, or it adds too many sliders to the new module (subjective), I’d take an extra module any day. Darktable is all about choice and we can all simply choose to hide/ignore the modules we don’t want to use.

3 Likes

To have all three tone mappers (visible) in the same version of pixel pipe workflow, may be like inviting more users to do something wrong, (-- although I’ve noted the method of @priort to use a style with both filmic and sigmoid included, but at the outset both being deactivated ).

But it’s possible to envisage some kind of either-or panel, where we can easily switch to see which tone mapper we want to employ – if any at all.

1 Like

I agrees! I tried a few photos with large dynamic range, and must say, I really like the way AgX handles highlights. Very easy to use and nice results without a lot of pushing sliders! I would vote for a PR, when it is ready!

1 Like

As long as it does not affect the previous edits… I guess it will need some kind of version managment like the color science versions in filmic rgb?

This reminds me how I appreciated Lightroom’s way of of handling changes to its “modules”. Lightroom has a global process versioning called “process version”. Don’t know if this approach would work in darktable though…

I successfully installed the Windows build but when I opened it, it wanted to “update” my darktable database so I declined. I’m not sure if there’s a way to truly install a separate instance of darktable on Windows or not. If not, I might just spin up a Linux VM later and play around with the appimage.

Yes, there is. You can change the config path as described in the manual.
https://darktable-org.github.io/dtdocs/en/special-topics/program-invocation/darktable/
Or, searching this forum, e.g. How to run 2 sessions of darktable (how to show 2 live edits side-by-side) - #5 by 123sg

2 Likes

I like this agx tone mapper and hope it moves forward to make into the master. But is a good thing that I had copies of the data bases to revert back to. Now I just need to figure out how to use “–library memory” with the appimage that I downloaded.

1 Like

A quick edit with similar processing. Sigmoid on the left and AgX on the right. The patterns of the duck’s neck are clearly visible and brighter with AgX, plus the details of the head are discernible and the slight variations in color are more apparent.

4 Likes

this is how I create my master version of darktable. It seems the the linux agx versions are in appimages, which seems to use the same .config files.