Photon Mapping differences between two images

Hi everyone,

I have simulated twice an scene with photon mapping with the following code:

mkpmap -apg ./PM/Global.gpm 50k -apc ./PM/Caustic.cpm 50k -apo Puerto -t 5 02-EscenaPM.oct

rpict -i -ap ./PM/Global.gpm 75 -ap ./PM/Caustic.cpm 75 -vf 03-View.vf -x 2048 -y 2048 02-Escena.oct > ./Render.hdr

However, the results are similar but not exactly the same. I have checked that all the parameters are the same in both cases and these are the falsecolor images obtained:

I have read that photon mapping uses the MonteCarlo method, so I suppose that these differences may be because some randomness in the process. Is that right or could it be other factors that cause these differences?

Thank you in advance,

Hi Irene,

photon mapping is of course Monte-Carlo based, so like RADIANCE itself, there is a degree of intrinsic randomness. However, photon mapping maintains a state table to generate separate random number sequences (via erand48() where available) for disparate events to ensure the same sequences are generated in consecutive runs. So the same photon maps should be obtained with identical input. Infact, mkmap accepts an -apr option to explicitly seed the random number generator to avoid generating identical photon maps.

However, I just checked my working version and this is indeed no longer the case, so I suspect I made some changes along the way that apparently broke the RNG state. I’ll have to look deeper into the code where this occurred. It’s been a long time since I’ve messed with that stuff.

Btw, that’s a pretty trippy rendering you’ve got there. :wink: However, different random sequences should not cause the caustic highlight to shift; it would appear to me that the solar angles differ slightly. But not knowing the geometry, I can’t really tell.


Hi Roland,

I did a loop with the same geometry and parameters to repeat the same render five times with photon mapping and I got five different results. Later I repeated the process without photon mapping and I got five results that were the same as each other, so I concluded that there has to be a problem with the photon mapping code.

Thank you anyways for your answer and I hope that you can fix easily this problem.