skip to content

Why do irradiance probes leak courtyard sunlight onto a character just inside a dim timber hall, and how do you stop it?

level: seniorimportance: should knowfreq 38%

answer

  1. the blend cannot see walls
  2. wall thinner than probe spacing
  3. probes buried in geometry
  4. distance moments per direction
  5. back-face weight, then renormalise

basics

~20 s

Probe interpolation weights neighbours by position alone, so with a wall thinner than the probe spacing, sunlit outdoor probes still light points inside. Per-probe visibility, back-face weights with a normal bias, relocating buried probes and per-room volumes largely stop it.

solid answer

~50 s

Trilinear interpolation in a probe grid weights the 8 surrounding probes only by position. Near a wall thinner than the spacing, some of those probes sit in the courtyard and see sunlight, and nothing tells the blend they are on the other side. Probes buried inside the wall make it worse: they capture the wall's inside or the outdoors. Diagnose it with a probe debug view and the per-probe weights at the glowing point. The fixes stack: move buried probes into open space or disable them; store per-probe **visibility**, the mean and mean-squared distance to geometry per direction, and cut a probe's weight when a variance test says it cannot see the shaded point; scale each weight by how squarely the probe lies in front of the surface (**back-face weighting**); offset the lookup point along the normal (**normal bias**); split interiors into their own volumes. Renormalise the weights afterwards.

code

pseudocode · 19 lines
pseudocode
// p: shaded position, n: unit normal, v: unit vector from p toward the camera
function sampleIrradiance(p, n, v, grid):
    q = p + n * normalBias + v * viewBias        // pull the lookup point off the surface
    corners, frac = grid.locate(q)               // the 8 corner probes and position in the cell
    sumWeight = 0
    sumSH = zeroSH()
    for each probe c in corners:
        w = trilinearWeight(frac, c)
        dirToProbe = normalize(c.position - q)
        w = w * (dot(dirToProbe, n) + 1) / 2     // back-face weighting
        d = length(q - c.position)
        mean, meanSq = c.visibility(-dirToProbe)  // distance moments toward q
        if d > mean:
            variance = max(meanSq - mean * mean, epsilon)
            w = w * variance / (variance + (d - mean) * (d - mean))
        w = max(w, tinyWeight)                   // keep the sum above zero
        sumSH = sumSH + c.sh * w
        sumWeight = sumWeight + w
    return evaluateIrradiance(sumSH / sumWeight, n)

go deeper

for a junior

Recall that probes are blended by position, so light from probes on the far side of a wall can reach a point that should be dark.

for a middle

Explain why trilinear weights ignore geometry, what probes buried in walls capture, and how back-face weighting and a normal bias change the blend.

for a senior

Diagnose from a debug view of probes and weights, then stack the fixes in order: relocate or disable buried probes, add back-face and visibility weights, bias the lookup, split volumes per room.

for a principal

Weigh the memory of visibility data, the authoring cost of per-room volumes and the risk of artists fighting leaks by hand when setting how the project's probes handle interiors.

## Symptom and cause The character steps through the doorway into a dim timber hall, but near the wall it is still lit as if it stood in the sunlit courtyard. That is **light leaking**: indirect light from one side of a wall appears on the other. Because the hall is lit only by bounced light, even a small share of an outdoor probe's sunlight dominates what the character receives. A probe grid blends the probes around the shaded point by **position alone**. Trilinear weights know where the point sits in its cell and nothing about what lies between the point and each probe. When the wall is thinner than the probe spacing, a cell can straddle it, with some corner probes in the bright courtyard and some in the hall. The blend mixes them, and sunlit coefficients leak in. The same holds for tetrahedral placement when a tetrahedron spans the wall. ## The ways a blend goes wrong 1. **Probes across the wall**: their data is valid, but they cannot see the shaded point. 2. **Probes buried in the wall**: they capture the inside of the wall or, through gaps, the outdoors. Their data is wrong for both rooms. 3. **Probes behind the surface**: a probe behind the wall the point lies on is the wrong probe even when nothing else intervenes. 4. **Per-object sampling**: if the whole character takes one sample at its bounds centre, its feet near the wall get whatever the centre sees. ## Diagnosing it - Turn on a probe debug view: draw each probe as a small sphere shaded by its own irradiance, and look for bright probes inside the hall or inside walls. - At the glowing point, display which probes are blended and their final weights. - Inspect suspicious probes' own data: a probe inside the hall that is bright from every direction is probably sitting inside geometry or seeing outdoors through a gap. - Change the probe spacing: if the glow band moves with it, interpolation across the wall is the cause. ## The fixes and what they cost | Fix | What it adds | What it does not solve | |---|---|---| | Relocate or disable buried probes | a placement pass that tests probes against geometry | probes legitimately on both sides of a thin wall | | Back-face weighting | one dot product per probe | probes in front of the surface but behind another wall | | Per-probe visibility | distance moments per direction per probe, more memory | very thin walls blur in low-resolution distance data | | Normal and view bias | a small offset of the lookup point | interpolation across the wall on its own | | Per-room volumes | authoring work and transitions between volumes | open spaces without clear rooms | **Back-face weighting** scales each probe's weight by a smooth function of `dot(dirToProbe, n)`, for example `(dot(dirToProbe, n) + 1) / 2`, so probes behind the surface count for little. **Per-probe visibility** stores, for each direction around a probe, the mean distance `mu` to the nearest geometry and the mean of the squared distance. At shading time, with `d` the distance from probe to point, compute the variance `sigma^2 = meanSq - mu^2`. If `d <= mu`, the probe sees the point; if `d > mu`, scale its weight by the Chebyshev bound `sigma^2 / (sigma^2 + (d - mu)^2)`, which falls quickly once the point lies beyond the geometry the probe sees. It is the statistical test variance shadow maps use, applied to probes, and it works whatever process filled them. **Normal bias** moves the lookup point slightly off the surface along the normal, and often toward the viewer, before weights are computed. Without it, a point on a wall sits at almost exactly the distance stored for that wall, and visibility tests flip between accepting and rejecting probes, which shows up as blotches. After every multiplication, **renormalise** the weights so they sum to one, and keep a small floor so the sum never reaches zero. ## Order of attack - First remove bad data: relocate or disable probes buried in geometry. - Then add cheap weighting: back-face weights and a bias. - Then add visibility data, if its memory fits the budget. - Then fix authoring: separate interior volumes, denser probes near thin walls, or walls modelled with real thickness.

  • Why does the character pop from bright to dark at the doorway even after the leak is fixed?
    If each object samples probes once, at its bounds centre, the whole character switches when that centre crosses into the hall's cells, and visibility weights make the switch sharper. Sampling per pixel or per vertex from the probe volume, or smoothing the object's sample over a short distance, spreads the change across the body, at the cost of more lookups.
  • Why do visibility weights reduce, but not cure, leaks through very thin walls?
    Visibility is stored at low resolution per probe, so a wall a few centimetres thick becomes a blurred step in the distance moments, and the variance test turns it into a soft falloff rather than a cut. Thin walls still need buried probes moved off them, denser probes nearby, or a separate interior volume.

  • Light leaking means the probes were baked with too few samples.
  • Trilinear interpolation already accounts for walls between probes.
  • Normal bias alone stops sunlight leaking through a wall.
  • Probes buried inside walls are harmless because their weights average out.
  • Raising probe density everywhere is the only real fix for leaks.