Renderer · function

nearestProbes

The eight probes around a world position, with trilinear weights that sum to one.

Explained in Hello world.

function nearestProbes(grid: ProbeGrid, x: number, y: number, z: number, out: ProbeBlend): ProbeBlend
import { nearestProbes } from '@driftengine/core';

Parameters

ParameterTypeDescription
gridProbeGrid
xnumber
ynumber
znumber
outProbeBlend

In depth

Clamped at the grid's edge rather than wrapped or faded. A point outside the grid takes the nearest probes at full weight, which is the same environment it would have had one step inside — the honest degradation, and the one a consumer can see coming. Fading to the hemispheric gradient at the boundary was the alternative and it reads worse: an object walking out of a grid would change what lights it while nothing about it changed.

Weights sum to one everywhere, including outside, which is what lets the shader multiply rather than normalise. In a grid one probe wide on an axis, that axis contributes a factor of one and the eight corners collapse onto fewer layers whose weights add — no branch, and a [1, 1, 1] grid returns the single probe at weight one with the other seven entries pointing at it too.