Who is familiar with Log Tone Mapping in ART? (Solved)

For the first time, I achieved a better result with with Log Tone Mapping than with the fantastic Tone Equalizer.

Here are my attempts at settings:
B.dng (16.6 MB)
Only Target gray point +40 and Gain -1.98
LTM Target gray point.jpg.out.arp (11.3 KB)
Only Whithe relativ exposure +6.00 and Black relative -7.00
LTM White relativ.jpg.out.arp (11.3 KB)
Only Tone Equalizer …
Tone Equalizer.jpg.out.arp (11.3 KB)

My questions:
Is this motif even suitable for log tone mapping?
Does anyone have good experience with log tone mapping?
What could be done better?
Better means: Balancing out the darkness and contrast well, as in these examples, while still achieving good brilliance in the details.
Of course, I know that even more than here will make the image very unnatural.
My main concern is this mysterious tool: Learning to understand Log Tone Mapping.

Micha

@micha there is a section in RawPedia authored by @jdc that discusses some of the options for dealing with high dynamic range images. https://rawpedia.rawtherapee.com/Local_Adjustments#HDR_to_SDR:_A_First_Approach_(Log_Encoding_-_CAM16_-_JzCzHz_-_Sigmoid)

It includes a worked example using Log Encoding (which is based on the ART implementation) and may be of some help. Although this section deals with Local Adjustments , the principles are just as valid for whole-image edits.

1 Like

You can for sure use it with this image… It really depends how hard you push and where you want to end up with it… I went a bit brighter than you. I did it quickly on a break on a PC with no calibration so it might be awful… :slight_smile:


B.jpg.out.arp (12.0 KB)

2 Likes

Hello @priort,
It’s amazing what you’ve done there.
It looks so effortless, as if the scene was something like this. Also amazing, the colors you brought out.

For the time being, this topic is only about this tool: Log Tone Mapping. You have used it even more intensively than I have.
It would be interesting for me to know why you did what and how, just with this Log Tone Mapping tool.
You moved 5 of the 6 sliders significantly. Are you just doing it by feel or are you pursuing a certain intention that the image requires?
Could you write a little more about this?
The beautiful colors you’ve conjured up are a topic in their own right, we could talk about that separately.

I’d be glad to reply. I am on my phone walking home so I don’t have access to the edit at the moment… Basically I have way more experience with DT and therefore of course filmic. But the same approach holds. First you pick the part of your image that you want well exposed and raise it to that. This is going to become the sort of middle gray region mapped to that on your monitor. Then you have to map the highlight and shadows. Depending on the EV you assign +/- 0 with zero being the middle gray point you have established they will be more or less contrasting. So small EV big contrast and large EV is a much more smooth roll off and so less contrasted. The module was pushed hard to raise the exposure so if I recall I move the bottom slider all the way to retain local contrast… So basically brighten then map shadow and highlight contrast and then color adjustments. Basically the take home here imo which ain’t worth much is that if you have a high DNR image and you simply assign 0 to black 100 to white and let grey be calculated as it is at 18% You could have a very dark or unbalanced image. If on the other hand you set the image such that gray is as bright or dark as you need it to be then there is far less compromise. You simply use the tonemapper to manage the values on either side of this anchor point that you have determined and not a display transformed value between min and max…

2 Likes

Hello priort,
Great, you obviously know your way around this or the comparable tool at dt.
You describe wonderfully and clearly what needs to be done. Even if I don’t understand everything yet, it sounds totally logical.
I would benefit a lot more from your thoughts and really learn if I could understand more precisely which sliders you use to do what.
You write: First you pick the part of your image that you want well exposed and raise it to that. What do you do that with? With the Gain (Ev) or with the Target gray point? That’s important for me to understand. That sounds really logical and totally understandable: Determining the gray value of the image correctly, that reminds me of dt. Only: with what?
I think once I’ve understood that, I’ll be a big step further.

Get home safely now and then we’ll continue.
This topic is about to massively improve my understanding of log tone mapping.
I am very happy.

Micha

Hello Wayne_Sutton,
I think this is a good text for people who understand that. When I start reading it, the content blurs before my eyes because I don’t understand anything. I just hope that I will still learn to understand this tool. I’m prepared to work hard and chew hard and won’t give up if it seems too difficult today. I need more time and lots and lots of practice.

I will see if I can help. I am out baby sitting tonight … 6 year old granddaughter at a trampoline palace BD party… If I had a 10th heck 1000th of that energy… I will play with a few images since I don’t want to steer you wrong. As I said I am much more familiar with the nuances of filmic…similar tool…

1 Like

@micha
Trying to simplify is a difficult task. Explaining complex things simply is difficult. The notions of HDR and its counterpart SDR are complex and involve notions not used in everyday life.
Of course if I can contribute to understanding I am at your disposal.

To see another way of doing things than that of ART and that of DT (which are both remarkable) you can try on these subjects the "lacam16n’ branch, the PR currently under development.

In summary, I removed certain parts from the “Cam16” loop that were working very poorly.

  • Log encoding
  • Tone Response Curve and Midtones
  • Primaries and Illuminant, with CIExy diagram : you can choose predifine primaries, illuminant or manually change , gamut control, Refine colors (purity), etc.

https://github.com/Beep6581/RawTherapee/pull/6861

Executables
https://github.com/Beep6581/RawTherapee/releases/tag/pre-dev-github-actions

jacques

2 Likes

Hello @jdc,
of course you can contribute to my understanding, I would be delighted.

I have a few questions right away:

  1. what is "lacam16n’ branch, are you developing it?

  2. is this RT-lacam16n already suitable for use or still very young in development? I like that it seems to be a very good mix of RT and ART.

  3. the most important question for now is, when do you use this “Log Tone Mapping” or a variant of it? I’m not really interested in HDR images. But sometimes you have large contrasts between inside and outside when taking a picture, i.e. enormous differences in brightness. Is LTM good for this? So far I can do everything with the Tone Equalizer from ART or the options offered by RT. Maybe I’m just getting carried away with LTM and don’t need it at all.
    In short: When do I use LTM, what can it do better than the other tools?

@micha
Excuse my bad English, I am an old french man :wink:

  1. When doing development, it is often useful to make adjustments elsewhere than in the main code. For this case, here, the development of “Cam16 - Local adjustment”, I created a branch in the Github environment, which I called “lacam16n”. This allows other developers or users compiling to know where the code is located.

  2. This branch is accessible and usable without problem. Most of the principle and code is not (unless I’m wrong) used in ART. It’s Ciecam16 (Color Appearance).
    But I’m not saying it’s easy. For information, the concepts are significantly similar to those recently included in DT, but which have been in RT since 2012 (Scene, Display…)

  3. Difficult to give a good answer, but yes in general the conditions you describe are those where we can use “Log encoding”.
    But it is not the only solution. Often, and it is a question of learning, a user favors a tool, because he knows it. I think there is no right answer, but the right one is the one you master.
    For information:
    https://rawpedia.rawtherapee.com/Local_Adjustments#Five_ways_to_change_the_exposure_and_lift_the_shadows

jacques

1 Like

Ok, I’ll try to illustrate what the tool does in a simple, visual way.
For simplicity, I will not consider highlights precompression, regularization, and saturation control. These are just additional controls to fine-tune the tone mapper which do not change its fundamental behaviour.

For this, I will use a synthetic image, consisting of different bands of grey of different brightness. More, specifically, the image is in linear Rec.2020 color space, and the grey bands are exactly 1 Ev apart (meaning, that to get from band “i” to band “i+1”, when counting from the top, you simply multiply by 2 the value of the pixels). Here is the image:
mid.tif (3.4 MB)
There are 20 bands in the image, and the central one (the 11th) correspond to the “standard” mid gray with a value of 0.18.

Essentially, what the log tone mapping tool does is to remap the values of the image so that the following hold:

  • the selected “white relative exposure” (i.e. the value that is obtained by applying an exposure compensation of the given Ev stops to the middle grey value of 0.18), is remapped to 1
  • the selected “black relative exposure”, corresponding to the user-selected number of Ev stops below middle grey, is remapped to 0
  • the input middle grey, obtained by applying the selected “gain” to the standard mid gray of 0.18, is remapped to the “target grey point” value.

In its default configuration, this is essentially an identity operation, because:

  • the default “black relative exposure” is -13.5, and 0.18 * 2^{-13.5} \approx 0
  • the default “white relative exposure” is 2.5, and 0.18 * 2^{2.5} \approx 1
  • the default target grey is already 0.18, and the default gain is 0, so both the source and the target grey are already 0.18.

If you move the sliders, the following will happen:

  • increasing the “white relative exposure” will shift the white point, causing a higher compression of the highlights, leaving the mid gray unchanged;
  • changing the gain will move the source gray point, and as already discussed is equivalent to apply an exposure compensation to the input;
  • changing the target gray point will affect the brightness of the midtones, leaving the white and black points unchanged.

I made a video that tries to illustrate all of the above. Hope this helps.

6 Likes

Hello Micha,

I hope that Alberto’s explication of this tool will help you to better understand the mysterious part of it.

On the other hand, my opinion is that this log tone mapper isn’t the easiest tool to master. The Auto button often changes nearly nothing, exposure wise, and never gives satisfying results. Apparently this is not an auto-exposure thing, but something else…

I usually correct the exposure of my photos with the Tone Equalizer plus the contrast slider in Tone Curves, and if needed with some exposure compensation in the Exposure tool. Or I use the tools in the fourth tab, Local Editing, to do all.

That said, I exposed your photo by hand with Log Tone Mapping only - except for a slight increase of contrast with the Tone Curve tool.

B.jpg.out.arp (11.0 KB)

1 Like

Hallo @paulmatth,
Yes, I normally do exactly the same as you:

But here I would really like to get to know this “Log Tone Mapping”.
Your example is excellent, because you use it exclusively here, plus just a little “contrast”.

The main sliders here seem to be Target gray point and Gain. The others are presumably used to compensate for their unbalanced effect.

Your image example is very good to show the effect of the tool, even if too much of a good thing has already been done here, so that the cloudy evening mood is lost, but this is excellent for learning.

Unfortunately, you can no longer see the history in the saved .arp file. But, perhaps you could do the same thing again with several snapshots showing each stage of your settings. If it wouldn’t be too much extra work for you. Or you could simply describe with a few lines what you start with, how you recognize that the value found is sufficient and what you then continue with.
I think I will also benefit greatly from this, and so will everyone else who reads this.
So, thank you for this and thank you in advance for what’s to come, if you feel like it.
Micha

PS:
How can you understand that? The contrast is reduced with “Log Tone Mapping” and increased again with “contrast” in Tone Curves. The results are excellent. But isn’t that contradictory? I suspect that contrast is not the same as contrast. What is the difference?

Attached is the arp file with some snapshots. I have no “plan” when using the log tone mapper, I just change sliders, starting with the upper one, then the second one, etc. Then I re-adjust the sliders until something comes out that is reasonable.

B.dng.arp (79.8 KB)

1 Like

Hello Alberto,
are you kidding? … in a simple way?

Yes, there’s probably no easier way to explain why and how Log Tone Mapper works in just a few minutes.
I see the great effort you have made, but for me the numbers are and remain an unsolved mystery:

“black relative exposure” is -13.5, and 0.18 * 2^{-13.5} \approx 00.18∗2−13.5≈0 …

I fear, or hope, that I am not the only one who finds this far too mathematical.

But you didn’t do all this for nothing. I think I have a good understanding, especially because of the video, of what shifting the gray point and the white point means.
What an interesting graphic mid.tif is: It normally contains a lot of white, and with ART (also with Gimp), you can change the tonal values so that the white is gradually drawn again.

I have translated your text into German and copied it into my private ART-manual. I will read it more often and make sure that I understand more bit by bit.

Alberto, you have already made a short video about LTM, albeit in an older version of ART.

1st request: Could you make a video of the development with LTM with a suitable picture?The whole world of ART will certainly thank you.

2nd request: Could you describe in more detail which images give LTM an advantage over other tools such as Tone Equalizer? Or can you achieve the same results with Tone Equalizer as with LTM?

2 Likes

Unfortunately, the snapshots are not displayed for me. Do I have to do anything special?
Are mine displayed on your computer?
B.dng.arp (151.8 KB)

I’m probably only going to expose my shortcomings :slight_smile: but this is a non-technical summary of how I interpreted @agriggio’s explanation:

  • The lightest linear / unbounded value is mapped to bounded (display) white, or 1
  • The darkest linear / unbounded value is mapped to bounded (display) black, or 0
  • The “balance” of the grey (gradient) slope between these two values is determined by where the Target gray point slider is positioned.

I.e., using the two equations he provided, the brightest and darkest points are mapped to (display) white and black, with the center grey point being relatively set by the Target gray point slider. He’s basically remapping white and black relative to the Target gray point slider value.

Now, someone can correct me. :smiley:

1 Like

Now this is funny.

2 Likes

I think one thing right off the bat you could use is the jpg. If its still got deep shadows, bright sky etc then you know it has been tone mapped and processed and still it has DNR issues… Then to use the raw and to manage that and produce a better result your likely going to benefit from the Log tone mapper…

I think also when you look at the Tone eq map … it does appear that the “zones” are nicely feathered generally and I don’t exactly know how they are determined however if you hunt and peck with sliders in the tone eq you might sort of break the image tonality where as the tone mapping (with filmic or this sort of module) is a global edit with smooth gradients and can be used to capture (compress) the dynamic range and set you up for further processing… some of which might be the tone eq to fine tune things…