Why do reflections from a cubemap reflection probe slide across a polished floor as the camera moves, and how does box parallax correction fix it?
answer
- a cube map knows directions only
- captured walls treated as infinitely far
- a box fitted to the room
- ray exits the box, then look up
basics
~20 sA cubemap reflection probe is read by direction alone, as if its contents were infinitely distant, so reflections of nearby walls drift with the viewer. Box parallax correction hits the reflected ray against a room-sized box and reads toward that point.
solid answer
~50 sA **reflection probe** is a cube map captured from one point, the capture centre. Sampling it with the reflection vector alone assumes every captured surface is infinitely far away, which is right for the sky and wrong for the walls of a hall: two floor points that reflect along the same direction get the same colour even though they should see different parts of the wall, so the reflection does not stay anchored as the camera moves. **Box parallax correction** gives the probe a proxy box fitted to the room. For each pixel, intersect the ray from the surface position along the reflection direction with that box, take the exit point, and sample the cube map with the direction from the capture centre to that point. It is exact only for surfaces lying on the box; columns standing inside the hall are reprojected onto the walls and stay distorted, which is where screen-space reflections help.
code
pseudocode · 9 lines// Assumes worldPos lies inside the proxy box and reflDir is normalised.
// Vector operations are per component.
function parallaxCorrectedDirection(worldPos, reflDir, boxMin, boxMax, captureCentre):
tA = (boxMax - worldPos) / reflDir // distance to each max plane along the ray
tB = (boxMin - worldPos) / reflDir // distance to each min plane along the ray
tFar = max(tA, tB) // per axis: the plane the ray exits through
tExit = min(tFar.x, tFar.y, tFar.z) // the first exit plane the ray reaches
hitPoint = worldPos + reflDir * tExit
return normalize(hitPoint - captureCentre)go deeper
Recall that a reflection probe is a cube map captured from one point and that shiny surfaces read it along the reflection direction.
Explain why a direction-only lookup assumes infinite distance, then walk through intersecting the reflected ray with the proxy box and sampling toward the hit point from the capture centre.
Show where the correction breaks: objects off the proxy, rooms that are not boxes, seams between overlapping probes, and how fade bands, priorities and a screen-space layer hide each failure.
Weigh probe count, capture resolution and update cost against memory and authoring time, and decide which surfaces rely on probes alone and which get screen-space reflections on top.
## What a reflection probe is A **reflection probe** is a cube map, six square images, rendered from one point in the level called the **capture centre**. Glossy and polished surfaces near the probe read it to get the light arriving from the mirror direction: compute the reflection vector `r = reflect(-v, n)` from the direction `v` toward the viewer and the surface normal `n`, and sample the cube map along `r`. Rough surfaces read a blurrier, pre-filtered level of the same cube map; how that filtering is computed belongs to physically based shading, not to probe placement. In the scenario, a polished marble floor in a timber hall should mirror the hall's walls and the columns standing in it. ## Why a direction-only lookup goes wrong indoors A cube map lookup takes a direction and nothing else. That is exact for light that is infinitely far away, such as the sky: every point in the level sees the same sky in the same direction. It is wrong for the walls of a room: - Two points on the floor that reflect along the same direction should see **different** parts of the wall, because they sit in different places; the lookup gives them the same texel. - As the camera moves, the reflection behaves like a distant backdrop that travels with the viewer instead of staying anchored to the wall it shows. Artists describe reflections that **slide** or **swim** across the floor. - The error grows as the shaded point moves away from the capture centre and as the reflected surface gets closer. Raising cube-map resolution does nothing for this, because the error is geometric, not a lack of detail. ## Box parallax correction, step by step The fix gives the probe a simple **proxy shape** that approximates the room, most often an axis-aligned box fitted to the walls, floor and ceiling. 1. Take the world position `p` of the shaded pixel and its reflection direction `r`. 2. Intersect the ray `p + t * r` with the proxy box. Because `p` is inside the box, find, per axis, the distance to the plane the ray is heading toward, and keep the smallest: that is where the ray leaves the box. 3. Compute the hit point `h = p + t_exit * r`. 4. Sample the cube map with `normalize(h - c)`, the direction from the capture centre `c` to the hit point, instead of `r`. Now the lookup depends on position as well as direction, and a reflected wall stays where the wall is. The cost is one ray-box intersection per pixel, a few dozen arithmetic operations. ## What the correction does not fix - **Objects inside the box** are wrong. The method assumes every captured surface lies on the box, so a column standing in the middle of the hall is treated as if painted on the far wall: it appears in the wrong place and at the wrong scale. - **Rooms that are not boxes**, such as an L-shaped hall or a vaulted ceiling, only fit approximately; some systems allow other convex proxies. - **Points outside the box** break the exit-point calculation, which assumes the ray starts inside, so the probe should not be applied there. - **Occlusion** is missing: the probe cannot know that something between the floor and the wall should block part of the reflection. These remaining errors are why polished surfaces often layer screen-space reflections on top and use the probe where those miss. ## Blending several probes A level holds many probes, and a pixel near a doorway lies within reach of more than one. | Concept | What it is | Typical choice | |---|---|---| | Influence volume | where the probe applies | a box or sphere with a fade band at its edges | | Proxy volume | the shape used for parallax correction | the room's walls; may differ from the influence volume | | Priority | which probe wins where they overlap | smaller interior probes beat large surrounding ones | - Each probe's weight comes from how deep the pixel sits inside its influence volume, falling to zero across the fade band. - Weights are normalised to sum to one, and the count per pixel is capped to keep the cost bounded. - Where no local probe reaches, a sky or level-wide probe fills in. - Many renderers cull probes into the same per-tile or per-cluster lists they build for lights. Putting fade bands where rooms meet, such as a doorway, hides the change from one probe to the next.
- The hall's columns stand in the middle of the room; why do they still look wrong in a parallax-corrected floor reflection?Parallax correction assumes every captured surface lies on the proxy box. A column inside the box is reprojected as if it were painted on the far wall, so its reflection is placed and scaled for the wall's distance, not its own. A better box cannot fix that: layer screen-space reflections on top for what is on screen, or accept the error on rough surfaces where blur hides it.
- Two overlapping reflection probes leave a visible seam on the floor; how do you blend them?Give each probe an influence volume with a fade band at its edges, compute each weight from where the pixel sits in that band, and normalise the weights to sum to one. Let a smaller interior probe take priority over a large surrounding one, cap the count per pixel, and fall back to a sky or level-wide probe where nothing local reaches. Put the fade band where the rooms meet, such as a doorway.
- Sampling a reflection probe by direction alone is fine for nearby walls.
- Parallax correction makes every object in the room reflect in the right place.
- A higher-resolution cube map stops reflections sliding across the floor.
- The proxy box and the influence volume must always be the same box.
- Overlapping probes should switch hard at their boundary instead of blending.