A Phong shader represents a Phong-like reflector. Its bidirectional reflection/transmission distribution functions are as follows:
At a given point x, let cd be the diffuse color (components R, G, B) at that point, α the alpha-component of the diffuse color and ct the transparency color. For each color component, set
cαt = 1 + α (ct - 1)
Let cs be the specular color and n the shininess exponent. Let r be the reflection coefficient as computed by Fresnel equation.
Now if interpolatedTransparency is true, set
Otherwise, set
The bidirectional reflection distribution function is
BRDF(x, ωi, ωo) = kd / π + ks (n + 2) max(cos β, 0)n / 2π
where β is the angle between ωi and the direction of ideal reflection of ωo. The bidirectional transmission distribution function is
BTDF(x, ωi, ωt) = kt (ηt / ηi)2 δω+ (ωi - T(ωt))
where η stands for the index of refraction, T for the direction of transmission according to Fresnel's formulas, and δω+ is the δ-distribution with respect to projected solid angle ω+.
The Phong shader supports:
Below is an illustration of the effect of specular and shininess:
Note: In modern Phong shader implementations, roughness and glossiness replace specular and shininess.