Skip to content
Light · TechniqueIntermediate

Specular highlights

The shiny spot where a surface mirrors the light into the camera, from the reflected or the half vector.

NormalViewSurface

Cards

One live example to tweak, learn and copy.

How it works

A glossy surface doesn’t scatter light evenly. Part of what hits it bounces off like a slightly blurred mirror, and you see that part only where the mirror angle sends the light into your eye: a bright spot that slides across the surface as you move. That spot is the specular highlight. Unlike diffuse light it depends on the viewer, so a shader needs the direction toward the camera as well as the surface normal and the direction toward the light.

There are two classic ways to measure “how close is this point to the mirror angle”:

  • Phong reflects the light direction about the normal with reflect and compares the result with the view direction: pow(max(dot(reflect(-l, n), v), 0.0), shininess).
  • Blinn-Phong takes the half vector between the light and view directions and compares it with the normal: pow(max(dot(n, normalize(l + v)), 0.0), shininess).

Both are a dot product raised to a power. The power, often called shininess, tightens the highlight: a low value gives the broad sheen of rubber, a high one the pinpoint of lacquer. Blinn-Phong is the one engines used for decades and the one to reach for. Phong’s reflected vector can end up more than 90° from the view direction while the light is still in front of the surface, so at low shininess its highlight is cut off by a hard edge; the half vector stays within 90° of the normal in those cases. Blinn-Phong also needs about two to four times Phong’s exponent for a highlight of the same size, worth knowing when porting values between the two.

The highlight’s color says what the material is. Plastics, paint and other dielectrics reflect light without tinting it, so their highlight takes the light’s color while the diffuse part carries the paint. Metals tint the highlight with their own color and have almost no diffuse part. Physically based shading replaces the power curve with a microfacet distribution such as GGX and adds Fresnel and energy conservation, but the half vector stays at its center.

Further reading