I implement HDR in my graphics engine (deferred rendering) based on this document: link I save a luminance in a texture (RGBA16F) this way:

const float delta = 1e-6;
vec3 color = texture(texture0, texCoord).xyz;
float luminance = dot(color, vec3(0.2125, 0.7154, 0.0721));
float logLuminance = log(delta + luminance);
fragColor = vec4(logLuminance, logLuminance, 0.0, 0.0); 
// first channel stores max luminance during a minification process

Then I can calculate an average luminance and find a max luminance.

The delta = 1e-6. Is that a good choice ?

Can I calculate "a" (equation 2) dynamically to achieve better results ?


1 Answer 1


First, the 1e-6 delta: this may well be fine, but it depends on the range of HDR luminances present in your scene. If your typical luminances are on the order of magnitude of 1 or higher, then 1e-6 should be fine, but if you have very dark scenes where the typical luminance can get down to 1e-4 or so, then 1e-6 as a delta might be too large.

As for the value a = 0.18 in the Reinhard et al paper, they indeed mention dynamically adjusting it, but it's not very clear how this is done:

For low-key or high-key images we allow the user to map the log average to different values of a. We typically vary a from 0.18 up to 0.36 and 0.72 and vary it down to 0.09, and 0.045.

It sounds to me like it's a user control, where the user is explicitly setting the image to appear brighter or darker (higher or lower a). This would be akin to the brightness setting that many games have, although I think that usually just applies a gamma curve to the post-tonemapping LDR image rather than altering the tonemapping equation. In any case, it's not clear how you would choose this value programmatically if you didn't want to make it a user control.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .