Page 1 of 1

### Ward tone mapping

Posted: Sun Nov 25, 2012 6:28 pm
Hello,

I'm trying to implement a tone mapping operator and as I was searching for a simple algorithm I found "A Contrast-Based Scalefactor for Luminance Display" by Greg Ward published in Graphic Gems IV.

The main idea is that the scale factor equals to:

Code: Select all

``````Lda = Ldmax / 2
sf = (1 / Ldmax) * ( (1.219 + Lda^0.4) / (1.219 + Lwa^0.4) )^2.5
``````
The problem is, when I was looking at various implementations out there I found several different ways how to calculate of Ldmax and Lda. For Ldmax, I found values ranging from 3.5 to 200, and Lda was Ldmax / 2 or Ldmax / 4.

Ward writes that "for a modern CRT display" Ldmax is 100 cd/m^2. However, modern displays can easily reach more than 400 cd/m^2. And I couldn't find how Lda was derived.

Please, does anyone know how to derive these two values? And why? Also, as I basically stumbled upon this particular algorithm, I'm more than open to suggestions for another (simple) operators.

### Re: Ward tone mapping

Posted: Mon Nov 26, 2012 7:58 am
Hi,

IMO, simpler and without any "magic", you can look at the widely adopted Erik Reinhard ("Photographic tone reproduction for digital images", pdf with source code online) tone mapping operator.
My 2 cents...

Matt

### Re: Ward tone mapping

Posted: Mon Nov 26, 2012 8:18 pm
Thanks for the suggestion!

Unfortunately, I have the same problem with the algorithm by Reinhard - each of the implementation I saw is very different.

This seems to be very close to the paper:
https://github.com/krisher/Path-Tracer/ ... eUtil.java

even if I don't understand the scaling of squared maximum luminance:
https://github.com/krisher/Path-Tracer/ ... .java#L174

Then there is Luxrender which has all those "prescale", "postscale" and "burn" not mentioned in the paper. Also, it calculates the squared maximum luminance very differently, as it doesn not even includes the luminance ("invY2"):
http://src.luxrender.net/lux/file/fca1c ... rd.cpp#l66

Do you perhaps know where they got those "pScale", "invY2", "burn", ... from?

### Re: Ward tone mapping

Posted: Tue Nov 27, 2012 7:57 am
Hi,

when I started implementing the Reinhard tone mapping operator, I just read the article source code provided here: http://www.cs.utah.edu/~reinhard/cdrom/
It's clear, simple and directly related to the paper. The only thing left up to the reader is how to compute the maximum image luminance robustly (from what I remember, they take the pixel having the maximum luminance, but if your images are noisy, you may have false candidates).

Cheers,
Matt

### Re: Ward tone mapping

Posted: Tue Nov 27, 2012 9:09 am
in practice (having a rt, interactive etc. renderer) use the avg. luminance from the last frame.
all local tm operators need some kind of "global" luminance values to adjust too. for me the avg.
is the most stable and the workload can be easily distributed over all threads.

mp

### Re: Ward tone mapping

Posted: Tue Nov 27, 2012 2:01 pm
A common practice is to blur the image to avoid having false high and low luminances not only from noise but also from highlights and caustics. In my experience, this works better than trying to do fancy elimination with the luminance histogram.

### Re: Ward tone mapping

Posted: Wed Nov 28, 2012 9:23 am
Yes, but blurring works only if you tone map your image once it is done, not during rendering!

### Re: Ward tone mapping

Posted: Wed Nov 28, 2012 11:52 am
I think I have the equation 4 from Reinhard's paper working, thanks for the pointer.

But I'm still wondering - Luxrender, Sfera, probably Indigo as well, all use a slightly different method originally written for "Violet" tone-mapper by Nick Chapman. I tried to contact him, so far without luck. I'm interested in this method because it seems to give nicer results and also because I cannot find any source on how to arrive to such a method.

So if anyone knows, please let me know where do "pre_scale", "post_scale" and "burn" come from and why is "Y_white" not equal to Lmax^2?

More here:
http://src.luxrender.net/lux/rev/f48943145d29#l3.77

### Re: Ward tone mapping

Posted: Wed Nov 28, 2012 11:30 pm
It is possible to blur the currently rendered image as soon as there are enough samples to be worth it. It saves blur time if the tone map reference render is smaller than the real image.