Builtin Library
- ..
- README.md1.3 KB
- module.wgsl11.8 KB
README.md
noise
Lattice noise over the shared hash of rand: zero_proc_value3(seed, p) in
[0, 1), zero_proc_gradient3(seed, p) in [-1, 1], zero_flow_worley(seed, p, jitter), zero_flow_simplex(seed, p), zero_flow_curl(seed, p, freq, amp),
and the octave sums zero_noise_fbm_value(seed, p, octaves) /
zero_noise_fbm_gradient(seed, p, octaves) (octave o drawn from seed + o, at
doubling frequency and halving weight, normalised by the weights). The plane
forms zero_proc_value2(seed, p), zero_proc_gradient2(seed, p),
zero_noise_fbm2(seed, p, octaves, lacunarity, gain, gradient),
zero_noise_fbm_value2 and zero_noise_fbm_gradient2 return the values of
proc.noise value2, gradient2 and fbm2. The space forms return the values
of proc.noise value3 and gradient3, and Worley, simplex and curl the values
the CPU forms of the flow pack's field.worley, field.simplex and
field.curl ops compute. Each agrees with its CPU form to f32 rounding of the
interpolation.
The nodes field.noise, field.worley, field.simplex, field.curl and
texture.noise call these functions through field.call, which reaches every function a
kernels/ shader module defines.
#include "@builtin::systems.procgen.kernels.noise"
fn height(p: vec3<f32>) -> f32 { return zero_noise_fbm_gradient(7u, p * 0.1, 4u); }