Blender AgX in darktable (proof of concept)

here the macOS arm64 build:
darktable-5.1.0+705~gf9dcc3d866_arm64.dmg

same comments as in Blender AgX in darktable (proof of concept) - #181

2 Likes

Now it is interesting to see how much saturation can be squeezed out of the very limited color space without clipping. This photo would burst at the seams without gamut compression:

It’s time to learn how to do it best.

11 Likes

This could be a good one to try too…

From signature edits…

1 Like

And this one:

e class='quote' data-post="72" data-topic="31646">
A real hdr image from a Sony hdr video demo (4000 nits peak brightness),I have extract a frame and done the conversion to rec2020 floating point : Sony 4K HDR Demo - Camping in Nature.mp4.7z (10.8 MB) the frame [t004100or] My version (actually it is sigmoid ) hdrframe.pfi (16.1 KB) [t004100pf] RGB per channel tonemapping [t004100rgb] Darktable no preserve chrominance [t004100dt-no] Darktable preserve chrominance [t004100dt] Sigmoid with film-like hue preserve (the same used i…

For such an example, you need the control for individual primary colors.

With output gamut compression you have the red and secondary color yellow under control:

The green, however, needs more compression.

Instead of increasing the output gamut compression in Agx, you can use RGB primaries to reduce the purity of the green to bring it back into the gamut:

And finally, you could increase the saturation in mid-tones and highlights in Color Balance RGB:

Here again the game with Agx, color balance RGB and RGB primaries:

9 Likes

AgX, using Blender’s default primaries:


AgX, using ‘smooth’ primaries from sigmoid (using sRGB as base)

sigmoid, smooth, sRGB base

sigmoid, smooth, Rec2020 base

And, just for fun, AgX, Blender’s defaults primaries, Punchy:

3 Likes

AgX Punchy, Blender primaries, 40% hue preservation.

6 Likes

Great results!

Are you playing with the new version now, or with the one we already have?

The new one. I’ll create a build after some more testing / clean-up.

4 Likes

A new build with the long-promised primaries functionality, and more detailed gamut compression. We now have a lot of sliders; let’s see if we can get rid of some of them.
Ignore the one I called ‘vibrance’, it’s really broken, will be gone, but I’m too tired to do it now.

https://tech.kovacs-telekes.org/dt-agx/Darktable-5.1.0%2B790~gbe4413b36c-x86_64.AppImage (based on 8bbdd58 from master)

@MStraeten , @Dave22152 , @priort , please update your builds once again.

About the new gamut controls: it’s a lot of sliders (12, to be exact). You really don’t need to modify them all the time.
A synthetic example: a colour wheel in Rec 2020, brightened using exposure.
Without tone mapping and saturation control:

With clipping indicator: ‘white’ indicates black, black indicates clipping. Almost the whole wheel is out of gamut for sRGB:

sigmoid with the smooth preset, sRGB base:


Nothing is out of gamut.
Even if I push recover purity to 100%, we get no out-of-gamut colours (but we don’t get much saturation back, either):

Almost the whole colour wheel has collapsed to the secondaries.

The agx module, with defaults (no compression, no insetting, no rotation), picking auto exposure only:

We don’t get a gamut warning, and the image is more saturated that with sigmoid, but transitions are ugly and abrupt.

Blender-like primaries insetting / rotation, recover purity at 100%:

The transitions are still quite abrupt. We can increase attenuation:

The transitions are nice and smooth.

Or, we can adjust the input oversaturation controls:

We still have out-of-gamut colours, but it’s because components are > 1 → too bright.

With a small increase of relative white exposure:

The major differences:

  • attenuation / insetting affects the whole gamut, and can be reversed (restore purity)
  • the gamut compression only affects the most saturated colours; the ‘compression target’ defines the range into which out-of-gamut colours are squeezed; the default of 0.2 means the same as the previous hard-coded value (which left the bottom 80% alone, but there was also a bug in the compression).

The primaries shifts / insetting from sigmoid seem to work very well for LED lights, so I’ve provided those, as well.

Much of the code was taken (almost) verbatim from sigmoid, where it had been added by @flannelhead – huge thanks for your work (and that of @jandren as well, of course).

As said earlier, the gamut compression code comes from @jedsmith. Plus, there is also the lower guard rail from Sakari, so even if you don’t compress the gamut, negative values are avoided.

The whole compression / handling of negative is done after insetting / attenuation, as attenuation may avoid negative values.

I’m the proud owner of all bugs I introduced, and all the stuff I misunderstood. :crazy_face: The rest belongs to the clever people mentioned above.

16 Likes

I just happened to be on my PC when your latest message came in. Here’s the latest Windows build:

– deleted –

4 Likes

Kofa, why does the first image show a lot of the secondaries and only a little of the primaries pls?

Because everything is clipped. I’ve started writing an article about it, and cannot explain it now, it’s past 10 PM here. I’ll post details later this week.
Maybe search for “Notorious 6” or N6 tone mapping.

2 Likes

I didn’t think y’all slept over there… :wink:

Thanks @Dave22152 , but I’m not seeing the new controls in this build. Is it working for you?

I just noticed that myself. It looks like its the previous build. I’m checking into it.

All - it looks like something’s wrong with my build, so don’t download it just yet. I’ll check into it and provide a new link.

Sorry for any confusion.

No problem. I guessed it was probably just the old build. No rush!

1 Like

Let me know if it’s broken after the check, I can have a look tomorrow night.

Nope, I goofed. Here’s the correct build:

https://www.dropbox.com/scl/fi/7o28a2oymk2mzx4knsp3g/darktable-5.1.0-790-gbe4413b36c-win64.exe?rlkey=j80cpnuibbbz7aznxdwaw9miw&st=dsiwb92w&dl=0

2 Likes