Skip to content

Lecture 7: Illumination, Shading and Graphics Pipeline

Illumination and Shading

Shading

着色是将光照模型应用于物体表面以计算颜色的过程。

Blinn-Phong Model

  • Viewer direction \(\mathbf{V}\): 观察者或摄像机的方向。
  • Surface normal \(\mathbf{N}\): 物体表面的法向量。
  • Light direction \(\mathbf{L}\): 光源的方向。
  • Surface parameters:颜色、反射率等。

漫反射(Diffuse Reflection):光线会被物体表面均匀散射。

Lambert's cosine law:

\[ I_d = k_d \cdot I_L \cdot \cos(\theta) = k_d \cdot \frac{\mathbf{I}}{\mathbf{r^2}} \cdot \max(0, \mathbf{N} \cdot \mathbf{L}) \]

其中,公式中的 \(k_d\) 是漫反射系数,\(I\) 是光源的强度,\(\theta\) 是光线与法向量之间的夹角,\(\mathbf{N} \cdot \mathbf{L}\) 是法向量与光线方向的点积。