Expand description
Coherent noise functions: Perlin, simplex, fractal Brownian motion.
Unlike hash functions (which produce uncorrelated “white noise”), coherent noise produces values that vary smoothly — nearby inputs yield similar outputs. This is essential for generating realistic time-series data, spatial fields, and any workload where adjacent coordinates should have correlated values.
The permutation table is built at init time from a seed. The noise evaluation runs at cycle time.
Inputs are u64 coordinates mapped to a float domain via scaling. Outputs are f64 in [-1, 1] (raw noise) or [0, 1] (normalized).
Structs§
- Fractal
Noise1d - 1D fractal Brownian motion: layered Perlin noise with decreasing amplitude at each octave. Produces rich, natural-looking signals. Output is f64, roughly in [-1, 1]. Lacunarity is fixed at 2.0 and persistence at 0.5 (standard FBM parameters).
- Fractal
Noise2d - 2D fractal Brownian motion: layered Perlin noise in 2D. Produces terrain-like spatial variation. Lacunarity is fixed at 2.0 and persistence at 0.5 (standard FBM parameters).
- Perlin1d
- 1D Perlin noise.
- Perlin2d
- The
perlin_2dnode. - Perm
Table - A permutation table for noise functions. Built from a seed at init time, immutable thereafter. The table is doubled (512 entries) to avoid modular indexing.
- Simplex2d
- The
simplex_2dnode.
Functions§
- fbm_1d
- 1D fractal Brownian motion:
octaveslayers of Perlin noise, each at twice the frequency and half the amplitude of the last. - fbm_2d
- 2D fractal Brownian motion over Perlin noise, as
fbm_1d. - perlin_
1d_ algo - Evaluate 1D Perlin noise at a given point.
- perlin_
2d_ algo - Evaluate 2D Perlin noise at a given point.
- simplex_
2d_ algo - Evaluate 2D simplex noise at a given point.