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:


  1. How are you generating SH light probes? By rendering nearby forward-lit geo into cubemaps and then calculating SH from that?

  2. Yep, environment geometry and lights are rendered into the cubemap texture from the specified position and then texture converts into the set of SH coefficients.

  3. interesting...

    can i ask
    how exactly lightprobes are sampled?
    and how many of them are being sampled?