Monday, January 3, 2011

Global illumination II

The previous post about Global Illumination demonstrated a modification of real-time screen space ambient occlusion (SSDO) algorithm. This is a good post-processing effect for modern and powerful hardware. We use this approach in the new version of Heaven benchmark, which will be released soon. But low-level hardware still requires lightmaps...

I have improved lightmap rendering in Unigine by using directional lightmaps. They can be easily calculated by the engine render pipeline (simple ray tracing). Unfortunately the result of directional lightmaps without environment or indirect lighting looks ugly. So I created a tool for indirect lighting calculation. Our approach is very simple: we use built-in LightProb (light source based on spherical harmonics) facilities to grab environment lighting:
* we generate a heap of LightProb objects all across the scene
* each LightProb grabs nearby lighting info
* indirect component from LightProbs is combined with direct one from ray tracing into the lightmap textures

Performance of such global illumination solver is awesome. Calculation time for the shown scene (based on the old "Site" Unigine demo) is only 2-3 minutes on dual core PC. GPU power is also utilised during LightProb generation.

Dynamic forward lights:


Backed lightmaps with direct term:


Backed lightmaps with direct and indirect terms:


Backed lightmaps with indirect term: