So, now that we have a Photon Mapper we are ready to begin with the actual ISPM algorithm – the GPU accellerated version of what we have just done on the CPU. But, how does it work?
Firstly, what ISPM does is that it takes two parts of the Photon Mapping algorithm to the GPU: the initial bounces and the final gathering. The initial bounces are stored in a bounce map which is then used to continue the scattering on the CPU while the GPU does all the regular stuff it needs to do anyway such as rendering direct lightning, textures etc. Lastly, the GPU has an additional pass which deals with the final gathering of photons to do the irradiance estimate.
The most challenging parts will probably be (1) the fact that the algorithm has a lot of back-and-forth between the CPU and GPU, utilizing both fully, and (2) to represent BSDFs and calculate scattering events on the GPU. The photon maps will not be KD-Trees on the GPU, but rather just arrays of photons, which will make things a bit easier.