Shading, Lighting, and Global Illumination
Domain scope
Shading, Lighting, and Global Illumination tests the rendering equation in practice: BRDFs, local illumination models, shadowing, path tracing, and the approximations real-time engines use.
Core rules
- The BRDF is the ratio of outgoing radiance to incoming irradiance; a physically valid BRDF is non-negative and conserves energy.
- Lambertian diffuse has BRDF albedo/π; the π cancels the cosine-weighted integral over the hemisphere.
- Blinn-Phong uses N·H with the halfway vector H=normalize(L+V); it is a cosmetic model, not energy conserving.
- Global illumination solves L_o = L_e + integral of f_r L_i cos(theta) dOmega; path tracing estimates this integral by Monte Carlo sampling.
Worked example
A white-ish surface has albedo 0.8. A directional light has radiance 3 and hits at cos(theta)=0.5. Irradiance is E=3×0.5=1.5. Outgoing diffuse radiance is (0.8/π)×1.5=0.382. If the surface is also visible to a uniform environment of radiance 0.2, its diffuse contribution is 0.8×0.2=0.16, because the cosine-weighted integral of a constant environment equals π times that constant and cancels the 1/π. Total is about 0.542 before tone mapping.
Traps that cost marks
- Omitting the 1/π in diffuse and then over-brightening lights to compensate.
- Normalizing a zero-length normal or light vector and producing NaNs.
- Shadow rays starting exactly on the surface, causing self-intersection acne.
- Calling a model global illumination when it only adds ambient light.