skip to content

How does the split-sum approximation make image-based specular lighting from one environment map cheap enough for real time, and what does it get wrong?

level: middleimportance: should knowfreq 45%

answer

  1. an integral too costly per pixel
  2. one sum becomes two
  3. mips indexed by roughness
  4. a small table of scale and bias
  5. assume the view equals the normal

basics

~20 s

It splits the specular lighting integral into two precomputed factors: an environment map prefiltered with the GGX lobe into roughness-indexed mips, and a 2D table over dot(n, v) and roughness that scales and biases F0. Assuming view equals normal loses stretched grazing reflections.

solid answer

~50 s

Specular image-based lighting needs, per pixel, the integral of incoming radiance times the BRDF over the hemisphere, which takes hundreds of samples. The split-sum approximation writes the importance-sampled sum as the product of two sums. The first averages the environment over the GGX lobe; it is precomputed per environment map assuming `n = v = r` and stored in the mips of a cube map so that mip level follows roughness. The second integrates the BRDF under a white environment; with Schlick's Fresnel it factors into `F0 * A + B`, where `A` and `B` depend only on `dot(n, v)` and roughness and fit a small 2D table shared by every environment. At run time a pixel does one cube-map fetch along the reflection vector, one table fetch and a multiply-add. The price: lighting is treated as constant across the lobe, and the isotropic lobe cannot stretch at grazing angles or along brushed grooves.

code

pseudocode · 7 lines
pseudocode
function specular_ibl(n, v, F0, roughness):
    NdotV = max(dot(n, v), 0.0001)
    r     = 2 * dot(n, v) * n - v                   // view direction mirrored about n
    mip   = roughness * (prefiltered_mip_count - 1)  // one common mapping
    env   = sample_cube_lod(prefiltered_env, r, mip)
    ab    = sample_2d(brdf_table, NdotV, roughness)  // ab.x = A, ab.y = B
    return env * (F0 * ab.x + ab.y)

go deeper

for a junior

Recall that environment reflections use a blurred copy of the sky chosen by roughness, plus a small table, instead of sampling the sky many times per pixel.

for a middle

Explain the two factors, why roughness maps to mip level, how Schlick's Fresnel turns the second factor into a scale and bias on F0, and the run-time fetches.

for a senior

Name the errors and their visible symptoms: round reflections at grazing angles, the off-specular peak, missing anisotropy, sun sparkles, and how renderers patch each.

for a principal

Decide where prefiltered environment lighting is accurate enough and where a project needs screen-space or traced reflections, measured against reference renders across its material set.

## The integral it replaces **Image-based lighting** (IBL) lights a surface with an environment map: a cube map of the radiance arriving from every direction, such as a captured or rendered sky. The specular part of the reflected light toward `v` is: `L_out(v) = integral over l of L_env(l) * f_spec(l, v) * dot(n, l)` Evaluating it with importance sampling, drawing `N` directions from the GGX lobe, gives `(1/N) * sum of L_env(l_k) * f_spec(l_k, v) * dot(n, l_k) / pdf(l_k)`. Good quality needs hundreds of samples per pixel, far too many for real time. ## Splitting the sum The **split-sum approximation** replaces the sum of products with a product of sums: 1. `(1/N) * sum of L_env(l_k)`, the environment averaged over the lobe's sample directions; 2. times `(1/N) * sum of f_spec(l_k, v) * dot(n, l_k) / pdf(l_k)`, the BRDF integrated against a white environment. The split is exact when the environment is constant across the lobe, and it is a good approximation when the lobe is narrow or the environment varies slowly over its width, and both factors can now be precomputed separately. ## Factor one: the prefiltered environment map - The lobe's shape depends on `v`, which is unknown in advance, so the prefilter **assumes `n = v = r`**, where `r` is the reflection direction. The lobe then depends only on roughness and is symmetric about `r`. - Each mip level of a cube map stores the environment convolved with the lobe for one roughness: mip 0 is the mirror-sharp map, higher mips hold blurrier results at lower resolution, which is all a blurrier result needs. The roughness-to-mip mapping is a renderer's choice, often linear in perceptual roughness. - Samples are often weighted by `dot(n, l)`, which looks closer to the reference. - A bright sun in the source map makes sparkling noise in rough mips; **filtered importance sampling** reads a lower mip of the source for samples with a low probability, since each one stands for a wider cone of directions. ## Factor two: the BRDF lookup table With Schlick's Fresnel, `F = F0 + (1 - F0) * Fc` where `Fc = (1 - dot(v, h))^5`, so `F = F0 * (1 - Fc) + Fc`. Substituting into the second sum splits it into `F0 * A + B`: - `A` integrates the BRDF without Fresnel, weighted by `(1 - Fc)`; - `B` integrates it weighted by `Fc`. Neither depends on `F0` or on the environment, only on `dot(n, v)` and roughness, so one small two-channel 2D table serves every material and every environment map in the game. ## Run-time cost Per pixel: compute the reflection vector, fetch the prefiltered cube map at a mip chosen from roughness, fetch the table at `(dot(n, v), roughness)`, and return `prefiltered * (F0 * A + B)`. Two texture fetches and a multiply-add replace hundreds of samples. ## One sky, three materials | Material | What the split-sum gets right | What it gets wrong | |---|---|---| | Brushed metal | coloured, blurred reflection of the sky at the right roughness | no streaks: the prefiltered lobe is isotropic | | Rough plastic | dim, broad highlight and a faint brightening at grazing angles | little: a wide lobe over a slowly varying sky suits the split | | Wet stone floor | sharp-ish reflection with correct Fresnel strength | reflections stay round where a real lobe at grazing view stretches toward the viewer | ## What it gets wrong - **No stretching at grazing angles**: a real GGX lobe seen at a shallow angle is elongated, which is why lights reflect as long streaks on wet ground; the `n = v = r` prefilter gives round blobs. - **Off-specular peak**: on rough surfaces the lobe's dominant direction tilts from `r` toward `n`; many renderers bend the lookup direction toward the normal as roughness rises. - **Anisotropy**: brushed surfaces need a bent or stretched lookup, because the prefiltered lobe has one width. - **Constant lighting across the lobe**: high-contrast environments such as a small bright sun break the split most for rough materials. - **No occlusion**: the environment map does not know what blocks the sky, so specular occlusion is a separate term. The diffuse part of image-based lighting uses a separate irradiance representation, and placing, blending and parallax-correcting many local environment maps is a different problem from prefiltering one.

  • Why does the prefiltered map need its own convolution per roughness instead of ordinary mipmaps?
    Ordinary mips average neighbouring texels with a box filter. A GGX lobe has a specific shape, with a bright core and a long tail, and its angular width changes nonlinearly with roughness. Convolving each mip with the actual lobe stores what a surface of that roughness really sees; lower resolution per mip is fine because the result is blurrier.
  • Why can a single BRDF lookup table serve every environment map and every material?
    The table integrates the BRDF against a uniform white environment, so it stores no lighting, and Schlick's form lets F0 be factored out as a scale and a bias. What remains depends only on dot(n, v) and roughness. Changing the sky or the material changes the prefiltered map or F0, never the table.
  • How do you stop a bright sun in the sky map from producing sparkling noise in rough mips?
    Use filtered importance sampling: for each sample, read a lower mip of the source cube map chosen from the sample's probability, so a low-probability sample averages the wider cone of directions it stands for. Clamping the source's brightness also hides the sparkles but removes energy from the reflection.

  • The BRDF lookup table must be rebuilt whenever the environment map changes.
  • Ordinary box-filtered mipmaps of the sky are an equivalent prefilter.
  • The split-sum is exact because the two integrals are independent.
  • F0 is baked into the prefiltered map, so each material needs its own copy.
  • The split-sum reproduces brushed metal's stretched highlights automatically.