Realtime Photon Based Global Illumination

This is my attempt at Global Illumination using Photons to render the scene. It is far from being perfect, I’m still working on it, but I thought I would share the results I got so far, to get some feedback.

How its done:
I first voxelize the scene in a 256**3 Grid. Then I spawn photons from the light source (currently a DirectionalLight). For the first bounce I use the shadowmap of the light source to determine the point of intersection. The second bounce is computed in a separate render pass (independent of the main render pass), and spawns 32 Photons for each initial Photon. The third bounce follows directly after the second bounce (and works similar). While the photons are traced through the scene, they emit light (stored in a separate photon grid). In the next step, this separate photon grid is blurred with an edge preserving 3D blur (so it does not look too blurry, but not too noisy, too). In the final step, this photon grid is sampled in the main render pass and added to the ambient term.

About 1-15 ms per Frame depending on the number of photons spawned (More Photons = Better Quality). I’m working on this tho.

I still have to improve the performance, so it can be used in a game without a major performance impact. I also have to see if I can manage to spawn more photons to achieve a better result.

Source Code:

Current Result: (Full size)

1 Like

Impressive! But really one of my main concern now with this is performance wise when using it in full applications or games with a lot of objects. This is why I have suggested before that if you have ever considered mixing this with baking GI lightmaps to static models and realtime on dynamic objects.

It is nice with small demo though being far from perfect as you mentioned, and I hope your dynamic optimization will be good enough when it gets done. :slight_smile:

The github link leads to a 404.

Has this been merged to master?