转载请注明出处为KlayGE游戏引擎,本文的永久链接为http://www.klayge.org/?p=493

“Physically-Based Rendering in Game” serial, which contains 4-5 articals, introduces how to use physically based method in realtime rendering. The main idea comes from a course of SIGGRAPH 2010: Physically-Based Shading Models in Film and Game Production. The rendering technique in this serial is used in KlayGE 3.11.

Introduction

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

The most common used rendering model in game describes only reflectance, not including terms such as SSS. The reflectance equation is:

[latex]L_0(\mathbf{v})=\int_{\Omega} \rho(\mathbf{l},\mathbf{v}) \otimes {L}_{i}(\mathbf{l}) (\mathbf{n} \cdot \mathbf{l}) d \omega_{i}[/latex]

Here [latex]\rho(\mathbf{l},\mathbf{v})[/latex] is BRDF, [latex]L_i(\mathbf{l})[/latex] is the contribution from light source, [latex](\mathbf{n} \cdot \mathbf{l})[/latex] is the angle between light and surface normal. This integration results the sum of all light sources contribute to a surface point.

Diffuse term

The simplest BRDF is the Lambert. The well-known Lambertian BRDF in game is present as [latex](\mathbf{n} \cdot \mathbf{l})[/latex]. However, [latex](\mathbf{n} \cdot \mathbf{l})[/latex] is part of reflectance equation, and lambertian term is actually a constant value:

[latex]\rho_{lambert}(\mathbf{l},\mathbf{v})=\frac{\mathbf{c}_{diff}}{\pi}[/latex]

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.