[quote name='MegaPixel' timestamp='1348574474' post='4983535']
So that means that I can post multiply the RGB color with the adjusted luminance before to run it through the filmic curve or after ?
It is the question of what you want to archieve.
If you just want to fake the human eye (adjusting to the darkness), then it would be worth an attempt. According to the filmic tonemapper function here, I would just alter the ExposureBias according to the average luminance. It is more like playing around with the mapper until it looks good vs. a physical correct solution.
[/quote]
so that means that I should use
float relativeLuminance = (fragmentLuminance / (averageSceneLuminance+0.0001f))*key;
to modulate the color without run it into the Reinhard tonemapper:
float tonemappedLuminance = (relativeLuminance*(1.f+(relativeLuminance/(Lw*Lw)))) / (1.f+relativeLuminance);).
so for the filmic curve should be:
finalColor *= relativeLuminance;
finalColor = max(0.f,finalColor-0.004f);
float4 gammaColor = (finalColor*(6.2f*finalColor+0.5f))/(finalColor*(6.2f*finalColor+1.7f)+0.06f);
//out the color applying gamma correction
return gammaColor+pow(bloomColor,1.f/2.2f);
(no CIE to RGB needed in this case as the filmic curves works in RGB space straight away)