1

I'm reading the paper by Erik Reinhard et al. called "Photographic Tone Reproduction for Digital Images", it's also here:

http://www.cs.utah.edu/~reinhard/cdrom/

There is this equation #4:

Ld(x,y) = L(x,y)(1 + L(x,y)/L_white^2) / (1 + L(x,y))

"[If] L_white value is set to the maximum luminance in the scene L_max..."

There is also a source code by the authors and various implementations online.

My question is, there is one variant of the formula above which I cannot understand how and what it was derived from. Take a look for instance at Luxrender source code:

http://src.luxrender.net/lux/rev/f48943145d29#l3.77

scale[i] = ( post_scale * (1.0f + lum*recip_Y_white2) / (1.0f + lum) ); //* maxDisplayY;

There are new variables "pre_scale", "post_scale" and "burn" which the paper does not mention. They also compute L_white (= Y_white) very differently:

const float Y_white = pre_scale * alpha * burn;

Please, can anyone explain to me how to derive such algorithm? I assume it's based on the paper but I don't see how...

eh9
  • 7,340
  • 20
  • 43
Tuom L.
  • 182
  • 3
  • 12

1 Answers1

1

In that paper, equation (4) is in the section "3.1 Initial luminance mapping". It's not the final transform. Section "3.2 Automatic dodging-and-burning" is the origin of the burn variable; it will be > 1 for burning and < 1 for dodging. Not having read the code, I'd assume that pre_scale and post_scale and conversion of their internal arbitrary luminance values to an actual color space.

eh9
  • 7,340
  • 20
  • 43
  • I' sorry but where do you see that `burn` and `>1`? 3.2 discusses "circularly symmetric Gaussian profiles" and Fourier domain. But the code in Luxrender is much more simple. And the accompanying code by Reinhard also contains `image[y][x][0] = image[y][x][0] * (1. + (image[y][x][0] / Lmax2)) / (1. + image[y][x][0]);` which is still different from Luxrender's code. – Tuom L. Nov 29 '12 at 17:13
  • If you don't understand what burn and dodge mean in a darkroom context, I'm not surprised these don't make sense to you. Burning means increasing luminance; dodging means decreasing it. – eh9 Nov 29 '12 at 18:56
  • Thanks for clarification. But how does it explain `Y_white = pre_scale * alpha * burn`, instead of `L_white = L_max`? – Tuom L. Nov 29 '12 at 20:50
  • The whole paper is about how to reduce the dynamic range of luminance. Simply cutting off things at the maximum isn't going to do a good job of that. – eh9 Nov 29 '12 at 23:20