当前位置:   article > 正文

球谐光照简述_球谐光照 九个值

球谐光照 九个值

本文主要参考作者在Siggraph上的PPT,都在参考文献中给出,详细理论证明请看论文,代码也在以下链接的论文主页上

最终计算方法在最后两张图上,参考代码在参考文献网站上
参考代码,相关解释需要看参考文献[3]


论文作者提出经验和理论证据表明,在实践中,irradiance仅取决于的前2阶spherical harmonic modes of the illumination,并且可以表示为表面法线的笛卡尔分量的二次多项式。 实际上,Lambertian BRDF滤波器的99%能量包含在0,1和2阶中。特别是,我们只关心 照明的前2阶,即9个参数。 这些前9个系数也是关于照明可以确定的所有系数。

对于游戏开发而言,实际意义在于,可以预先给定一个场景的CubeMap,计算出球谐函数的9个参数,用着9个参数可以计算出mesh表面顶点的irradiance。

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 ) B(p,n)=\rho(p)E(n) B(p,n)=ρ(p)E(n) 在这里插入图片描述

以下提到的符号请参考https://en.wikipedia.org/wiki/Radiance

Computing Irradiance

  • 每个像素是由半球积分得到的
  • 朗博表面是就像一个低通滤波器

在这里插入图片描述
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 ω E(n) = \int_{\Omega(n)}L(\omega)(n \cdot \omega)d\omega E(n)=Ω(n)L(ω)(nω)dω

Spherical Harmonics

在这里插入图片描述
Spherical harmonics Y l m Y_{lm} Ylm, with l ≥ 0 l \ge 0 l0 and − l ≤ m ≤ l −l \le m \le l lml, are the analogue on the sphere to the Fourier basis on the line or circle. The first 9 spherical harmonics (with l ≤ 2 l \le 2 l2) are simply constant ( l = 0 l = 0 l=0), linear ( l = 1 l = 1 l=1), and quadratic ( l = 2 l = 2 l=2) polynomials of the cartesian components (x, y, z). and are given numerically by
(3) ( x , y , z ) = ( sin ⁡ θ cos ⁡ ϕ , sin ⁡ θ sin ⁡ ϕ , cos ⁡ θ ) Y 00 = 0.282095 ( Y 11 ; Y 10 ; Y 1 − 1 ) ( θ , ϕ ) = 0.488603 ( x ; z ; y ) ( Y 21 ; Y 2 − 1 ; Y 2 − 2 ) ( θ , ϕ ) = 1.092548 ( x z ; y z ; x y ) Y 20 ( θ , ϕ ) = 0.315392 ( 3 z 2 − 1 ) Y 22 ( θ , ϕ ) = 0.546274 ( x 2 − y 2 ) (x,y,z)amp;=(sinθcosϕ,sinθsinϕ,cosθ)Y00amp;=0.282095(Y11;Y10;Y11)(θ,ϕ)amp;=0.488603(x;z;y)(Y21;Y21;Y22)(θ,ϕ)amp;=1.092548(xz;yz;xy)Y20(θ,ϕ)amp;=0.315392(3z21)Y22(θ,ϕ)amp;=0.546274(x2y2)

(x,y,z)Y00(Y11;Y10;Y11)(θ,ϕ)(Y21;Y21;Y22)(θ,ϕ)Y20(θ,ϕ)Y22(θ,ϕ)amp;=(sinθcosϕ,sinθsinϕ,cosθ)amp;=0.282095amp;=0.488603(x;z;y)amp;=1.092548(xz;yz;xy)amp;=0.315392(3z21)amp;=0.546274(x2y2)
\tag{3} (x,y,z)Y00(Y11;Y10;Y11)(θ,ϕ)(Y21;Y21;Y22)(θ,ϕ)Y20(θ,ϕ)Y22(θ,ϕ)=(sinθcosϕ,sinθsinϕ,cosθ)=0.282095=0.488603(x;z;y)=1.092548(xz;yz;xy)=0.315392(3z21)=0.546274(x2y2)(3)

Spherical Harmonics Expansion

E ( θ , ϕ ) E(\theta, \phi) E(θ,ϕ) and L ( θ , ϕ ) L(\theta, \phi) L(θ,ϕ) can be represented by the coefficients— E l m E_{lm} Elm and L l m L_{lm} Llm—in their spherical harmonic expansion.
在这里插入图片描述

Analytic Irradiance Formula

We also define A = ( n ⋅ ω ) A=(n \cdot \omega) A=(nω) with coefficients A l A_l Al. Since A A A has no azimuthal dependence, m = 0 m=0 m=0 and we use only the l l l index.
A ( θ ) = m a x [ cos ⁡ θ , 0 ] = ∑ l A l Y l 0 ( θ ) A(\theta)=max[\cos \theta, 0]=\sum_l A_l Y_{l0}(\theta) A(θ)=max[cosθ,0]=lAlYl0(θ)

With these definitions one can show (参考文献[1]可知) that
E l m = 4 π 2 l + 1 A l L l m E_{lm}=\sqrt{\frac{4 \pi}{2l+1}}A_lL_{lm} Elm=2l+14π AlLlm

It will be convenient to define a new variable A l ^ \hat{A_{l}} Al^ by
A l ^ = 4 π 2 l + 1 A l \hat{A_l}=\sqrt{\frac{4 \pi}{2l+1}}A_l Al^=2l+14π Al

For rendering, it will be convenient to expand out the irradiance.
(7) E ( θ , ϕ ) = ∑ l , m A ^ l L l m Y l m ( θ , ϕ ) E(\theta, \phi)=\sum_{l,m} \hat{A}_l L_{lm} Y_{lm}(\theta, \phi) \tag{7} E(θ,ϕ)=l,mA^lLlmYlm(θ,ϕ)(7)

An analytic formula for A l A^l Al can be derived. It can be shown that A l A^l Al vanishes for odd values of l > 1 l > 1 l>1, and even terms fall off very rapidly as l − 5 / 2 l^{-5/2} l5/2. The analytic formulae are given by
l = 1 A ^ 1 = 2 π 3 l > 1 , o d d A ^ l = 0 l e v e n A ^ l = 2 π ( − 1 ) l 2 − 1 ( l + 2 ) ( l − 1 ) [ l ! 2 l ( l 2 ! ) 2 ] l=1amp;ˆA1=2π3lgt;1,oddamp;ˆAl=0levenamp;ˆAl=2π(1)l21(l+2)(l1)[l!2l(l2!)2]

l=1llevenamp;A^1=2π3gt;1,oddamp;A^l=2π(1)l21(l+2)(l1)[l!2l(l2!)2]amp;A^l=0
l=1l>1,oddlevenA^1=32πA^l=0A^l=2π(l+2)(l1)(1)2l1[2l(2l!)2l!]

Numerically, the first few terms are
(9) A ^ 0 = 3.141593 A ^ 1 = 2.094395 A ^ 2 = 0.785398 A ^ 3 = 0 A ^ 4 = − 0.130900 A ^ 5 = 0 A ^ 6 = 0.049087 \hat{A}_0 = 3.141593 \quad \hat{A}_1 = 2.094395 \quad \hat{A}_2 = 0.785398 \\ \hat{A}_3 = 0 \quad \hat{A}_4 = −0.130900 \quad \hat{A}_5 = 0 \quad \hat{A}_6 = 0.049087 \tag{9} 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 L l m L_{lm} Llm
在这里插入图片描述

Rendering

在这里插入图片描述
For rendering, we can find the irradiance using equation 7. Since we are only considering l ≤ 2 l \le 2 l2, the irradiance is simply a quadratic polynomial of the coordinates of the (normalized) surface normal. Hence, with n t = ( x   y   z   1 ) n^t = (x \ y\ z\ 1) nt=(x y z 1), we can write
E ( n ) = n t M n E(n)=n^tMn 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:
(12) M = ( c 1 L 22 c 1 L 2 − 2 c 1 L 21 c 2 L 11 c 1 L 2 − 2 − c 1 L 22 c 1 L 2 − 1 c 2 L 1 − 1 c 1 L 21 c 1 L 21 c 3 L 20 c 2 L 10 c 2 L 11 c 2 L 1 − 1 c 2 L 10 c 4 L 00 − c 5 L 20 ) c 1 = 0.429043 c 2 = 0.511664 c 3 = 0.743125 c 4 = 0.886227 c 5 = 0.247708 M= (c1L22amp;c1L22amp;c1L21amp;c2L11c1L22amp;c1L22amp;c1L21amp;c2L11c1L21amp;c1L21amp;c3L20amp;c2L10c2L11amp;c2L11amp;c2L10amp;c4L00c5L20)

\\ c_1=0.429043 \quad c_2=0.511664\\ c_3=0.743125 \quad c_4=0.886227 \quad c_5=0.247708 \tag{12} M=c1L22c1L22c1L21c2L11c1L22c1L22c1L21c2L11c1L21c1L21c3L20c2L10c2L11c2L11c2L10c4L00c5L20c1=0.429043c2=0.511664c3=0.743125c4=0.886227c5=0.247708(12)
The entries of M depend on the 9 lighting coefficients L l m L_{lm} Llm and the expressions for the spherical harmonics. The constants come from the numerical values of A ^ l \hat{A}_l 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 ) = c 1 L 22 ( x 2 − y 2 ) + c 3 L 20 z 2 + c 4 L 00 − c 5 L 20 + 2 c 1 ( L 2 − 2 x y + L 21 x z + L 2 − 1 y z ) + 2 c 2 ( L 11 x + L 1 − 1 y + L 10 z ) E(n)amp;=c1L22(x2y2)+c3L20z2+c4L00c5L20amp;+2c1(L22xy+L21xz+L21yz)amp;+2c2(L11x+L11y+L10z)
E(n)=c1L22(x2y2)+c3L20z2+c4L00c5L20+2c1(L22xy+L21xz+L21yz)+2c2(L11x+L11y+L10z)

参考文献

[1] An Efficient Representation for Irradiance Environment Maps
[2] On the Relationship between Radiance and Irradiance: Determining the illumination from images of a convex Lambertian object
[3] Light Probe Image Gallery

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/118631?site
推荐阅读
相关标签
  

闽ICP备14008679号