Game changer : Mastery of Colors & Film simulation

I’m going to present this tutorial in 2 pages to make it easier to read, because it’s quite long. And excuse my bad english.

When I look and listen to other open-source software around me, all anyone talks about is “…X”. As we say in French ‘ça tombe comme à Gravelotte’.

There are few (if any) references to “…X” in RT, and I don’t think that will change (at least not on my end). I’m not saying these aren’t good methods (they are), but:

a) there’s something equivalent in RT, even if the concepts and vocabulary are different;

b) some tools require implementation work (code modification, downloading and configuring libraries, etc.) that isn’t accessible to everyone. These ‘custom’ tools are certainly relevant, but they only allow exchanges between users who have installed them (and what about updates?). Since its creation, RT has maintained compatibility with previous versions (which is often a drawback) and is delivered as a complete package. Everyone receives the same distributed package, thus ensuring compatibility over time and between users. So, in summary, yes to these tools if they can be fully integrated into the overall code.

This tutorial is not intended to say that other tools are bad, nor to provide a comprehensive overview of colorimetry, but to highlight the latest recently implemented changes.

In summary:

    1. Color Appearance & Lighting : by allowing hue rotation (slider) , saturation (slider), brightness (curve) variation for each R, G, and B channel.
    1. Generalized Hyperbolic Stretch (GHS) : through use and adjustments of settings, whose default values ​​have become ‘neutral’
    1. Abstract profile : a) by using the visualization of maximum R,G,B data or RGB saturation, to guide the action; b) by giving the possibility to act on the ‘Gain (Ev)’ at the output, as well as a possible compression of the gamut before the output process(es).

Educational objectives:

  • Demonstrate the use of the new ‘Color Appearance & Lighting tools’ (CIECAM), for: a) To finely control colors in terms of hue, saturation, and brightness for each of the R, G, and B channels, entirely within the second CIECAM process - Image adjustments - in order to adapt the color gamut to specific needs (sky, sun, shadows, flowers, etc.)

  • Demonstrate the usefulness of the new indicators in ‘Abstract profile’ and the ‘Gain (Ev)’ and ‘Gamut compression’ settings in the final phase of the RT process, just before output.

  • Show the possible association of 1), 3) - and to a lesser degree 2) - above, with the tool already in place in RT (Film simulation - HaldCLUT) to complement it with corrections of hue, saturation, brightness and contrast, while finely controlling the gamut.

I will give general advice or methods, using a specific example : “The Blue Horse”.

Selected image :

I chose a well-known image, which is more complex to process than it first appears: 'The Blue Horse – 2010_MONTR_033.NEF’

Raw file : The Blue Horse

First treatment (without Film Simulation)
pp3 file :
2010_MONTR_033.NEF-col1.pp3 (18.8 KB)

I will go through the steps again, highlighting the reasons why and the key points.

  • set to ‘Neutral’ - which will set almost all the tools to values ​​that cause few or no problems. The image, however, is dull and lacks contrast.

  • Activate ‘Highlight pixel out-of-gamut color’, and choose the output profile for ‘Soft proofing’ (often ‘System default sRGB Color Space Profile’)
    image

At this stage, just look at the image and the histogram.

a) If the image in ‘neutral’ mode already shows green dots scattered across the screen, then the processing will be difficult.

b) If the histogram looks like this, there is at the very least a problem with the black point adjustment


c) If the histogram shows this second aspect, we are probably dealing with a high dynamic range image, where it will be difficult to find a balance between shadows and highlights. This is the domain of “tone mappers”.

d) Fortunately, not all images are like that, and the histogram in ‘neutral’ mode is usually quite well distributed. For example for ‘The Blue Horse’

  • Highlight reconstruction – Color Propagation (Exposure Tab) - disable ‘Clip out-of-gamut colors’. At this stage, we don’t yet know if this selection is useful. It allows us to find the maximum linear value of the white point. Depending on the values ​​found later in GHS (Selective Editing) or in Gamut Compression (Color Tab) , you may or may not want to disable it.

  • If the value found for White point (WP linear) with ‘GHS’ ‘Auto Black point & White point’ enabled, is higher with ‘Highlight Reconstruction’ enabled, then leave Highlight reconstruction enabled, otherwise disable it, because it consumes ressources.

  • The values found for ‘Maximum achromatic value’ in Gamut Compression (Color Tab), are strongly influenced by the settings chosen for ‘Clip out-of-gamut colors’ and ‘Highlight reconstruction’. In this case (‘The Blue Horse’), I preferred to keep ‘Highlight reconstruction > Color propagation’ enabled and uncheck ‘Clip out-of-gamut colors’

  • Capture Sharpening (Raw Tab) - Enabled - You’ll notice that “Contrast threshold” isn’t set to zero. You can leave the default settings. The image doesn’t appear to be noisy, so don’t change anything for the two sliders (Presharpening denoise, Postsharpening denoise)

  • Raw Black Points (Raw Tab) - Activate ‘Dehaze’. Since the sliders remain at zero, it likely indicates an incorrect black point setting due to haze; you can deactivate it.

  • White Balance > Automatic & Refinement > Temperature correlation : The illuminant, a priori, is of the Daylight type; this automatic setting should be the most suitable.

  • Gamut compression (Color tab) : Check if the histogram changes when you enable or disable it. Of course, choose the same ‘Target compression Gamut’ as the ‘Soft proffing’. If it does change, the automatic settings should be fine. Look at the ‘Power’ incidence (the higher it is, the purer the compressed colors will be). Try slightly adjusting the values ​​of the three ‘Threshold’ sliders and/or ‘Maximum Distance Limits’. But most importantly, look at the values ​​of the three RGB channels, which in this image are each around 1.7. This means these values ​​are beyond the default profile and need to be adjusted. Hence the need for a ‘Tone mapper’ (here, GHS). As a reminder, we do not convert the data to the Target Compression Gamut (TCG), but we compress it in such a way that the critical data is inside the TCG, while remaining in the Working profile.

  • Generalized Hyperbolic Stretch (GHS) - (Selective Editing Tab) - Ok it’s not ‘…X’, neither ‘Log encoding’ or ‘Sigmoid’, or … But it works very well, especially with the three types of histograms I presented. Its objectives are: a) to position the black points and white points at the limits of the Working Profile (in linear mode); b) to pre-process the image so that the shadows, midtones, and highlights can then be managed by simple algorithms. Of course, it’s possible to have a very good image at the end of GHS, but that’s not the ultimate goal. Of course, I could have done this with other tone mapper, but GHS allows for very fine control of the asymptotes towards the highlights. It doesn’t rely on middle grey, nor on the concepts of contrast or pivot point, but on those of :

  • Symmetry point (SP) : peak of the histogram in linear mode.

  • Use of linear White point and Black point, which define the actual limits of the system.

  • Stretch factor (D) : Stretches linear data, without discontinuities, with hyperbolic functions that are always asymptotic. A type c) histogram will require high values ​​of (D).

  • Local Intensity (b) : locates the dominant action of Stretch factor (D) between shadows midtones, and lights. A type c) histogram will require high values ​​of (b).

Some recommendations :

  • In ‘Stretch Settings’, choose a ‘Matrix’ preferably ‘None (Neutral)’, AgX (and yes ‘…X’), JzAzBz (XYZ dynamic), Cat16 (XYZ Harmonious). These matrices modify the data before GHS, using an ‘LMS’ transformation (which takes into account our visual perception), and then apply an inverse transformation at the end of GHS. In the case of ‘The Blue Horse’, as in a second step we will examine ‘Film Simulation’, I preferred ‘None (neutral)’, for better comparisons.

  • Enable ‘Auto black point & white point’, and enable ‘Symmetry point (SP)

  • In the case of ‘Blue Horse’ you should arrive at the following settings : Black point (BP linear) = 0.0016, White point (WP linear) = 1 .87 (about). For some images, depending on the ‘Soft proofing’ profile selected, a few small green dots may appear, indicating a possible ‘out of gamut’ in low light. In this case, uncheck the box ‘Auto Black point & White point’ and set BP linear to zero, or with small negatives values. Symmetry point (SP) must be about 0.008.

  • Adjust the Stretch factor (D) and Local Intensity (b).

  • In the case of this image, I set Value (LC) to zero.

  • At the bottom of the right panel, you will see information about the estimated middle grey, the maximum RGB value which must remain below 1, and 3 sigmas which represents the value below which the vast majority of data are located.

  • If these values ​​are too high, you can adjust ‘Protect highlights (HP)’ and ‘Highlight attenuation’, and of course review the values ​​of ‘Stretch factor (D)’ and ‘Local intensity (b)’.

  • Abstract Profile (Color tab) : a) Adjust gamma and slope to achieve the desired result ; b) Enable ‘Contrast Enhancement’ - The default settings should be suitable in most cases.

  • The RGBmax indicator should display a value less than 1. If it doesn’t, either change the previous AP or GHS settings, or adjust ‘Final Gain & Gamut Compression’. You will see the RT process values ​​displayed below the ‘Gain (Ev)’ and ‘Target gamut’ settings. To display the data, at least one of the two settings must not be zero or ‘None’. I recommend setting ‘Target gamut’ to sRGB (the same setting you used for Soft Proofing) and in Gamut Compression (Color Tab).

  • In general, and if you’re not using ‘Color Appearance & Lighting’, you can adjust ‘Gain (Ev).’ However, be careful with the color gamut. In the case of ‘Blue Horse’, green patches will quickly appear. This clearly illustrates the difficulty in processing this seemingly ordinary image.

  • Color Appearance & Lighting (Advanced tab)

  • Now we’ll explore the new ‘Red Green Blue’ tool, which will allow you to finely control each of the 3 RGB channels.

  • First : enable ‘Color Appearance & Lighting’ and choose ‘Complexity = Advanced’. This gives you more choices among the CIECAM variables. Thus, you have : Lightness (J) and Contrast (J), Brightness (Q) and Contrast (Q), Chroma (C), Saturation (s), Colorfullness (M), hue raotation (h) , and 3 tones curves for Lightness, Brightness, and Color.

  • Note the default ‘Scene conditions’ settings which you could change if you know exactly the shooting conditions.

  • Note the default ‘Viewing conditions’ settings which you could change to adapt them to your viewing environment (the room you are in, its ambiance, the ‘Absolute luminance’ estimate, and Surround…).

  • I chose ‘Lightness + Saturation’ and slightly increased the overall saturation and contrast (J)

4 Likes

Second page
‘Red Green Blue’ tool

I copy the tooltip.

‘Red Blue Green’ allows you to either:

  • Correct any color deviations due to either: gamut overshoot following various adjustments in the process, or poor white balance.

  • Achieve a better balance of colors and luminances to satisfy your preferences.

  • Film Simulation.

The system operates after the first process (Scene) which converts the ‘Working profile’ data into that of ‘CAM16’. At this stage, the J, Q, C, s, M, h data take into account the physiological aspects considered by CIECAM, and a chromatic adaptation is performed.
For each main color of CIECAM ac-bc [chroma based] hue plane - Red, Green, Blue - you can perform a slight hue (h) rotation in degrees (sliders) , adjust the saturation (s) as a percentage (sliders) , and adjust brightness (Q) (curves).

As a general rule, small adjustments are sufficient: 1° to 3° for hue rotations (h), 5 to 10% more or less for saturation (s), very limited variations in brightness (Q). Of course, if you are looking for special effects, such as simulating a film, the settings can be more pronounced.

These adjustments are made just before the other CIECAM adjustments: Lightness (J), Brightness (Q), Chroma (C), Saturation (s), Colorfullness (M), hue (h), contrast (J), contrast (Q) and curves and are added to them.

Next, the third process converts the data from the ‘CAM16’ color space to the ‘Working profile’, taking into account the Viewing conditions. Color adaptation is then performed.

These hue, saturation and brightness adjustments do not use primaries. They are based on the principle of CAM (Color Appearance Models) in 3 processes.

In the case of the ‘Blue Horse’ I arrived at the settings used in pp3, using ‘Soft proffing’ to control the gamut.

To simplify use, I’ve only included one slider per channel for hue rotation, and one slider per channel for Saturation (s). I could have also included a tone equalizer for the red, green, and blue ranges… If that proves useful, aside from complicating the interface, it doesn’t pose any problem. Note that the 3 Brightness curves allow you to adjust the brightness and contrast for each color range. Specifically, brightness acts on the perceived chroma via the (s) Saturation function.

Back to Abstract profile
Check that the data displayed in ‘Final Gain & Gamut Compression’ is within limits, correct it if necessary, but be careful with the gamut

Second treatment (Film Simulation)

The basic processing method is completely similar, but I chose to use, out of nostalgia, an addition with “Kodak Ektachrome 200” film, the one I used around 1980, with the Cibachrome process.

I chose to use the LUT library that has been present in RT for many years. It is very rich in terms of choices and, I think, of quality.

However, it has drawbacks, insofar as one cannot adjust the color gamut, saturation, contrast, or exposure. Some might say, “Yes, but there’s ‘Spectral Film Simulation’.” I don’t dispute the quality achieved, but I don’t feel capable of integrating a product of this type into RT, with the specifications I defined at the beginning of this tutorial (paragraph b)).

It’s worth noting that in 2006 and 2007, 20 years ago, I developed a complex system for my own personal use to create ICC profiles using GretaMacBeth’s ProfileMaker 5.0. These profiles were integrated into Dcraw.

In short, I created a 468-color test pattern, representing almost all printable grays and colors (between Adobe RGB and Rec2020). For each cell, the spectral data from 380 nm to 830 nm, every 5 nm, was entered into an Excel spreadsheet (I was inspired by a document by B. Lindbloom). In this spreadsheet, one could vary the white points, temperatures, working areas, measure the deltaE values, and generate the data needed for the profiler. This data is very comprehensive and comparable to that of recent products. I’ve attached a screenshot of the profile fields, as well as the ICC profile (it will be difficult to use) for those who want to take a look. Of course, other things were needed, such as a powerful image editor, the ability to read and modify colors, etc. This profile contains 3 sets of 3 LUTs, 3 TRCs, etc. In theory, I could take everything, develop ICC profiles, extract the LUTs, and integrate them into the Rawtherapee code. A monumental task… I don’t think, given my age (soon to be 80), that I’d be able to do that. This, combined with the ‘Red Green Blue’ part of Ciecam, would make a complete system. But that’s just wishful thinking.


Kodak25_ScGN.icc (183.4 KB)

Using Film Simulation LUTs

I choose one of the LUTs present in HaldClut, and I moderate its use with Strength.

They are chargeable here, in Rawtherapee.
HaldClut

For the next step, I use the same process, but of course with different parameters in ‘Color Appearance & Lighting’ (Red Green Blue).

pp3 file
2010_MONTR_033.NEF-col2.pp3 (18.8 KB)

An overview

Thank you for reading this entire long tutorial

Of course, the current version in Dev allows all these manipulations. I just merged them.

Jacques

9 Likes

Hello

I just created a Pull Request: “Abstract profile - Contrast enhancement - reduction of gamut artifacts in deep shadows”.

Indeed, in some cases, for images with high dynamic range, artifacts can appear if the output profile is small (this is generally only visible with soft proofing). The local contrast enhancement can be a bit excessive if the shadows (with depth) are very pronounced.

For more information, see the introductory text of the Pull Request.
Pull Request

If you want to ‘see’ the executables, they are as usual in ‘Actions’ (wavcontrast).
Binaries - wavcontrast

I just merge this PR

Jacques

2 Likes