Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found two ways of doing tone mapping (first, second):

//Ld - this part of the code is the same for both versions
float lum = dot(rgb, vec3(0.2126f, 0.7152f, 0.0722f));
float L = (scale / averageLum) * lum;
float Ld = (L * (1.0 + L / lumwhite2)) / (1.0 + L);
vec3 xyY = RGBtoxyY(rgb);
xyY.z *= Ld;
rgb = xyYtoRGB(xyY);
rgb = (rgb / lum) * Ld;

For an example pixel data above equations produces different results. Which way is correct ?

share|improve this question

closed as not a real question by Nicol Bolas, bummzack, Josh Petrie, Sean Middleditch, Byte56 Apr 8 '13 at 3:47

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

What is being asked here? – Shotgun Ninja Apr 5 '13 at 20:53
Which way looks better, go with that =) – Patrick Hughes Apr 5 '13 at 21:23
Background on what tone mapping is and what your goal is would be helpful. – Tim Holt Apr 5 '13 at 21:34
up vote 6 down vote accepted

With tone mapping, there is no "correct" answer. You're trying to reduce an HDR image to an LDR one that somehow visually represents the luminance range present in the original, which is very subjective. Choosing a tone mapping equation is a matter of aesthetic judgement, not physics.

By the way, if you're interested in tone mapping, I would recommend also looking at the equation presented in John Hable's talk, Uncharted 2 HDR Lighting (slide 140 has the equation I'm talking about).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.