Entry 15 · Reference Objects
HDRI
Bracketing the environment so the bright parts are still numbers rather than white.
- Entry
- 15
- Section
- 03 Reference Objects
- By
- Marek Sowa
- Read
- 3 min
Why the sky cannot be a photograph
A standard photograph is a lie of convenience. The sensor clips: anything brighter than its ceiling becomes 255, or 1.0, or white — a number that means saturated, not bright. The sun in a JPEG is the same value as a slightly overexposed grey wall. That compression is invisible when you look at a picture, but ruinous when you use the picture as a light source, because the renderer needs to know that the sun is roughly fifty thousand times brighter than the shaded ground beneath it. Clip that ratio and the render is lit by a pale, directionless glow rather than a hard source throwing sharp shadows.
High dynamic range imaging solves this by bracketing: shooting the same scene at a sequence of exposures — perhaps five, seven or nine frames, one to three stops apart — and merging them into a single floating-point image. Each exposure captures a different slice of the luminance range. The brightest exposure holds clean shadow detail; the darkest holds a properly exposed disc of the sun. The merge algorithm discards the saturated pixels from each frame and borrows the valid ones from a neighbour, assembling a final image whose pixel values are physical irradiance, not an arbitrary display code. The resulting file — typically an EXR or a Radiance HDR — can carry values in the thousands or tens of thousands, depending on what was in front of the lens.
What the renderer actually does with it
An HDRI used as an environment map is projected onto an imaginary sphere surrounding the scene. When a ray escapes the geometry without hitting anything, it samples that sphere and returns a radiance value. A ray that hits the sun patch returns a very high number; a ray that hits open blue sky returns a moderate one; a ray that hits the shaded interior of a doorway returns a small one. Those differences drive the lighting. Shadows form because the sun patch is small and bright; soft fill arrives because the sky dome is large and dim. The ratio between them is preserved because neither was clipped.
The projection is almost always equirectangular — latitude and longitude mapped to a rectangle — because it tiles simply and distorts predictably. The chrome ball is an alternative capture method: a single photograph of a mirrored sphere contains a nearly 360-degree record of the environment, and two such photographs back-to-back cover the sphere. Unwrapping the ball optically distorts the image, but the data is there. For lighting purposes, distortion is irrelevant; what matters is that the sun patch is still a large, finite number and not white.
Sampling an environment map efficiently is its own problem. Naive uniform sampling wastes most of its rays on dim sky and dark ground. Importance sampling — building a probability distribution weighted by luminance — concentrates rays on the bright patches and returns the same integral estimate with far less noise. Without it, outdoor HDRI lighting is slow to converge; the sun is small and most rays miss it.
Getting the exposure right
The trap in HDRI capture is the bracket spacing. Too many stops between frames and you leave gaps — ranges where every frame is either clipped or underexposed, so the merge has nothing to borrow from. Too wide a gap and the overlap thins, the merge becomes noisy, and the high-frequency edges between bright and dark patches soften. Three stops between frames is a common middle ground for sky capture; one or two stops is safer when the scene contains a visible sun.
The absolute calibration matters too. A merged HDR image knows relative luminance — this pixel is a hundred times brighter than that one — but converting to physical units requires a grey reference at a known exposure. A grey ball or a calibrated grey card photographed in the same light, at a metered exposure, gives you the multiplier. Without it, the HDRI can still drive shadows and colour, but the overall intensity is a guess, and matching it to a measured practical on set becomes iteration rather than calculation.
The whole exercise is in service of one thing: keeping the arithmetic honest. The bright parts of the world are genuinely bright, and the render should know how bright.
The sun in a JPEG is the same value as a slightly overexposed grey wall.
More in Reference Objects
Every entry in this section is listed on the Reference Objects page, and all twenty-four sit in the full register.