Reference / Math, color & random namespace Scalar Noise Fields 7 functions
datumhue.noise Perlin / simplex / cellular / fractal noise samplers.
Returns handles NoiseSampler
Functions 7
datumhue.noise. perlinfunction Create a Perlin-noise sampler.
Example
local hills = datumhue .noise.perlin ({ seed = 7 , frequency = 0.05 })
print (string.format ("%.3f" , hills:at (3.3 , 4.7 )))
local again = datumhue .noise.perlin ({ seed = 7 , frequency = 0.05 })
print (again:at (3.3 , 4.7 ) == hills:at (3.3 , 4.7 )) opts noise.BaseOptions options 2 keys
Key Type Default Description seed integer 0 Random seed for the noise field. frequency number 0.01 Spatial frequency of the noise.
datumhue.noise. simplexfunction Create a simplex-noise sampler.
opts noise.BaseOptions options 2 keys
Key Type Default Description seed integer 0 Random seed for the noise field. frequency number 0.01 Spatial frequency of the noise.
datumhue.noise. simplex_smoothfunction Create a smooth simplex-noise sampler.
opts noise.BaseOptions options 2 keys
Key Type Default Description seed integer 0 Random seed for the noise field. frequency number 0.01 Spatial frequency of the noise.
datumhue.noise. valuefunction Create a value-noise sampler.
datumhue.noise. value_cubicfunction Create a cubic value-noise sampler.
datumhue.noise. cellularfunction Create a cellular (Worley) noise sampler.
Example
local stones = datumhue .noise.cellular ({
seed = 1 ,
frequency = 0.1 ,
distance = "euclidean" ,
return_type = "cell_value" ,
jitter = 0.8 ,
})
print (string.format ("%.3f" , stones:at (3 , 4 )))
datumhue.noise. fbmfunction Create a fractal (fBm / ridged / ping-pong) sampler.
Example
local ridges = datumhue .noise.fbm ({
source = "simplex" ,
type = "ridged" ,
octaves = 5 ,
lacunarity = 2 ,
gain = 0.5 ,
frequency = 0.02 ,
seed = 3 ,
})
print (string.format ("%.3f" , ridges:at (10 , 20 ))) opts noise.FbmOptions options 9 keys
Key Type Default Description source "perlin" | "simplex" | "simplex_smooth" | "value" | "value_cubic" "perlin" Base noise kind the fractal layers. type "fbm" | "ridged" | "ping_pong" "fbm" Fractal combination mode. seed integer 0 Random seed for the noise field. frequency number 0.01 Spatial frequency of the base noise. octaves integer 4 Number of fractal layers summed. lacunarity number 2 Frequency multiplier between successive octaves. gain number 0.5 Amplitude multiplier between successive octaves. weighted_strength number 0 How much each octave's amplitude is weighted by the previous octave's value. ping_pong_strength number 2 Folding strength used by the ping-pong fractal mode.
Types 5
noise.BaseOptions options options 2 keys
Key Type Default Description seed integer 0 Random seed for the noise field. frequency number 0.01 Spatial frequency of the noise.
Used by: datumhue.noise.perlin , datumhue.noise.simplex , datumhue.noise.simplex_smooth , datumhue.noise.value , datumhue.noise.value_cubic
Extended by: noise.CellularOptions
noise.CellularDistance enum Value Description "euclidean""euclidean_sq""manhattan""hybrid"
Nested in: noise.CellularOptions
noise.CellularReturn enum Value Description "cell_value""distance""distance2""distance2_add""distance2_sub""distance2_mul""distance2_div"
Nested in: noise.CellularOptions
noise.FractalType enum Value Description "fbm""ridged""ping_pong"
Nested in: noise.FbmOptions
noise.NoiseSource enum Value Description "perlin""simplex""simplex_smooth""value""value_cubic"
Nested in: noise.FbmOptions