# Reinhard tone mapping and color space [closed]

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 ?

• 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