Has anyone pulled off a satisfactory HDR HLG BT 2020 export using the AGX tonemapper?

I’m honestly amazed at how few threads there are on here about HDR exporting with darktable… HLG AVIFs have been my primary delivery format for my personal collection of images for about a year, and I’ve been using the following baseline settings to produce good results:

sigmoid tonemapper:

contrast: 1.2 (this is sometimes changed anywhere from 1.0 to 1.4 depending on the scene)
skew: +1.00
target white: 1600.00%

I export to 12 bit AVIF with the profile HLG Rec2020 RGB.
In the global settings, I apply an appended style which adds a -1.2 EV exposure module right after the standard exposure module, to correct for a bug (?) with the HLG export profile where it would otherwise be too bright.

I’ve been interested in moving over to the AGX tonemapper, but I haven’t found satisfactory settings that don’t just produce a bright SDR image. Has anyone had any success with it?

I use only AgX and shoot mostly in HLG.

However, I also always export to P3 HLG. Even if, according to the manual: “ the general recommendation is to stick to sRGB unless you know what you are doing and have a good reason to do otherwise”.

The good reason is that sRGB is a narrower range both in color space and tone and I want to use the full range available to my camera.

On P3 screens, iPhone, MacBook, they tend to look fine. Maybe with a tendency to easily crush the shadows a little bit.

I’m not sure whether this is because I set a very low EV in the clipping warning ( 16-bit sRGB, basically the minimum available) and follow that indicator as a guide, or it is something with the tone mapper.

I’ve little understanding of this stuff, but my idea is that if you’re only planning to share and use your photos in sRGB mode, or even printing them, then shooting in HLG and compressing to sRGB is more harmful than useful.

1 Like

Blender’s AgX, at the time, was not designed for HDR output, as I understand.

3 Likes

I am very curious to know how you do this… I never got HDR looking good on my Mac with darktable

Hey there - I got fed up trying to make it work in Darktable and made a dedicated finishing application for HDR exports.

It’s free and open source. I posted about it here the other day but no one commented yet.

Please feel free to check it out and let me know if you’d like to see any additional features. :slight_smile:

And here are the instruction on source preparation going from Darktable into HDRF - It’s also in the documentation on github and in the app:

OpenEXR with linear Rec.2020 is the preferred handoff.

  1. Complete RAW development with scene-referred modules.
  2. Disable filmic rgb or sigmoid for this handoff so their display rendering is not baked into the source.
  3. Choose linear Rec2020 RGB as the output/export profile.
  4. Export OpenEXR, 32-bit float, native dimensions, ZIP or PIZ compression.
  5. Import and confirm Scene-Linear Rec.2020.

A 32-bit TIFF with an embedded linear Rec.2020 profile is a fallback if EXR is unavailable. Avoid ordinary display-referred sRGB, Adobe RGB, or an SDR tone-mapped export when the goal is to preserve scene headroom.

1 Like

Thanks, I’ll give it a go when I have some time. I’m already exporting some non-tonemapped images in linear Rec2020 in exr format to use as base images for editing in spektrafilm.

I don’t have an hdr monitor, but I do have an iPhone. Hopefully I’ll learn a few things about hdr. :grinning:

Disclaimer: we might have a different idea of “looking good”. However, these are my settings.

I take for granted that you have your Mac’s display set to “Display P3”.

I set Input color profile with:

  • Input profile: Standard color matrix
  • Working profile: Linear Rec2020 RGB
  • Gamut clipping: Off

Output color profile:
Export profile: HLG P3 RGB

Export Module:
Bit depth: 32 bit (float)

The clipping indicator has an upper threshold of 99% and a lower threshold of -20.69 EV (as per tooltip: "16bit sRGB clips black at -20.69EV).

Not sure if these settings are sane or useless. Nevertheless, since I work primarily on an external screen which is definitely not P3 (although declares to be HDR), I trust the histogram, not my eyes.

That is, when I adjust exposure first and then the various settings in AgX, I aim to cover the whole range. I make sure that the spectrum is not clipped on the right (there’s no point to clip the highlights, I make sure that there’s no red patch with the clipping indicator). However I play with the sliders in AgX to make sure that the histogram almost reaches the right side.

On the left hand side, of course I try not to clip too much the blacks, but I don’t mind if it happens here and there. In fact some hi-contrast photos can have deep blacks.

I have to say that the final judgement must come from the exported file, not from the preview in darktable.

1 Like

FWIW, there is no clipping (neither highlights/shadows nor gamut) when exporting to any float output in darktable (EXR or TIFF or JXL in 32b or 16b “half”), so even linear Rec709 profile is fine for interchange (and maybe even desired for widest compatibility as that is the default/assumed profile for EXRs and some 3rd party apps might not detect anything else automatically).

P.S. The 16b “half” float EXRs are just fine to cover almost all HDR needs, 32b is overkill.

Completely unnecessary. No need for float when you have a tone curve. Float is for linear.

Good to know.

You understand that, unless these details are explained in the documentation and I completely missed them, a normal user will try the safest (i.e. widest) option.

Do you even need a tone-mapper when exporting HDR? As far as I understand it, tone mapping is only required due to the displays inherent failure to display the entire DR of the scene. I have always seen it as a fancy compressor that emulates some psycho-visual effects of how our eyes interpret light. When HDR can display everything as it is (or close to it), your own eyes already do the tone-mapping :smiley:

Isn’t it up then to the image viewer to tone map the HDR into your SDR screen(if that’s the case), and when viewing in HDR, just display it as is?

Understood, but here my worry is that I compress the tone range too much so that the highlights lose their brilliance. That’s why I use the histogram as a guide.

Is it correct to assume that the histogram represents the chosen output profile? My biggest concern at the moment is how to work out a HLG raw and not to lose its wider range.

Perheps a “gentle” one for HLG, as that space is limited to 1000-2000nits. Indeed, when exporting to PQ a tone mapper might not be even needed as that output space is huge (10000nits always), and the display/decoder actually does (or should do) tone mapping according to its output capabilities.

2 Likes

I use the tone mapper (in particular AgX) and more in general, an editor like darktable, to make aesthetic and artistic choices. Like for any other module by the way.

The tone mapper has a fundamental role in giving the image a certain look, whether it’s emulating some films or other results.

What is the point of shooting in HLG if then I have to always reduce my image to a narrower range?

OpenDRT supports HDR output, and I think Blender 5 also has some HDR-enabled AgX version. I have no HDR-capable output device, and mostly share here and on Facebook, so I v don’t need HDR output.

I have a port of OpenDRT, but there are so many new modules now that it makes me uncomfortable. I’m trying to contribute bug reports and fixes instead.

7 Likes

I think I commented in another thread here, the easiest way to get an HLG picture is to export in Rec.2020 2.4 and pretend it’s HLG.

Darktable doesn’t give you a choice of gamma. In output color profile or in the export module you can only select a profile, such as sRGB or linear Rec 2020, which combines space and encoding. After AgX, the data in the pipeline is not ready for display, it has no gamma applied.

All this stuff but is still very technical and confusing and sometimes (often) I wish there was more documentation aimed at end users.

For example, I kind of understand what HLG is (after all there’s Wikipedia to help and I’m a physicist by background), but I read your comment 3 times and still don’t get exactly what it means.

  • darktable doesn’t give a choice of gamma
  • output color profile and export modules do not apply a gamma (did I get it right?)
  • after AgX the pipeline is not ready for display (because there’s no gamma applied, but then, since gamma is never applied, does it means that the data is never ready for display? is this relevant for us?)

What I have noticed, practically, is that if I push the histogram close to the right hand side (mostly with the exposure module, but also by tweaking contrast and other sliders in AgX), and then I export with a HLG profile, I get those bright highlights which are typical of HDR photos.

So I’m assuming that the right end of the histogram plot represents the point where the whites are clipped, and the actual intensity (for lack of a better word) of this limit is set by the output profile.

Am I understanding this right?

I was responding to Eary’s post. In Blender, AgX produces output that can be sent to the display immediately.

In darktable, since the rest of the pipeline expects display-referred (bounded) data with linear encoding (no ‘gamma’, no transfer function (OETF)), that is what AgX delivers. The ‘gamma’ that you can tweak in the module is not used for the display encoding.

In darktable, if you choose, for example, sRGB for export, you get:

If you choose linear Rec 2020, you get:

  • colours converted to the Rec 2020 space, as defined by its primaries
  • no transfer function

You cannot say “I want Rec 2020, and apply gamma 2.4 as the OETF”.

If you export in floating point (at least for linear data, I don’t know about the rest), no clipping to 0…1 is applied (negative values as well as values above 1 are both kept).

1 Like

Thanks, after the explanation earlier, I no longer export in floating point.
My major concern is that the exported files look good on a P3 screen. I have no idea of how they look like on a SDR / sRGB (I guess I could just temporarily change the settings of my monitor, let me try…)