RGB Saturation Gamut Mapping Approach and a Comp/VFX Perspective

Interesting. Certainly has serious implications for invertibility. The advantages of the C2 continuity of tanh need to be balanced against the fact that it goes so soon into non-invertibility.

15 posts were split to a new topic: Gamut mapping compression curves

Yeah, atan is the next one that is C2 continuous and maintains saturation to high level.

Hey @JamesEggleton,

It should be trivial to add them in the notebook, everything runs online!

I believe that preservation of “color purity” or “saturation” is a by-product of the threshold, not the compression function.

Tanh happens to maintain saturation at a high level because the initial slope is steep.

However, if the threshold is set with the intention of preserving high saturation, the same result can be achieved with the simple Reinhard compression function.

Here’s an example using the beautiful lambertian sphere :smiley:


This is the original with out of gamut values rendered through the ACES Rec.709 view transform.


Here’s the same image with tanh cmopression, with a threshold value of 0.4.


And the same image with Reinhard compression with a smaller threshold of 0.21. Note that the color purity of the blue sphere is pretty similar to the tanh compression curve.

(As a side-note if you look closely at the left cyan blob you can make out the more sudden transition of the Reinhard curve. I’m not sure if this is a by-product of the lack of C2 continuity or just the more abrupt transition of the curve from linear to compressed.)


And finally here’s a plot comparing tanh and reinhard.

Note that distance here is a parameter that specifies the distance beyond 1.0 to compress to 1.0. So a value of 0.24 compresses a distance of 1.24 to the gamut boundary.

I am following this conversation with great interest. It is all amazing work you guys do.
While it is important to solve the bit with the 1D mapping of RGB ratios it is not the last bit.
We need to remember that the neat trick of constructing RGB ratios might have reduced the 3 dimensional problem to 1D on first sight. But I am afraid there are more things to explore.

Here are a few questions or thoughts:

  • How does the Gamut Mapping algorithm handle motion graphics with data that is very different to natural image statistics?
  • How does a red logo look like if the whole logo is out of gamut along the primary vector (but still with some scatter?
  • how well can we pull a key of saturated greens (slightly moved towards cyan (because of unideal white balance)) if we apply the gamut compression early in the pipeline?
  • what happens with feathers of wrong premultipied saturated text(yes this happens sometimes)?
  • How well can you grade through such a process? If I crank up naive saturation before, does it react good?

This might help us to answer the questions about order, mandatority (is this a word) etc…

My thoughts on the 1D mapping:
On natural images all of the proposed shaper function might work. I think a bit of overshoots are actually not a problem, I would rather give the next process block a bit of flesh to work with before flattening any data. If you leave a bit of topology in the data it is easy for other steps to further sander it. It is much harder to unflatten flat areas.

3 Likes

@jedsmith has merged my updated Matchbox shader version of his gamut compressor into his repo, so there are now matching implementations in:

  • Nuke (BlinkScript and pure Nuke)
  • DCTL (for Resolve Studio, or watermarked in Resolve free)
  • Matchbox (for Flame, Baselight and Scratch)
  • Fuse (for Fusion and Resolve)

Hopefully this should make it easier for anybody, no matter what their preferred software is, to try out the current incarnation of the gamut compresser.

4 Likes

4 posts were split to a new topic: Artificial test image lit by LED spectra

This is an amazing thread. Thanks to @jedsmith for starting it and to everyone for contributing.

In the interest of making it easier for readers to follow the different topics that are interwoven here, we are moving the discussion of LED lights started by @hbrendel to a new thread, and we encourage you to begin new, more topic specific threads to continue these conversations. Please only post here in direct response to earlier posts. If there are important items here that are relevant, please link to posts in this thread in your new thread.

This thread is not being locked for now. But please treat it as if it is!

EDIT: I have also moved the discussion specific to compression curves into a new thread.

3 Likes

…and in recognition of @jedsmith starting this topic, we’ve awarded him an Epic Thread Badge!

6 Likes