Hey Guys Could you be so kind and explain to me the last part of this formula taken from the Luxcore code.
src\slg\film\imagepipeline\plugins\tonemaps\luxlinear.cpp:
This code in my opinion is a little bit nasty. I add a gamma plugin into the image pipeline and Luxlinear plugin, in a hidden way, takes my gamma and changes the luminance of the render. That behavior in my opinion is wrong. I suspect Luxcore will do what he promised to do, so change the gamma not the luminance of the image. If I remove gamma plugin, render the image then use Gimp oiiotool or some other software to change the gamma I receive a different result because all software do only what they promised to do so change gamma not the luminance.
I could trace the this value (118 / 255) back to mentions of the norm ISO12232. Apparently the exposure of an 18% gray card shall lead to sRGB values of 118 after apoplying gamma 2.2, where (118/255)^2.2 approximately equals 0.18.
I did a test with Blenders default cube scene, rendered within Blender and exporting using the filesaver and then using luxcore standalone.
This also gives me an external reference, because for rendering with Blender, BlendLuxCore only exports gamma=1 to LuxCore and any additional color management is applied by Blenders internal mechanisms as a postprocessing.
Now, rendering in Blender, I get the same result between tonemappers LINEAR and LUXLINEAR. (exposure settings entered accordingly) I.e., when gamma=1 is exported, the bahaviour is the same. Gamma 2.2 is applied by Blender in post so as expected the result is identical.
Then, using the filesaver and rendering standalone, I get a different result. TONEMAP_LINEAR again produces an identical-looking result, but confirming your suspicions, TONEMAP_LUXLINEAR looks darker. It appears to be by a factor of (118/255)^(1/2.2), approx. a factor of 0.7, though I do not understand why the inverse of 2.2, may be a minor error of thought on my side.
I suspect this is what you mean by changed luminance?
I would say ad-hoc that the factor in "LuxLinearToneMap::GetScale()" is indeed unnecessary, because achieving this midpoint value will be a consequence of gamma and does not need to be considered explicitly as a sclaing factor. I will see if I can find a downloadable 12232 pdf to cross-check.