Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit278f02fed5

README.md

proc.noise

Deterministic, portable value and gradient noise. Part of @builtin::systems.procgen.proc.

Built on the integer-lattice hash in proc.hash (latticeCell2/3 / unitCell2/3, the corner hashes of one cell, each bit-identical to the matching hashInts call): every lattice corner's random value or gradient is integer-derived, and the only continuous math is the quintic fade and linear interpolation. The result is bit-identical on native, WASM and Android, which is what makes a procedural texture reproducible everywhere.

  • value2(seed, x, y) / value3(seed, x, y, z): value noise in [0, 1).
  • gradient2(seed, x, y) / gradient3(seed, x, y, z): gradient (Perlin-style) noise in [-1, 1].
  • fbm2(seed, x, y, opts?): fractal Brownian motion over 2D noise, opts { octaves = 4, lacunarity = 2, gain = 0.5, kind = "value" | "gradient" }, normalized to the base noise's range.
local n = proc.noise.fbm2(7, x * 0.05, y * 0.05, { octaves = 5 })