I have bisected the darkening effect, it comes from the revision where I replaced the custom accumulator of sppm by the film interface. So perhaps I have missed something.
The old interface was storing an XYZColor inside the hitpoint (called accum). Each time a photon fell on an hitpoint, its flux was added to accum. This may happen many time per photon (if there is many hitpoint in the neighboorhood and if the photon do many bounces). This value is then copied to the film buffer by Film::SetSample normalized by dividing by totalNumberOfPhoton.
Now, in the new interface, each time a photon falls on an hitpoint, its flux is added to the sample by AddContribution. At the end of the photon path, we call sample.AddSample()
So in theory, the pixel inside the film contains the sum of every photon contribution on the hitpoint associated to the pixel (in fact, the pixel filter is taken into account here)
So the film must, for each pixel, return the value stored / the number of photon shooted. Which is equal to the number of time AddSample method had been called, which is stored in Buffer::_numberOfSamples. It is what I had implemented in the PerScreenNormalizedBufferScaled.
Where did I miss something ?
