引言
Introduction
基于物理的渲染已经提出好多年了,但在游戏中使用的渲染模型仍然是拼凑出来的经验公式(比如Phong)。这些拼凑的模型如果要渲染高质量的图像, 就需要繁复地调参数。而基于物理的、保能量的渲染模型可以很容易地建立出在不同光照环境下都接近真实的材质来。
神奇的是,基于物理的模型并不会比传统上拼 凑的模型更难实现,计算量也差不多。
Physically based rendering have been known for many years, but the “ad-hoc” rendering models (such as Phong) are still widely used in game. These “ad-hoc” models require laborious tweaking to produce high-quality images. However, physically based, energy-conserving rendering models easily create materials that hold up under a variety of lighting environments.
Surprisingly, physically based models are not more difficult to implement or evaluate than the traditional “ad-hoc” ones.
反射方程
Reflectance equation
游戏中最常使用的渲染模型描述的是反射,不考虑SSS等。反射方程可以表示成:
The most common used rendering model in game describes only reflectance, not including terms such as SSS. The reflectance equation is:
$L_0(\mathbf{v})=\int_{\Omega} \rho(\mathbf{l},\mathbf{v}) \otimes {L}_{i}(\mathbf{l}) (\mathbf{n} \cdot \mathbf{l}) d \omega_{i}$
其中,$\rho(\mathbf{l},\mathbf{v})$表示BRDF,$L_i(\mathbf{l})$表示光源给的贡献,$(\mathbf{n} \cdot \mathbf{l})$表示光源和表面法线的夹角。这个积分的结果就是所有光源对一个点的贡献之和。
Here $\rho(\mathbf{l},\mathbf{v})$ is BRDF, $L_i(\mathbf{l})$ is the contribution from light source, $(\mathbf{n} \cdot \mathbf{l})$ is the angle between light and surface normal. This integration results the sum of all light sources contribute to a surface point.
Diffuse项
Diffuse term
最简单的一个BRDF就是Lambert,在游戏中就是用$(\mathbf{n} \cdot \mathbf{l})$来表示。但实际上,$(\mathbf{n} \cdot \mathbf{l})$是属于反射方程的一项,而Lambert则是一个常量:
The simplest BRDF is the Lambert. The well-known Lambertian BRDF in game is present as $(\mathbf{n} \cdot \mathbf{l})$. However, $(\mathbf{n} \cdot \mathbf{l})$ is part of reflectance equation, and lambertian term is actually a constant value:
$\rho_{lambert}(\mathbf{l},\mathbf{v})=\frac{\mathbf{c}_{diff}}{\pi}$
本系列的第一篇就介绍到此,下一篇将介绍如何从这两个公式引出其他的基于物理的渲染公式。
The first article in this serial ends here. The next one will introduce how to use these two equation to derivate other physically based rendering equations.
Comments