Back: (y-04) Graphics Primer | Next: (y-06) Textures | RTG Index

Mental Model First: Where Does the Pixel Colour Come From?

  • Rasterisation gives us which pixel, shading decides what colour. Every shading model is an answer to one integral: how much of the incoming light from every direction is reflected toward the camera.
  • BRDFs range from empirical fits to physical derivations. Empirical models (Lambert, Phong, Blinn-Phong) approximate the look. Physically-based models (Cook-Torrance, Disney) derive the recipe from microscale geometry and the Fresnel split.
  • Energy conservation matters. A material that reflects more than 100% of the light it receives looks wrong on screen and breaks global illumination further down the pipeline.

1. The Rendering Equation & BRDF

Rendering Equation

L05_Pg-04: Outgoing radiance is emitted light plus the hemispherical integral of incoming radiance weighted by the BRDF.

  • Emitted light (): the surface acts as a source.
  • Reflected light (integral): every direction on the hemisphere contributes some incoming radiance, scaled by the BRDF .

BRDF Definition

L05_Pg-05: The BRDF describes how a surface at location x reflects light from incoming direction omega_i into outgoing direction omega_o.

The Bidirectional Reflectance Distribution Function is the per-surface, per-direction reflectance.

BRDF Properties

L05_Pg-06: Three properties any physical BRDF must satisfy.

  1. Reciprocity: . Swapping light and view directions yields the same response.
  2. Energy conservation: for every . No surface reflects more energy than it receives.
  3. Positivity: .

2. Light Source Models

Light Sources in Real-Time

L05_Pg-08: Real-time shading replaces the hemispherical integral with a small sum over analytical lights, reducing cost from O(n^infinity) to O(n).

  • Local shading: only direct illumination.
  • Analytical lights (point, directional, spot) replace the area-light integral with a single direction per pixel.

Point Light

L05_Pg-09: Infinitesimally small source; light arrives at every surface point from a single direction toward the light position p_l.

Directional Light

L05_Pg-10: Infinitely far source; the same direction d everywhere in the scene. Used for sunlight.

Spot Light

L05_Pg-11: Point light whose emission is constrained to a cone with inner angle theta_i and outer angle theta_o.


3. Empirical Models: Lambert & Phong

Lambert (Diffuse)

L05_Pg-12: Perfectly diffuse reflector. Scatters incoming light equally in every direction; appearance depends only on surface orientation.

Lambert Shading Computation

L05_Pg-13: Lambert reduces the integral to a single dot product with the light direction.

  • : diffuse reflectance (albedo).
  • : irradiance from the light.
  • : component-wise (RGB) product.

Phong Model

L05_Pg-15: Phong adds an emissive, a diffuse, and a specular term. The specular lobe is centred on the reflection direction.

  • : emissive colour, : diffuse, : specular, : specular power, : light colour.

Reflection Vector

L05_Pg-16: Mirror reflection of the light direction about the surface normal.

All vectors are assumed normalised. The Phong specular term peaks when the view vector aligns with .

Phong Fragment Shader

L05_Pg-20: GLSL fragment shader computing the Phong specular per pixel from the reflection vector.

Phong Shading Properties

L05_Pg-21: Phong is phenomenological. Highlights are always circular and energy conservation is ignored.

💡 Intuition: Why Phong Looks “Plastic”

Real materials concentrate the specular lobe more strongly along the half-vector direction at grazing angles. Phong’s cosine of the reflection angle has no such dependence on viewing geometry, so highlights stay perfectly round and the material reads as smooth plastic regardless of the light position.


4. Blinn-Phong & Energy Conservation

Highlight Shape

L05_Pg-22: Phong vs Blinn-Phong highlights. Blinn-Phong elongates the highlight at grazing angles.

Normalization

L05_Pg-23: Larger specular power m should give smaller but more intense highlights. Unnormalised Phong loses energy as m grows; the normalised form keeps total reflected energy constant.

Energy Conservation

L05_Pg-24: Tweaking specular intensity by hand (left, right) violates conservation. An energy-conserving model keeps reflected light at most equal to incoming light for every outgoing direction.

Blinn-Phong Model

L05_Pg-25: Blinn-Phong replaces the reflection vector with the half-vector h = (v + l) / |v + l| and approximates energy conservation.

Blinn-Phong Vertex Shader

L05_Pg-26: Vertex shader passing world-space position and normal to the fragment stage.

Blinn-Phong Fragment Shader

L05_Pg-27: Fragment shader implementing the normalised Blinn-Phong BRDF.


5. Physically-Based Rendering

From Phenomenology to Physics

L05_Pg-34: PBR derives shading from simplified physics. All light-matter interaction is emission, scattering, or absorption.

Absorption vs Scattering

L05_Pg-36: Photons that enter a medium are either absorbed (energy becomes heat) or scattered (energy changes direction). The mixture defines surface appearance.

Fresnel Laws

L05_Pg-39: At a boundary between two media with different phase speeds, part of the wave is specularly reflected and part is transmitted.

Fresnel Equations

L05_Pg-40: R_s and R_p give the reflectance for the two polarisations; the transmitted fraction is T = 1 - R.

Schlick’s Approximation

L05_Pg-41: Cheap closed-form fit to the Fresnel curve. R_0 is the reflectance at normal incidence.

Surface Roughness

L05_Pg-42: Metals are poorly described by a diffuse lobe. Instead we model the statistical distribution of microscale surface orientation.


6. Microfacets & Cook-Torrance

Microfacets

L05_Pg-43: The surface is modelled as a collection of tiny mirrors with varying orientation.

Half-Vector

L05_Pg-44: Only microfacets whose normal is the half-vector reflect light from l to v.

Microfacet Distribution

L05_Pg-45: The Beckmann distribution D(n, h, m) gives the fraction of microfacets oriented in direction h. Roughness parameter m controls spread.

Geometric Attenuation

L05_Pg-47: Shadowing prevents light from reaching some microfacets; masking blocks reflected light from reaching the camera.

Cook-Torrance Model

L05_Pg-49: Cook-Torrance combines microfacet distribution D, Fresnel reflectance F, and geometric attenuation G.

💡 Intuition: D, F, G in One Sentence Each

  • D says how many microfacets are aimed at the camera right now.
  • F says how much of the light hitting those microfacets bounces off (rather than entering the material).
  • G says how many of those bounces actually escape after dodging the neighbours.

7. Advanced BRDFs

Anisotropic Reflection

L05_Pg-53: Reflection depends on the in-plane viewing direction, not just inclination. Brushed metal is the canonical example.

Retro-Reflection

L05_Pg-54: Deep micro-cavities bounce light back toward the source. Pottery and the lunar surface look brighter near their silhouettes for this reason.

Disney BRDF

L05_Pg-55: A layered model originally built for animated films, now widely used in real-time engines. Combines diffuse, specular, subsurface scattering, clearcoat, and sheen, and blends dielectric and metallic responses.


Applied Exam Focus

  • Rendering equation: be able to write it and explain each term (emission, hemispherical integral, BRDF).
  • BRDF properties: reciprocity, energy conservation, positivity.
  • Lambert vs Phong vs Blinn-Phong: which depend on the view direction, which conserve energy, which use the half-vector.
  • Reflection vector: , and half-vector .
  • Fresnel and Schlick: know the Schlick formula and what is.
  • Cook-Torrance: and the role of D, F, G.

Self-Check

  1. What makes Lambert shading view-independent and Phong shading view-dependent?
  1. Write the reflection vector and the half-vector, and explain which model uses which.
  1. Why does naive Phong violate energy conservation, and how does Blinn-Phong fix it?
  1. State Schlick’s approximation and identify what represents.
  1. In the Cook-Torrance BRDF , what does each of , , represent?
  1. State and interpret the three properties any physical BRDF must satisfy.
  1. What is anisotropic reflection, and why can Cook-Torrance with a single roughness parameter not represent it?
  1. What does the Disney BRDF combine, and why has it become a real-time standard?

(y) Back to RTG Index