Skip to content

Commit

Permalink
斜率与法线分布关系 #145 #156
Browse files Browse the repository at this point in the history
  • Loading branch information
kanition committed Mar 12, 2024
1 parent 8829f73 commit 4dc0ee0
Showing 1 changed file with 81 additions and 1 deletion.
82 changes: 81 additions & 1 deletion content/chap08ex01.tex
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,88 @@ \subsubsection*{Smith微面}
D({\bm\omega}_{\mathrm{h}})\mathrm{d}{\bm\omega}_{\mathrm{h}}}\, .
\end{align}
这恰是\citet{10.1145/344779.344814}在法线和遮挡独立性假设下
得到的掩模函数的精确积分形式。
得到的掩模函数的精确积分形式。然而其中的积分是在法线分布空间中进行的,
计算起来并不方便。我们可以将其积分域转化到斜率分布空间以简化它,下面给出具体推导。

对于曲面上某处的法线${\bm\omega}_{\mathrm{h}}$
设它在直角坐标系下和球面坐标系下具体的分量为
\begin{align}
{\bm\omega}_{\mathrm{h}}=(x_{\mathrm{h}},y_{\mathrm{h}},z_{\mathrm{h}})
=(\sin\theta\cos\varphi,\sin\theta\sin\varphi,\cos\theta)\, ,
\end{align}
则该处附近的面元可以近似为以下平面
\begin{align}
x_{\mathrm{h}}x+y_{\mathrm{h}}y+z_{\mathrm{h}}z=C\, .
\end{align}
其中$C$为某个常量,于是有
\begin{align}
z=\left(-\frac{x_{\mathrm{h}}}{z_{\mathrm{h}}},
-\frac{y_{\mathrm{h}}}{z_{\mathrm{h}}}\right)\cdot(x,y)+C\, ,
\end{align}
我们由此定义
\begin{align}
{\bm s}({\bm\omega}_{\mathrm{h}})=(x_s,y_s)
=\left(-\frac{x_{\mathrm{h}}}{z_{\mathrm{h}}},
-\frac{y_{\mathrm{h}}}{z_{\mathrm{h}}}\right)
=-\tan\theta(\cos\varphi,\sin\varphi)
\end{align}
为曲面在该处的斜率
\sidenote{原文slope,这里作者想表达的是$z$$x$$y$的偏导数,
它和二维直角坐标系下直线斜率的形式很像,所以借用这个称呼。}。
反之,也可以根据斜率求出相应法线为
\begin{align}
{\bm\omega}_{\mathrm{h}}=\frac{1}{\sqrt{x_s^2+y_s^2+1}}(-x_s,-y_s,1)\, .
\end{align}

接下来我们考虑斜率分布$P_{xy}({\bm s})$与法线分布
(即微面分布函数)$D({\bm\omega}_{\mathrm{h}})$之间的关系。
显然$P_{xy}({\bm s})$应满足规范化约束,
即它在$x_s\in(-\infty,+\infty),y_s\in(-\infty,+\infty)$范围内非负,且有
\begin{align}
\int_{-\infty}^{+\infty}\int_{-\infty}^{+\infty}
P_{xy}(x_s,y_s)\mathrm{d}x_s\mathrm{d}y_s=1\, .
\end{align}
将上式和\refeq{08ex01-McrofacetDistributionNormalization}比对,可得
\begin{align}\label{eq:08-ex01-P2D}
P_{xy}(x_s,y_s)\mathrm{d}x_s\mathrm{d}y_s=
\cos\theta D({\bm\omega}_{\mathrm{h}})\mathrm{d}{\bm\omega}_{\mathrm{h}}\, .
\end{align}
根据三维球面坐标转换公式,有
\begin{align}\label{eq:08-ex01-D_sphere}
D({\bm\omega}_{\mathrm{h}})\mathrm{d}{\bm\omega}_{\mathrm{h}}
=\sin\theta D({\bm\omega}_{\mathrm{h}})\mathrm{d}\theta\mathrm{d}\varphi\, .
\end{align}
而斜率坐标对法线的球面坐标的雅可比矩阵为
\begin{align}
J=\displaystyle\frac{\partial(x_s,y_s)}{\partial(\theta,\varphi)}
=\displaystyle\left[\begin{array}{cc}
\displaystyle\frac{\partial x_s}{\partial \theta} &
\displaystyle\frac{\partial x_s}{\partial \varphi} \\
\displaystyle\frac{\partial y_s}{\partial \theta} &
\displaystyle\frac{\partial y_s}{\partial \varphi}
\end{array}\right]
=\displaystyle\left[\begin{array}{rr}
\displaystyle -\frac{\cos\varphi}{\cos^2\theta} &
\displaystyle \tan\theta\sin\varphi \\
\displaystyle -\frac{\sin\varphi}{\cos^2\theta} &
\displaystyle -\tan\theta\cos\varphi
\end{array}\right]\, ,
\end{align}
于是雅可比行列式为
\begin{align}
|J|=\frac{\tan\theta}{\cos^2\theta}\, .
\end{align}
结合\refeq{08-ex01-P2D}和\refeq{08-ex01-D_sphere}得
\begin{align}
P_{xy}(x_s,y_s)\mathrm{d}x_s\mathrm{d}y_s
=|J|P_{xy}(x_s,y_s)\mathrm{d}\theta\mathrm{d}\varphi
=\sin\theta\cos\theta D({\bm\omega}_{\mathrm{h}})\mathrm{d}\theta\mathrm{d}\varphi\, .
\end{align}
所以斜率分布与法线分布的关系为
\begin{align}
P_{xy}(x_s,y_s)=\frac{\sin\theta\cos\theta}{|J|}D({\bm\omega}_{\mathrm{h}})
=\cos^4\theta D({\bm\omega}_{\mathrm{h}})\, .
\end{align}

\subsection{典型微面分布函数的规范性证明}\label{sub:典型微面分布函数的规范性证明}
本节补充了\refeq{8.10}和\refeq{8.11}所给的
Expand Down

0 comments on commit 4dc0ee0

Please sign in to comment.