Answers refer to our implementation: the full Phong reflection model with a distant white light \(\ell_e=(0,0,-1)\), computed in world space, with \(L_i=L_e\) (no shadows) and \(k_a=k_d\).
All three use the same reflection model; they differ in where/how often it is evaluated and what is interpolated across a triangle:
| Shading | Lighting evaluated | Interpolated across triangle | Look |
|---|---|---|---|
| Flat | once per triangle (single face normal) | nothing — constant colour | faceted |
| Gouraud | per vertex (vertex shader) | the resulting colour | smooth, weak highlights |
| Phong | per fragment (fragment shader) | the normal (and position), re-normalized | smooth, sharp highlights |
How to implement flat shading: use a single normal per
triangle (the geometric face normal \(\vec n=\widehat{(b-a)\times(c-a)}\)),
or mark the colour/normal output with WGSL's @interpolate(flat) so
the provoking vertex's value is used for the whole triangle (no interpolation).
Gouraud or Phong for highlights? Phong. The specular term \((\max(\vec\omega_r\!\cdot\vec\omega_o,0))^s\) is a sharply-peaked, non-linear function of the normal. Gouraud only samples it at the vertices and then linearly interpolates the colour, so a highlight falling between vertices is smeared or missed entirely (visible in our Part 4 as a soft blob). Phong interpolates the normal and re-evaluates per pixel, so the highlight is crisp and correctly placed (Part 5).
The distinction is encoded in the homogeneous \(w\) of the light position \(\boldsymbol p_\ell=(x,y,z,w)\):
Yes, but only the specular term. Ambient and diffuse depend on \(\vec n,\ \vec\omega_i\) and the material — not on the viewer. The specular term depends on the direction to the observer \(\vec\omega_o=\widehat{\boldsymbol e-\boldsymbol x}\) (through \(\vec\omega_r\!\cdot\vec\omega_o\)), so moving the eye moves the highlight. For a purely diffuse material (\(k_s=0\)) the eye position has no effect at all.
The highlight disappears and the sphere becomes a purely diffuse (Lambertian) surface plus ambient: \(L_o=k_d L_e\max(\vec n\!\cdot\vec\omega_i,0)+k_a L_a\). It looks matte/chalky and loses all view dependence (see (c)).
Because the specular falloff is \((\cos\phi)^{s}\), a larger \(s\) makes the highlight smaller, tighter and brighter at its centre — the surface looks harder/glossier (more mirror-like). A smaller \(s\) spreads the highlight into a broad, soft sheen — a more matte, rougher-looking surface.
In world space: we transform the position and normal by the model matrix (\(\boldsymbol x_w=M\boldsymbol x,\ \vec n_w=\,\)normalize\((M\,\vec n)\)) and supply the eye point and light direction in world coordinates. Eye space would give identical results (the eye then sits at the origin). Since our sphere uses \(M=I\), world space coincides with object space here.