論文作者提出經驗和理論證據表明,在實踐中,irradiance僅取決於的前2階spherical harmonic modes of the illumination,並且可以表示爲表面法線的笛卡爾分量的二次多項式。 實際上,Lambertian BRDF濾波器的99%能量包含在0,1和2階中。特別是,我們只關心照明的前2階,即9個參數。 這些前9個係數也是關於照明可以確定的所有係數。
We must scale E by the surface albedo ρ, which may be dependent on position p and be described by a texture, to find the radiosity B, which corresponds directly to the image intensity. B(p,n)=ρ(p)E(n)
The irradiance E is then a function of the surface normal n only and is given by an integral over the upper hemisphere Ω(n). E(n)=∫Ω(n)L(ω)(n⋅ω)dω
Spherical Harmonics
Spherical harmonics Ylm, with l≥0 and −l≤m≤l, are the analogue on the sphere to the Fourier basis on the line or circle. The first 9 spherical harmonics (with l≤2) are simply constant (l=0), linear (l=1), and quadratic (l=2) polynomials of the cartesian components (x, y, z). and are given numerically by (x,y,z)Y00(Y11;Y10;Y1−1)(θ,ϕ)(Y21;Y2−1;Y2−2)(θ,ϕ)Y20(θ,ϕ)Y22(θ,ϕ)=(sinθcosϕ,sinθsinϕ,cosθ)=0.282095=0.488603(x;z;y)=1.092548(xz;yz;xy)=0.315392(3z2−1)=0.546274(x2−y2)(3)
Spherical Harmonics Expansion
E(θ,ϕ) and L(θ,ϕ) can be represented by the coefficients— Elm and Llm—in their spherical harmonic expansion.
Analytic Irradiance Formula
We also define A=(n⋅ω) with coefficients Al. Since A has no azimuthal dependence, m=0 and we use only the l index. A(θ)=max[cosθ,0]=l∑AlYl0(θ)
With these definitions one can show (參考文獻[1]可知) that Elm=2l+14πAlLlm
It will be convenient to define a new variable Al^ by Al^=2l+14πAl
For rendering, it will be convenient to expand out the irradiance. E(θ,ϕ)=l,m∑A^lLlmYlm(θ,ϕ)(7)
An analytic formula for Al can be derived. It can be shown that Al vanishes for odd values of l>1, and even terms fall off very rapidly as l−5/2. The analytic formulae are given by l=1l>1,oddlevenA^1=32πA^l=0A^l=2π(l+2)(l−1)(−1)2l−1[2l(2l!)2l!]
Numerically, the first few terms are A^0=3.141593A^1=2.094395A^2=0.785398A^3=0A^4=−0.130900A^5=0A^6=0.049087(9)
9 Parameter Approximation
Computing Light Coefficients
給定envmap,計算9個lighting coefficient Llm
Rendering
For rendering, we can find the irradiance using equation 7. Since we are only considering l≤2, the irradiance is simply a quadratic polynomial of the coordinates of the (normalized) surface normal. Hence, with nt=(xyz1), we can write E(n)=ntMn
M is a symmetric 4x4 matrix. Each color has an independent matrix M. Equation 11 is particularly useful for rendering, since we require only a matrix-vector multiplication and a dot-product to compute E. The matrix M is obtained by expanding equation 7: M=⎝⎜⎜⎛c1L22c1L2−2c1L21c2L11c1L2−2−c1L22c1L21c2L1−1c1L21c1L2−1c3L20c2L10c2L11c2L1−1c2L10c4L00−c5L20⎠⎟⎟⎞c1=0.429043c2=0.511664c3=0.743125c4=0.886227c5=0.247708(12)
The entries of M depend on the 9 lighting coefficients Llm and the expressions for the spherical harmonics. The constants come from the numerical values of A^l given in equation 9, and the spherical harmonic normalizations given in equation 3.
On systems not optimized for matrix and vector operations, it may be more efficient to explicitly write out equation 7 for the irradiance as a sum of terms, i.e. expand equation 12: E(n)=c1L22(x2−y2)+c3L20z2+c4L00−c5L20+2c1(L2−2xy+L21xz+L2−1yz)+2c2(L11x+L1−1y+L10z)