New Sigmoid Scene to Display mapping

A guided filter means that the luminance of a pixel is not determined soley by where it falls on the global tone curve, but the average luminosity of surrounding pixels is also taken into account. This helps to preserve the local contrast within certain regions of the image. With tone equaliser, you set up the guided filter mask to help identify these localised regions and treat exposure adjustments to them in a common way. This is real beauty of the tone equaliser module.

4 Likes

It was likely mentioned already but is seems like what a couple of users are asking for would be like the parametric tone curve in RT??

1 Like

Contrast and Chroma

One thing I have been wanting to write about is how sigmoid mapping affects both contrast and chroma. There is an interesting relationship between the sigmoid module in preserve hue mode and the color balance rgb module which can be exploited for some interesting results.

Increasing contrast in the sigmoid module

Here is a set of different contrast settings from an image with low contrast at capture. Notice how the chroma of the image follows along with the increased contrast.

contrast = 1.2 (similar to the original linear picture) contrast = 1.6 contrast = 2.4 contrast = 3.2

This is different compared to the color balance rgb where the contrast parameter only changes the intensity of the color and the chroma slider is orthogonal to the contrast. The “rgb ratio” preservation option in the sigmoid module (or any of the preserve color options in filmic) is on the other hand similar to the color balance rgb contrast option and only changes the intensity of the pixel without adding any chroma changes to the image. This is sometimes what you want and it is also what is used in the Reinhard tone mapper (achievable using the sigmoid module with contrast = 1, skew = 0, and rgb ratio as color mode). The effect is kind of weird when you try to add contrast to an image in the tone mapping stage:

contrast = 1.2 (rgb ratio) contrast = 1.6 (rgb ratio) contrast = 2.4 (rgb ratio) contrast = 3.2 (rgb ratio)

Noticed how the image seems to desaturate when the contrast is increased? It didn’t from a mathematical standpoint. A good example of that the perceptual effect can be quite different from the mathematical intention. I think this might be one of the reasons why some users have struggled with the filmic module and why the middle tones saturation slider was added to that module. Many simply experienced that filmic desaturated their image in the same way as the slide deck above. I guess this effect has a name after some old dude that I just haven’t found out about just yet, if you know the name please share it!

Saturation from contrast!

Back to the preserve hue option which changes both intensity and chroma with increased contrast. This behavior can actually be exploited when combined with the orthogonal settings of the color balance rgb module. First reducing contrast and then increasing contrast actually leads to an overall increase in saturation!

sigmoid contrast = 1.6, color balance, vibrance = +35, linear chroma = +35 sigmoid contrast = 2.6, color balance, contrast = -35

Isn’t that interesting? They are almost identical but the processing path is totally opposite!
Why? Well, the sigmoid color change for the “preserve hue” mode can be explained as an exposure + linear chroma change. I.e. first a common factor for the rgb triplet and then a linear chroma scaling as in the color balance rgb module. The amount of chroma change is however not uniform but is instead a function of the original pixel intensity and chroma. This input-dependent amount has two very nice properties, it is smooth, and it approaches the gamut limit but always stays inside of it. Colors with high chroma are thus not changed as much as colors with low chroma, a bit like the vibrance slider in color balance rgb! This is also why colors desaturate to white as the intensity increases as has been shown in an earlier post. Also, remember that hue is kept constant throughout this operation in the same way as for “rgb ratio” and in the filmic module.

The same method can be used on pictures with high dynamic range, not only for low dynamic range pictures like above. Take for example this image from HDRI heaven:

sigmoid contrast = 1.6 (default) sigmoid contrast = 1.2 sigmoid contrast = 1.5, color balance rgb contrast = -20 sigmoid contrast = 1.9, color balance rgb contrast = -40

Compared to using rgb ratio (or filmic with preserve color) and increasing chroma in color balance rgb:

sigmoid contrast = 1.2 (rgb ratio) sigmoid contrast = 1.2 (rgb ratio), color balance, vibrance = +25, linear chrome = +25

So what do I want to say with this post? Increase your image saturation using the " contrast on contrast method"? No, definitely not, it will most certainly bite both you and me in the butt later on. No, I had liked to say these three things:

  1. A chroma increase is necessary when increasing contrast as the image otherwise will look desaturated.
  2. The preserve hue option, gives that for free, with robust properties, in the tone mapping.
  3. The relationship between contrast and chroma usually needs adjustment and that is where the color balance rgb shines the brightest! My current approach when editing using the sigmoid module is to find a sigmoid contrast setting that minimizes the needed work in the color balance rgb module.

All of the above of course also works for the opposite use case. You can decrease the saturation of an image by increasing contrast in color balance rgb and decrease the contrast in the sigmoid module. But again, probably not advisable as the main method of working with color in your image.

Now I’m interested in what you think about these observations!

10 Likes

Deep breath Alright, as interesting as reading this thread has been, on that note, it’s really time for me to dig in and get my hands dirty. Thanks for sending a torpedo into my non-existant free time. :wink:

On a serious note, without having tried it, but spending a lot if time watching the conversation, I wanted to thank you for sharing your project with the community here. Some conversations seem frustrating, but the back and forth has been fascinating to watch unfold.

I also wanted to thank you for being so patient with every type of response, and having such a positive attitude. :slight_smile:

14 Likes

Hi @jandren, thanks for this interesting information. It fills out another white patch on my sigmoid map. Will test it soon :grin:

1 Like

Recently found two really nice Play Raw images that I tried the sigmoid module on. I also rebased the branch to the latest master so I could play around a bit with the new diffusion module. A very interesting module indeed. So far only used it for some sharpening.

First this: [PlayRaw] Mairi Troisieme - #89 by Joan_Rake1

And this: Mountain ash blossoms - #26 by Gotflute

6 Likes

I am one of the people that finds filmic hard to use.
It is a great module with great results, but it does too many things at the same time and if you touch one parameter you may affect many things.
The problem is not the module itself, but my lack of understanding what each parameter does and many of the concepts behind it.

I get good results usually wth default parameters, i like the aspect of midtones a lot, but it tends to compress highlights and darks, making the skies a bit dull. I use color balance to try to expand highlights and dramatize skies, but i have the feel of being fighting against filmic.
I beleive that some compressionmof highlight and darks is inevitable as you use any kind of contrast curve, but traditional gamma curves seemed to be easier to compensate.

So I would like to try the new module. It seems to provide great results too. I am not as concerned about color reproduction as I am to get results that satisfy me and use tools that i feel under control and that i can understand to some extend.

Color (chroma? and mainly hue?) preservation would be a good addition, to get an ‘intuitive’ to use module, ortogonall as you call it or independently adjusting tones and color.

But I am on windows, and using the master compilations that each week are provided here.
But they don’t include this module.

Are there any install version for windows which include this module?

Dropbox - DT-generic_sigmoid.zip - Simplify your life I posted this somewhere on the forum…can’t remember where…take care to run it separately and on backed up files

Also maybe put an image or images here… and ask for input…

3 Likes

Thanks i will try it in paralell with 3.7 master and 3.6 production.

I will upload there some raw with skues that fet a bit dull using filmic, and my way to make them look more dranatic, to see if there is a better way of doing it and better fiomic parameters.
I will try with sigmoid too.

Use the color preset in the new color balance rgb…its meant to replace the midtone bump that was previously set to around 10% in filmic…I think its called add basic color…also to boost a sky just use a blend mode…say a second exposure module blended in multiply or reverse multiply…you may have to use a mask for the sky and tweak opacity but it will be a nice rich increast. You can also add the tone curve module with not alteration and blend in 10% subtract…this is a nice contrast/dehazing effect…also often tweaking an instance of the graduated density module will also nicely pull in the sky…

EDIT the channel mixer and the colorfulness and brightness tabs in the color calibration module can also do wonders for the sky…trying to do these things with filmic is often the root of the problem

2 Likes

I have uploaded an example with the edits I was using to try to expand highlights and make sky a bit more dramatic.

I have to try now to edit it in 3.7 with color balance RGB (I have tested it a couple of times, it seems more simple to use than other new modules, but I have yet to master it) and diffuse to deblur and sharpen image (this is an end user nightmare module, it is very powerfull for the examples provided, but having to use the derivative weights is only something that people who really understand the process can do. I will stick to presets and tweak radio and iterations a bit).

In PS I used blending modes to give contrast or vividness.

One of the main reasons I started using DT was its ability to use blending modes, masks and parametric masks, and give a final result directly from the developer without having to export to tiff and us PS (I hate its interface and it hunger for memory and disk space).
Soon I discovered that with the new scene referred path (and linear mode) most blending mode do not work or do not work as expected.
Will have to relearned how to use them.

I think I mentioned a few things to try on another thread…using the colorfulness and brightness sliders in color calibration can produce some nice contrast and color boosts. You just need to find your recipe and then save it and a few others as presets and you will be good to go…Did you see the video that Boris did on the Kodachrome style…this is a great example. He broke his style down the way you might do it in PS with layers and then it could be applied broadly to many images. You will notice he does not fiddle with filmic. He makes a couple of small tweaks and that is it…it reveals a nice set of module edits and shows how to adjust them for a variety of images… Editing moments with darktable. Episode 39: kodachrome with color balance rgb - YouTube

1 Like

Been a long time since I posted here. Tried to figure out what requirements a module like this needed for darktable but haven’t been successful so far. I especially focused on how to do the rgb-ratio method (filmic’s preserve color option) in a robust way but I have been unsuccessful so far. Note that I wanted to find something better than the filmic implementation as it doesn’t handle all inputs well enough in my eyes.

The white star when doing hue preservation

So, giving this module some attention again I decided to ignore the rgb-ratio method for now and focus on the dynamics of hue preservation instead. You might remember that showed the results of doing a simple hue correction in post 180 (or not then jump back there and read it again). The problem with this method is that it creates a star-like pattern along the primary color axis. Like this:

Compared with no correction:

Note how much the vectorscope changes between the two methods!

A quick explanation of the white star pattern:
First observe that both the primary and secondary axes actually are correct in the non-corrected version, simple per channel operation. That means that these colors are unchanged in the hue corrected method and that white star is the correct behavior! It’s the colors in between that have become darker due to the correction which has lowered the emission value of the middle channel.

We can quite easily correct for the reduced emission value by for example saying that the corrected emission sum should be equal with the uncorrected emission sum (or weighted sum, or the luminance, etc). The result of that looks like this:

Yey the weird star along the primary colors are gone! But… New problems have been introduced :expressionless:

We have a weird “inverted” star along with the secondary colors and our boundary colors aren’t reaching 100% display chroma. The problem with the boundary colors can also be observed in the vectorscope where we get these arches of maximum chroma along the boundary. You will have to take my word that this is true for any exposure setting of this test triangle which means that we will never have fully saturated colors that aren’t on the primary or secondary axes. We solved one problem but introduced two new ones… I’m still debating with myself about possible ways forward here. It’s impossible to both fulfill any luminance criteria and achieve 100% chroma at the boundary so there has to be some sort of tradeoff if it is at all possible to solve.

A third option which I myself am growing fond of is to say that the white star is ok but expose the amount of correction as a user-configurable variable. And just use whatever fits best for that particular picture. A 67% percent correction looks like this for example, and manages to reduce the negative effects of both methods to acceptable levels, not perfect but acceptable:

Another view of the problem

So before we make any big conclusions from the above. Let’s view the same test charts but as circles instead of triangles! The chart is the same as the triangle but in a circle generated using the old (and broken?) HSV method.

For anyone who wants to try it themselves, not that the exposure is a bit different from the triangle. Forgot that I made the triangle with the average plane = 1.0 and did the new one at 0.1845 instead. I have manually picked rec 709 as my input profile so that I can view the entire result.
color_wheel.exr (983.8 KB)

Same order as before, preserve hue:

No correction, i.e. simple per-channel operation

Constant emission sum when correcting hue

And finally 67% preserve hue:

I show these as it’s interesting and it teaches us something, the preserve hue option creates this almost perfect circle for chroma when viewed on an HSV chart. And I know, I know, the HSV method is a garbage “color space” as it is very poor at modeling our actual sensation of colors. This is because it models what a monitor can show not what a human sees. What it does show though is the possible display gamut as a circle by rescaling the chroma of the triangle such that 100% chroma aligns with the rim of the circle.

That is all I have for now on the topic, hope someone learned something. Someone might even be able to pitch in with some ideas on how to proceed on this topic!

8 Likes

Good to hear from you again. Thanks for the pretty pictures.

Positive thought. I am sure someone will when they have the time. :slight_smile:

PS Maybe @hanatos can advise.

… i really like posts of the “5 moths later” type. sounds like you spent some thought on it now :slight_smile:
as for the white lines/ridges. i think these are just your regular mach bands as you’d get from gouraud shading in the 70s:

i guess i’m saying it comes from the linear interpolation on your input and probably means the triangle is not a good test case here.

7 Likes

Yes, the “white star” is from Mach bands that only exist in our perception. For example:

x

Pixels on the diagonal from top-left to bottom-right appear to be too light. But they are not really. The effect is caused by abrupt changes in gradient. The effect can be removed by smoothing the gradients.

2 Likes

Even with more advanced color spaces is necessary to re-introduce some color shifts, this new “mixing hue” slider is really interesting.

Will this module finally be merged in the next release?

Mach bands ~= only first order smoothness I guess because that is the problem here. I might make some graphs on how the data looks that doesn’t get skewed by our visual system.

It won’t be merged for 3.8. The feedback is that it should be integrated in filmic but I have no good idea on how to do it as they won’t work very well together in either the UI or the code. Also missed some discussions on it over at the Github PR during the fall…

Why? Filmic itself is a module, not a category and it has too many tab already.
As a user I vote for a different module, they are different enough

2 Likes

Because typically you would have only one mapping out of scene referred “space”. Such a module is central to the entire pixel pipe for raw images (or other HDR sources that have to be brought into a more narrow dynamic range constraint). From a usability perspective, such either-or alternatives may be IMHO best accomodated in a single module, to make it more difficult to e.g. accidentally use both modules at the same time if they are separated. Also base curve as the third available alternative should be in the same module, IMHO (there may be practical reasons why this is not the case such as default orders for display referred edits).

2 Likes