## Ward tone mapping

Starting easy.
tuomlarsen
Posts: 16
Joined: Mon Oct 29, 2012 6:02 am

### Ward tone mapping

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 / 2sf = (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.

matt
Posts: 13
Joined: Mon Dec 26, 2011 12:02 pm

### Re: Ward tone mapping

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

tuomlarsen
Posts: 16
Joined: Mon Oct 29, 2012 6:02 am

### Re: Ward tone mapping

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/blob/master/src/main/java/edu/rit/krisher/raytracer/image/ImageUtil.java

even if I don't understand the scaling of squared maximum luminance:
https://github.com/krisher/Path-Tracer/blob/master/src/main/java/edu/rit/krisher/raytracer/image/ImageUtil.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/fca1cc05d063/tonemaps/reinhard.cpp#l66

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

matt
Posts: 13
Joined: Mon Dec 26, 2011 12:02 pm

### Re: Ward tone mapping

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

mpeterson
Posts: 56
Joined: Fri Jan 06, 2012 3:09 pm

### Re: Ward tone mapping

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

ypoissant
Posts: 97
Joined: Wed Nov 30, 2011 12:44 pm

### Re: Ward tone mapping

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.

matt
Posts: 13
Joined: Mon Dec 26, 2011 12:02 pm

### Re: Ward tone mapping

Yes, but blurring works only if you tone map your image once it is done, not during rendering!

tuomlarsen
Posts: 16
Joined: Mon Oct 29, 2012 6:02 am

### Re: Ward tone mapping

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

ypoissant
Posts: 97
Joined: Wed Nov 30, 2011 12:44 pm

### Re: Ward tone mapping

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.

Return to “My First...”

### Who is online

Users browsing this forum: No registered users and 1 guest