Lighting terms, isolated and summed

A sphere shaded per pixel from one vector: the surface normal. Drag inside the canvas to move the light; hover to probe a pixel.

ambient — flat, everywhere diffuse — dot(N, L) specular — dot(N, H)^shininess

What to notice. Diffuse only cares where the light is; the highlight also cares where you are, which is why it slides across the surface as the light moves while the diffuse falloff just rotates. Ambient is the only thing keeping the dark side from being pure black. Turn on flat normals: the silhouette never changes by a single pixel, but the surface breaks into flat facets — shading smoothness is a property of the normals, not of the geometry.

← all demos