Original Post
Hi! I'm trying to implement Reinhard's tone mapping operator, but I get strange results and I'm not really sure how it should look like: - normally you calculate average luminance of the scene (world luminance - Lw) - then you map to the middle-grey zone: L(x,y) = key/Lw * pixelLuminance(x,y) - then you scale all pixel luminances to range 0-1: Lscaled(x,y)=L(x,y)/(L(x,y) + 1) This way you obtain scaled luminance of the pixel. And now what? I tried just to multiply pixel color by this value, but I get strange results (bright pixels get clamped to 0 very quickly, dark are very dark until *really* high key is set).
In Goodnight et al. "Interactive Time-Dependent Tone Mapping Using Programmable Graphics Hardware" they use something different: color.rgb = pow((color.rgb/luminance), alfa) * Lscaled, where alfa is in range 0.4-0.8 and luminance is pixel luminance. Results are quite good:
In HDRFormats demo the pixel lumianance is not used at all, only the color is used: color.rgb = key / Lw * color.rgb; color.rgb = color.rgb + / (1.0f + color.rgb); and results are also good (that's not fair [smile]).
In Reinhard's own source code (C), he uses some strange RGB->XYZ and XYZ->RGB color space conversion (one of these XYZ values is luminance, I don't know what other 2 are), but I can't figure out what he's doing exactly.
I even tried to divide scaled lumiance of the pixel by non-scaled pixel luminance before multiplying it with the pixel color and the result where more similar to Reinhard's:
All images were taken using exactly same values of average luminance, key and white point (measured by Reinhard's program, so scaling luminance on GPU doesn't have any impact on them). I don't understand from Reinhard's code how he's doing color space conversions, so I can't figure out how he's changing lumianance to RGB values. Is there a correct way to do it? When I was trying to implement Reinhard's operator I hoped to obtain similar results, but it's not so easy [smile] BTW. Does anyone know if the Goodnight's GPU implementation of Reinhard's "dodging and burning" tone mapping operator is available somewhere? [EDIT] I've found RGB -> XYZ conversion explained: http://en.wikipedia.org/wiki/CIE_1931_color_space (however values used in Reinhard's code are different). But is this conversion really necessary? If I have scaled pixel luminance and its RGB color, what is the correct (or simple, but giving accurate results) way to obtain new RGB values? Right now I'll probably use Goodnight's method as it gives good results. [Edited by - g0nzo on August 3, 2006 4:26:14 AM]
In Goodnight et al. "Interactive Time-Dependent Tone Mapping Using Programmable Graphics Hardware" they use something different: color.rgb = pow((color.rgb/luminance), alfa) * Lscaled, where alfa is in range 0.4-0.8 and luminance is pixel luminance. Results are quite good:
In HDRFormats demo the pixel lumianance is not used at all, only the color is used: color.rgb = key / Lw * color.rgb; color.rgb = color.rgb + / (1.0f + color.rgb); and results are also good (that's not fair [smile]).
In Reinhard's own source code (C), he uses some strange RGB->XYZ and XYZ->RGB color space conversion (one of these XYZ values is luminance, I don't know what other 2 are), but I can't figure out what he's doing exactly.
I even tried to divide scaled lumiance of the pixel by non-scaled pixel luminance before multiplying it with the pixel color and the result where more similar to Reinhard's:
All images were taken using exactly same values of average luminance, key and white point (measured by Reinhard's program, so scaling luminance on GPU doesn't have any impact on them). I don't understand from Reinhard's code how he's doing color space conversions, so I can't figure out how he's changing lumianance to RGB values. Is there a correct way to do it? When I was trying to implement Reinhard's operator I hoped to obtain similar results, but it's not so easy [smile] BTW. Does anyone know if the Goodnight's GPU implementation of Reinhard's "dodging and burning" tone mapping operator is available somewhere? [EDIT] I've found RGB -> XYZ conversion explained: http://en.wikipedia.org/wiki/CIE_1931_color_space (however values used in Reinhard's code are different). But is this conversion really necessary? If I have scaled pixel luminance and its RGB color, what is the correct (or simple, but giving accurate results) way to obtain new RGB values? Right now I'll probably use Goodnight's method as it gives good results. [Edited by - g0nzo on August 3, 2006 4:26:14 AM]
