An Efficient Representation for Irradiance Environment Maps Ravi Ramamoorthi and Pat Hanrahan 2001 What ? Describes a method of calculating Global Illumination using spherical harmonics When calculating Global Illumination, highfrequency lighting gets blurred. This implies that we might be able to ignore higher-order spherical harmonics terms. The radiance map The irradiance map Traditional Lighting - Wikipedia Lighting a scene What? A method of approximating light accumulation (Irradiance) at a point in space using spherical harmonics What? Spherical harmonics A method of approximating a function over a domain Similar to Fourier transform Approximating a square wave What is irradiance? Irradiance is the accumulation of all lighting values on a half-sphere for a point (given its normal). It is a function of the normal (n). The integral over ω removes the dependence on ω. E(n) (n ) L()(n )d The integral represents the accumulation of all the light values. How can we calculate E(n)? Spherical Harmonics! Like a Fourier Transform, Spherical Harmonics translates one function into a sum of basis functions multiplied by coefficients. The basis functions are defined using polar coordinates (θ, ϕ). So, let's apply Spherical Harmonics to E(n)! E(n) (n ) L()(n )d So, let's apply Spherical Harmonics to E(n)! Rewrite E(n) in terms of (θ, ϕ) ▪ E(n) is in Cartesian coordinates ▪ E(θ, ϕ) is E(n) converted to polar coordinates E ( , ) (n ) L()(n )d So, let's apply Spherical Harmonics to E(n)! Spherical harmonics lets us replace the function E(θ, ϕ) with a summation over l and m. ▪ Ylm(θ, ϕ): The spherical harmonics basis function ▪ Elm: A coefficient for Ylm(θ, ϕ) How many basis functions? E Y ( , ) lm lm l ,m (n ) L( )(n )d So, let's apply Spherical Harmonics to L(ω)! Rewrite L(ω) in terms of (θ, ϕ) E Y ( , ) lm lm l ,m (n ) L( , )(n )d So, let's apply Spherical Harmonics to L(ω)! Replace (n ∙ ω) with the cosine ▪ Remember: a ∙ b = |a| |b| cos(θ) ▪ Note that n and ω are unit vectors so their lengths are 1 ▪ Let A(θ') = max[0, cos(θ')] E Y ( , ) lm lm l ,m (n ) L( , )A( ' )d Simplify the equation! The derivation of the integrals is quite difficult. ˆ This is the result of the paper: Elm Llm A l l 1 2 l! 2 (1) (l 2)(l 1) 2l ( l !) 2 2 Aˆl 2 3 0 (l even) (l 1) (l odd, l 1) Replace the Aˆl l 1 2 Elm Llm 3 l 1, odd Elm 0 l even l 1 2 l! (1) Elm Llm 2 l l 2 (l 2)(l 1) 2 ( 2 !) What does this mean? l 1 l 1, odd 2 Elm Llm 3 Elm 0 l even l 1 2 l! (1) Elm Llm 2 l l 2 (l 2)(l 1) 2 ( 2 !) ˆ drop off quickly Values for A l l 0 1 2 3 4 5 6 7 8 Al 3.142 2.094 0.785 0 -0.131 0 0.049 0 -0.025 What is Aˆl ? Everything after the 3rd band of spherical harmonics contribute little You get a good approximation by using only 9 coefficients ▪ l = [0, 1, 2] -l ≤ m ≤ l ▪ (0, 0), (1, -1), (1, 0), (1, 1), (2, -2), (2, -1), (2, 0), (2, 1), (2, 2) ▪ Technically we get l = 3 as well, since the coefficient is 0 What is Aˆl ? The lighting environments they use for their test cases have an average error of around 1% and a maximum error of around 5%. Their test environments look to be fairly representative, so the margin for error for our environments should be similar. Bounced light calculation is expensive Light maps only work for static objects Sampling from voxels would work for dynamic objects, but needs lots of voxels 9 coefficients for each channel Spherical harmonic coefficients can be calculated from environment maps Irradiance is low frequency so maps do not need to be especially high res Artists place volumes Automatic sampling within volume produces many voxels Interpolate between voxels Irradiance evaluated as E(n) nt Mn M is a 4x4 matrix based on coefficients