Phong Illumination
An illumination algorithm in 4 [see page 7, stages], which only supports direct illumination and lacks support for shadows or inter-reflection between objects.
We define the light intensity:
\begin{align*}
\mathrm{Reflected Light} &= \mathrm{Ambient} + \mathrm{Diffuse} + \mathrm{Specular} \
l &= (k_a \times l_a) + (k_d \times l_d) + (k_s \times l_s)
\end{align*}
Such that \[ k_a + k_d + k_l = 1 \].
This can also be [see page 15, rewritten] as: \[ I = k_a \times l_a + I_L(k_d(L.N) + k_s(R.V)^{n}) \]
Note: when using multiple light sources you should Sum each light source in place of \(I_L\) and clamp it to prevent illumination overflow.
Term | Definition |
---|---|
\(k_a\) | Fraction of ambient light reflected (esentially the color of the surface). |
\(l_a\) | Ambient light intensity. |
\(k_d\) | |
\(l_d\) | Intensity of the light incident on the surface. |
\(k_s\) | |
\(l_s\) |
Note: You can [see page 22, specify] a vector of diffuse values for RGB coloration.
Ambient
\[ k_a \times l_a \]
A constant (we specify) that [see page 8, simulates] the global/indirect illumination. It specifies how something which isn't in visible light should appear.
Warn: This doesn't account for reflections.
Diffuse
\[ k_d \times l_d \]
Simulates the directional impact light has on an object. The more an object faces a light source, the brighter its surface becomes.
We [see page 10, can] calculate the normal using the dot product between the normal of the polygon (N) and the direction of the light source (L).
\[ l_d = I_l cos(\theta) = I_l (L . N) \]
Where the \(\theta\) is the angle between the two vectors \(L\) and \(N\). And \(I_l\) is just the intensity of the light source. Observe that with this model the object has the greatest specular contribution where it's normal is facing the light source (\(\cos(0) = 1\)) and the lowest contribution when perpendicular from it (\(\cos(90) = 0\)).
Note: The angle of our viewpoint (v) is [see page 9, irrelevent]. All that's relevant is the angle at which the normal of the surface meets the light source.
Specular
\[ k_s \times l_s \]
Specifies the shinyness (reflectivity) of a surface.
The idea behind phongs approach was that:
Phong calculates this [see page 14, value] using the cosine of the angle between the viewpoint and the perfect mirror direction to some power \(n\). The value of \(n\) indicates how reflective the object is, a low value of n is very noisy whereas a high value is very clearly smooth and shiny (See the \(cos^{n}(\Omega)\) graphs).
Optimisations
Blinn [see page 20, introduced] an optimisation for this equation by removing the need for calculating \(R.V\)