SPPM luminance bug

Project:YafaRay
Component:YafaRay Core
Category:bug report
Priority:normal
Assigned:David Bluecame
Status:ready to commit
Description

Hi there

While doing tests about SPPM for another bug report, I have found this bug. After a certain number of passes are done with SPPM, the luminance of the image experiences a sudden shift and and the image becames overexposed. The number of photons to shoot for each pass is a factor, with 5 million photons the shift happens in pass 860 and with 2,5 M photons the shift happens in pass 1720 so it is consistent, once an amount of cumulative photons in the map is reached, something goes wrong. I have attached the scene. Tested in Windows 64bits builds of YafaRay 3.0.2. Grettings.

PD: IRE is disabled in the scene.

AttachmentSize
YCS2012-Ditte scene Demo 05a.zip1.39 MB

Comments

#1

Confirmed also on Linux 64 bits builds of YafaRay.

#3

Assigned to:Anonymous» David Bluecame
Status:active» ready to commit

Hello,

Thanks for reporting this. I could replicate the problem with a simple scene (see attached) that reaches that situation in a reasonable amount of time. The example shoots 100 million photons per pass, and around pass 44 you can see the brightness sudden change.

As you already hinted in your issue description, I found the problem in the counter that counts the total accumulated photons. That counter uses an unsigned 32bit integer that overflows when it reaches around 4,300 million causing this problem.

I've changed that counter to an unsigned 64bit integer and the problem seems to be solved. The change is in this commit: https://github.com/YafaRay/Core/commit/2d42a53477111ab6d553ba56544f26c48...

This bug has been there a very long time, but it was probably undetected as before version 3 the photon shooting was single-threaded and it was much more difficult to reach 4,300 million photons. Now in v3 with the multi-threaded photon generation, it's much more likely that number can be achieved so this bug would happen more often.

In any case, this bug will be fixed in the next YafaRay version.

AttachmentSize
sppm_photons_issue.blend.zip 70.17 KB