noise_simplex {ambient} | R Documentation |
Simplex noise generator
Description
Simplex noise has been developed by Ken Perlin, the inventor of perlin noise, in order to address some of the shortcomings he saw in perlin noise. Compared to perlin noise, simplex noise has lower computational complexity, making it feasable for dimensions above 3 and has no directional artifacts.
Usage
noise_simplex(
dim,
frequency = 0.01,
interpolator = "quintic",
fractal = "fbm",
octaves = 3,
lacunarity = 2,
gain = 0.5,
pertubation = "none",
pertubation_amplitude = 1
)
gen_simplex(x, y = NULL, z = NULL, t = NULL, frequency = 1, seed = NULL, ...)
Arguments
dim |
The dimensions (height, width, (and depth, (and time))) of the noise to be generated. The length determines the dimensionality of the noise. |
frequency |
Determines the granularity of the features in the noise. |
interpolator |
How should values between sampled points be calculated?
Either |
fractal |
The fractal type to use. Either |
octaves |
The number of noise layers used to create the fractal noise.
Ignored if |
lacunarity |
The frequency multiplier between successive noise layers
when building fractal noise. Ignored if |
gain |
The relative strength between successive noise layers when
building fractal noise. Ignored if |
pertubation |
The pertubation to use. Either |
pertubation_amplitude |
The maximal pertubation distance from the
origin. Ignored if |
x , y , z , t |
Coordinates to get noise value from |
seed |
The seed to use for the noise. If |
... |
ignored |
Value
For noise_simplex()
a matrix if length(dim) == 2
or an array if
length(dim) >= 3
. For gen_simplex()
a numeric vector matching the length of
the input.
References
Ken Perlin, (2001) Noise hardware. In Real-Time Shading SIGGRAPH Course Notes, Olano M., (Ed.)
Examples
# Basic use
noise <- noise_simplex(c(100, 100))
plot(as.raster(normalise(noise)))
# Using the generator
grid <- long_grid(seq(1, 10, length.out = 1000), seq(1, 10, length.out = 1000))
grid$noise <- gen_simplex(grid$x, grid$y)
plot(grid, noise)