0
\$\begingroup\$

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);
//first
vec3 xyY = RGBtoxyY(rgb);
xyY.z *= Ld;
rgb = xyYtoRGB(xyY);
//second
rgb = (rgb / lum) * Ld;

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

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

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).

| improve this answer | |
\$\endgroup\$

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