Skip to content

Global Illumination

EntropyPortal uses a system of Light Probes stored as Spherical Gaussians (SG) to provide diffuse global illumination.

Light probes capture the irradiance at a specific point in space. Unlike reflection probes, which store high-frequency detail, light probes store low-frequency lighting information suitable for diffuse indirect lighting.

We approximate the irradiance using a sum of Spherical Gaussian lobes (typically 9 or 12 lobes).

  • Compact: SG coefficients are much smaller than a cubemap (even a low-res one).
  • Efficient: Irradiance reconstruction is a simple dot product in the shader.
  • Interpolation: SG lobes can be interpolated smoothly between probes.

Probes are arranged in a sparse 3D structure managed by the ProbeVolumeService.

  • Capture: A low-resolution cubemap (8x8) is rendered at the probe position.
  • Fitting: A compute shader converts the 8x8 cubemap into SG coefficients (GpuSGLobe).
  • Storage: The coefficients are stored in a StructuredBuffer for GPU access.
  • Clustering: Light probes are injected into the clustered shading grid as point lights, allowing for efficient culling and lookup.
graph TD
    Sync[Sync with Scene] --> Check{Dirty?}
    Check -->|Yes| Queue[Queue for Capture]
    Check -->|No| Skip

    Queue --> Render[Render 8x8 Cubemap]
    Render --> Compute["Compute Shader:<br/>Fit SG Lobes"]
    Compute --> Buffer[Write to GPU Buffer]

When an object is rendered:

  1. The shader looks up the nearest light probes from the LightProbeGrid.
  2. It interpolates the SG coefficients based on the object’s position.
  3. It evaluates the irradiance using the surface normal.