Exporting images for use in HDR TV production

Sorry, but it’ll have to be someone w/ “skin in the game” who actually uses the workflow and can formulate a proper and detailed proposal/requirements. There have been several discussions already on dt github, but nothing concrete.

And then there’s of course Adobe’s HDR Optimization

1 Like

Well, since you mention Adobe, let me also add as reference how this is done in ART, in case anyone is interested. I can confirm that it works at least on 1 sample (that is my TV :slight_smile:

3 Likes

Not sure how well it works, since I don’t have an HDR monitor, but one of the drivers behind the scene-referred workflow and filmic was specifically being able to handle HDR output, so it seems you have misunderstood something.

In filmic I assume you need to use display > target white luminance to set the desired DR. The manual isn’t entirely clear on that.

1 Like

I tried that later, but it didn’t do much difference. I guess it’s about the 0 to 1 mapping mentioned above, setting middle grey way too high.

But why would you need a tonemapper like filmic or sigmoid for HDR output?
I thought the whole idea behind filmic and sigmoid was to map the high DR of modern cameras to the much lower DR of current standard screens and paper.

Also, the idea of mapping a very large DR to a range of 0…1 with a fixed point at 0.18 sounds … complicated.

Even a HDR display is finite I guess. I don’t have a HDR screen myself but rather draw from knowledge reading up how ACES works.

I guess the 0.18 point would have to be mapped to 18% of diffuse white, an not the theoretical max (e.g. 10 000 nits for PQ). We have to remember that diffuse white in an HDR signal should not be much brighter than in an SDR signal, usually around 100-200 nits. The rest of the dynamic range should be reserved for specular highlights and light sources. So this would place our 18% around the 18-36 nits area.

I get the impression that a lot of TV/movie productions still maintain a film-like curve, just slightly less aggressive, in order to preserve the “look” of film.

It is true that you can just feed un-tonemapped HLG to a TV and it’ll actually look pretty good (note that the TV itself may do some tonemapping internally), whereas if you feed un-tonemapped SDR to a monitor or TV, it’ll look dull and flat.

Back ages ago, what I did was export linear Rec. 2020 from darktable, and then use ffmpeg’s zscale filter to do the HLG transform.

Found where AP talks about filmic and HDR:

@hpbirkeland Seems that display white should be 400%

Because the input DR is not the same as the output/display DR. One way or another, that will have to be managed.

So I’ve spent a few hours today experimenting with this, and I think I found a workflow that works well. So far I only tried with Sigmoid, I might try with FilmicRGB at some point. The main thing I found was that I had to set the contrast in Sigmoid to 1. I used mainly 400% (thanks, @Donatzsky) as display white and exported linear rec.2020, exr and tif. This works very well. I import into DaVinci Resolve in a color managed project, set the input colorspace for the images to Linear, and everything works just fine.
I also tried to set display white to 1200% as suggested by @jandren, but the difference was barely visible on the waveform monitor in Resolve.

So far I am happy with the results.

Btw, for those who wonder why we need a tone mapper when we output to HDR: The 0-1000 nits range is still nowhere near the dynamic range of a real world scene in bright sunlight. We are only a bit closer than with SDR output.

1 Like

Why does this matter?

Because we still need to map the captured dynamic range down to a smaller range, even though the difference isn’t as large as with SDR.

2 Likes

Sorry for the very late reply. I have been (re-)processing a few hundreds RAWs for HDR lately, using Darktable, the JPEG XL format, and Adobe’s Gain Map demo app (just used as an HDR viewer, without the actual gain map functionality). I haven’t worked with video, but I figured out a workflow that works decently well for stills.

I will try to write a long post detailing my workflow at some point, but I can already give a rough outline, in case it can be useful.

As a spoiler, here is my list of active modules for a fully-processed image (that was initially exposed “to the right”):
image
With the right settings, these modules work well-enough for HDR content.

I process each image as follows:

  1. I first apply all corrective modules (white balance, highlight reconstruction, lens correction, orientation, denoise, diffuse or sharpen, etc…).
  2. Then, I enable the “ISO 12646 color assessment conditions” (the light bulb icon) and adjust the exposure, paying attention only to the shadows and middle tones (I’ll deal with the highlights later). For bright scenes, the highlights will look badly clipped in the preview; this is expected.
  3. I optionally apply a RGB curve to the shadows only (adding a few control points on the diagonal to make sure that the upper part of the curve retains a unit slope, so that it will extrapolate fine to values > 1.0). This is especially useful to correct the contrast in the shadows if they are are a bit noisy.
  4. Then, the most important part: because I assume (like Adobe) an SDR brightness of 203 nits, and I will output to PQ with a theoretical peak brightness of 10000 nits (which I believe is encoded as 1.0 in the JXL file), I add a second exposure module with a correction of log2(203/10000) = -5.62 EV. I checked with Adobe’s viewer that the middle tones of the image match between a SDR JPEG (with clipped highlights) and a PQ JPEG XL with this correction, so I think this is the correct scaling to apply. After this step, it is expected that the preview will be very dim.
  5. I optionally use the tone equalizer module to dim some too-strong highlights that distract from the main subject. In principle, a second tone equalizer could be used for the shadows (by placing it before the exposure scaling module).
  6. Finally, I apply some base curve to smoothly clip the strongest highlights. My curve is not particularly precise, but what matters is that it is linear with unit slope in the shadows, constant above some predefined luminance target, and it smoothly interpolates between these two regimes. This limits the top luminance of the output image (or, equivalently, the HDR headroom). I have defined a few presets, corresponding to various top luminances.
  7. In the “export” module, I select JPEG XL (12 bit) as the file format with a PQ Rec2020 RGB profile and a perceptual intent.

In order to speed-up the above process, I created a style that I can use as a starting point. It enables the relevant modules in the correct order (with small non-zero values to prevent darktable from e.g. “merging” the two exposure modules). I then temporarily disable the exposure scaling and base curve, adjust the middle-tone exposure as needed (and optionally apply some RGB curve), then re-enable the two disabled modules and export the image.

My main issue with this workflow is that the Darktable preview is limited to SDR (even sRGB on macOS…). This makes it a bit tedious to make precise adjustments, because you need to export often and use an external viewer to assess the changes. But it technically works, and gave me some amazing results! I find that HDR pictures tend to be much more “true to life” than SDR ones. Interestingly, I even find that processing RAWs for HDR requires less work than for SDR, since I don’t need to torture their dynamic range until it fits an ~8 EV range.

I hope sharing this will be useful to some of you, and I would greatly appreciate any feedback/suggestions about this workflow, especially if there are any colorists reading this! One difficulty that I still haven’t fully overcome, is how to keep the luminance consistent across a series of scenes/pictures. I try to keep the lighting conditions consistent when working on my laptop, and I have a very rough zone system in my mind (to allow for a higher median luminance in bright daylight scenes, and a lower one in night scenes). But I am sure there must exist more principled ways to do this!

2 Likes

Hi,
Thanks for sharing your workflow. Do you happen to have pairs of SDR and HDR renderings of the same scene that you can share? I’d like to do some tests on my TV…
Thanks in any case!

1 Like

Yes, I’ll try to produce a few pairs, maybe today or later this week. (I need to find some good examples, which don’t involve people, etc…)

1 Like

Yes. I’m a colorist. I’ll look into this when I get some time available :slight_smile:

I’m curious why you don’t use tone eq for this as well.

There was a similar discussion with some other tidbits in it in case you missed it…

Actually, I have found myself using it more and more for this purpose, with the base curve being almost a no-op in most pictures. For instance, I would use the tone equalizer to slightly dim a bright sky, and only use the base curve to deal with very bright specular highlights such as Sun reflections or artificial light sources.

One advantage of the tone curve is that it flattens at a pre-determined luminance, while the tone-equalizer only deals with relative exposure corrections within ±2 EV. So it’s a good set-up-and-forget module that I can enable by default, in order to make sure that the luminance of the final image is bounded from above.

Sorry, I had completely forgotten about this… :grimacing:

But today I ended up posting some similar SDR/HDR renderings of the same scene in a different discussion thread:

Hopefully they can be useful to you.