![]() |
![]() |
SHIrradianceEnvMap Sample
Path
Why is this sample interesting? Irradiance Environment Maps are a technique for lighting diffuse objects in an arbitrary lighting environment without shadows in a single pass. This technique was first presented at SIGGRAPH 2001 by Ravi Ramamoorthi and Pat Hanrahan in the paper "An Efficient Representation for Irradiance Environment Maps". Using spherical harmonics (SH), an arbitrary lighting environment can almost be perfectly reconstructed with only 9 coefficients. Because of this, the shader complexity is independent of the complexity of the lighting environment. Also note that unlike PRT this technique does not require any precomputation.
How does this sample work? To compute the exit radiance for a given normal, you need to evaluate the lighting convolved with the clamped cosine kernel (represented in SH) in the direction of the normal. The coefficients of the SH basis functions are combined into shader constants with the convolution coefficients in a form that is efficient to evaluate in the shader "IrradianceEnvironmentMapVS". This is described more fully in the article by Peter-Pike Sloan titled "Efficient Evaluation of Irradiance Environment Maps" in the book "ShaderX 2 - Shader Programming Tips and Tricks" by Wolfgang F. Engel. If the lighting environment is grayscale this shader could be simplified.
Typical scenarios for this technique |