Skip to content

perlin3D

perlin3D(x, y, z, seed?): number

Defined in: src/modules/noise/noise.ts:284

Perlin gradient noise, 3D — the canonical construction, and exactly 0 at every integer lattice point.

The gradients are the 12 canonical edge directions, normalized to unit length and then scaled by sqrt(2), which reproduces Perlin’s improved noise reference field magnitude (that implementation uses the same directions at length sqrt(2), unscaled). Its range is therefore approximately [-1, 1], like the reference’s: a lattice sweep reaches about 0.9 and dense sampling comes within a hair of 1. Two caveats come with the territory. A cell centre whose eight gradients all align lands one ulp outside (1.0000000000000002, about one cell in 70 000). And the construction’s true ceiling is sqrt(2) * 0.7328 = 1.0364, since an edge gradient cannot point along a cell diagonal — reachable only for a rare gradient configuration, not for anything a game samples.

number

number

number

number = 0

number