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 ?