Knowing where a ray goes isn't enough; a raytracer also has to decide how bright and what colour each surface point looks. The classic answer — the local lighting model that ran in nearly every game for two decades — is a sum of three simple terms, each capturing one way light reaches your eye. Add them up and a flat patch of geometry turns into something that looks lit, rounded, and solid:
Every term is built from
Step 1 — Ambient: a constant fill so shadows aren't pitch black. In the real world light bounces around a room and seeps into every crevice. Faking all those bounces is expensive, so the cheapest stand-in is a flat constant added everywhere:
Without it, anything not directly facing the light would be a featureless black hole. Ambient lifts the floor so unlit surfaces still read as their own colour.
Step 2 — Diffuse: matte brightness is the cosine to the light (Lambert). A
chalky, matte surface scatters light equally in all directions, so its brightness depends only
on how squarely it faces the light — the cosine of the angle between the normal
Face the light squarely (
Step 3 — Specular: the shiny highlight (Blinn–Phong). Glossy surfaces add a bright pinpoint where they mirror the light toward your eye. Blinn's trick is the half-vector — the unit vector halfway between the light and the view directions:
The highlight is brightest when
The exponent
Step 4 — add them. The final shaded colour is just the three terms summed, per light:
folding in the light and surface colours where they belong. Ambient keeps shadows readable, diffuse gives shape, specular gives the wet glint — three dot products, one lit surface.
The two reflection terms model two extremes. Pure Lambert (diffuse only)
is the matte world — chalk, paper, unpolished stone — where brightness is just the cosine
to the light and there's no glint at all. Blinn–Phong adds the specular
highlight on top, and by dialling
Its successor is physically based rendering (PBR). Instead of ad-hoc constants, PBR parameterizes a surface by roughness and metalness and insists the maths conserve energy (a surface can't reflect more light than it receives) and obey real microfacet statistics. The spirit is the same — sum the ways light leaves a surface — but the terms are grounded in physics rather than chosen to look right, which is why modern materials hold up under any lighting. Blinn–Phong is the honest ancestor every PBR shader still rhymes with.