Four lighting approaches rendered side by side in the same canvas, split by:
Let's walk through each panel.
Panel 1: Lambert diffuse
The simplest model — diffuse only, no highlight. Surfaces scatter light evenly. Stable and commonly used for cartoon or matte materials.
Panel 2: Phong specular
Uses the reflection vector r = reflect(-l, n) and its alignment with the view direction v. The highlight shifts as the view angle changes.
Panel 3: Blinn-Phong specular
Replaces the reflection vector with the half-vector h = normalize(l + v). More efficient to compute and more stable at grazing angles. For the same visual result, Blinn-Phong typically needs a 2–4× larger exponent than Phong.
Panel 4: Rim light
When the normal and view direction are nearly perpendicular (the silhouette edge), 1.0 - dot(n, v) approaches 1.0, creating a bright outline. No light direction involved — purely a view-angle effect.
Try changing it
| Change | Effect |
|---|---|
Panel 3 exponent from 28.0 to 8.0 | Blinn-Phong highlight widens |
Panel 4 exponent from 2.5 to 5.0 | Rim light becomes a narrower band |
Panel 4 rim color to vec3(1.0, 0.6, 0.3) | Warm orange rim, like a backlit fire effect |
Exercise
In the exercise, all three highlight/rim values are 0.0 — only panel 1 shows any difference. Fill in the three TODOs to make all four panels display their correct lighting effects.
Answer Breakdown
Starting state: all three are 0.0, so panels 2–4 look identical to panel 1.
The fixes:
- Phong uses
dot(r, v): how well the reflected ray aligns with the view - Blinn-Phong uses
dot(n, h): how well the normal aligns with the half-vector - Rim uses
1.0 - dot(n, v): stronger at the silhouette where the normal tilts away from the camera
Comparing the two specular panels: notice Blinn-Phong needs a larger exponent (28) to produce a similar highlight size as Phong (18).
Try changing the rim exponent to 1.5 and see how far the rim light spreads across the sphere.