API Reference
CoherentNoise.gen_image Method
gen_image(sampler::AbstractSampler; kwargs...)
Construct a 2-dimensional array of ColorTypes.RGB
values, suitable for writing to disk as an image file.
Arguments
sampler::AbstractSampler
: Any instance of a sampler. The sampler is sampled using each pixel coordinates as the X and Y input coordinates, and random Z and W coordinates for 3 and 4-dimensional samplers.w::Integer=1024
: The width in pixels of the image array to generate.h::Integer=1024
: The height in pixels of the image array to generate.xbounds::NTuple{2,Float64}=(-1.0, 1.0)
: The bounds along the X axis to sample coordinates from. This remaps pixel coordinates to this range to be used for the input coordinates to sample with.ybounds::NTuple{2,Float64}=(-1.0, 1.0)
: The bounds along the Y axis to sample coordinates from. This remaps pixel coordinates to this range to be used for the input coordinates to sample with.colorscheme=nothing
: AColorSchemes.ColorScheme
object to colorize the image with, ornothing
.
CoherentNoise.sample Function
sample(sampler::AbstractSampler, x::Real)
sample(sampler::AbstractSampler, x::Real, y::Real)
sample(sampler::AbstractSampler, x::Real, y::Real, z::Real)
sample(sampler::AbstractSampler, x::Real, y::Real, z::Real, w::Real)
Sample from sampler
with the supplied coordinates. The number of coordinates should match the dimensionality of the sampler type.
CoherentNoise.checkered_2d Method
checkered_2d(; seed=nothing)
Construct a sampler that outputs values in a checkerboard-like pattern when it is sampled from.
That is, output values will only ever be -1.0 or 1.0.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
CoherentNoise.constant_1d Method
constant_1d(; seed=nothing, value=0.0)
Construct a sampler that constantly outputs value
each time it is sampled from.
This is useful for debugging and applications where you need to combine a constant value.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.value
: A constant value to emit each time this sampler is sampled from.
CoherentNoise.cylinders_2d Method
cylinders_2d(; seed=nothing, frequency=1.0)
Construct a sampler that outputs values that form a pattern representing concentric cylinders when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.frequency
: The frequency of the signal, which controls how small or large the cylinders are.
CoherentNoise.spheres_3d Method
spheres_3d(; seed=nothing, frequency=1.0)
Construct a sampler that outputs values that form a pattern representing concentric spheres when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.frequency
: The frequency of the signal, which controls how small or large the spheres are.
CoherentNoise.opensimplex2_2d Method
opensimplex2_2d(; seed=nothing, orient=nothing)
Construct a sampler that outputs 2-dimensional OpenSimplex2 noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.orient
: Either the symbol:x
or the valuenothing
:nothing
: Use the standard orientation.:x
: The noise space will be re-oriented with the Y axis pointing down the main diagonal to improve visual isotropy.
CoherentNoise.opensimplex2_3d Method
opensimplex2_3d(; seed=nothing, smooth=false, orient=nothing)
Construct a sampler that outputs 3-dimensional OpenSimplex2 noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.smooth
: Specify whether to have continuous gradients. Simplex variants, even the original Simplex noise by Ken Perlin, overshoot the radial extent for the signal reconstruction kernel in order to improve the visual of the noise. Normally this is okay, especially if layering multiple octaves of the noise. However, in some applications, such as creating height or bump maps, this will produce discontinuities visually identified by jarring creases in the generated noise. This option changes the falloff in order to produce smooth continuous noise, however, the resulting noise may look quite different than the non-smooth option, depending on the Simplex variant. The default value isfalse
, in order to be true to the original implementation.orient
: Either the symbol:x
or the valuenothing
:nothing
: Use the standard orientation.:x
: The noise space will be re-oriented with the Y axis pointing down the main diagonal to improve visual isotropy.:xy
: Re-orient the noise space to have better visual isotropy in the XY plane.:xz
: Re-orient the noise space to have better visual isotropy in the XZ plane.
CoherentNoise.opensimplex2_4d Method
opensimplex2_4d(; seed=nothing, smooth=false, orient=nothing)
Construct a sampler that outputs 4-dimensional OpenSimplex2 noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.smooth
: Specify whether to have continuous gradients. Simplex variants, even the original Simplex noise by Ken Perlin, overshoot the radial extent for the signal reconstruction kernel in order to improve the visual of the noise. Normally this is okay, especially if layering multiple octaves of the noise. However, in some applications, such as creating height or bump maps, this will produce discontinuities visually identified by jarring creases in the generated noise. This option changes the falloff in order to produce smooth continuous noise, however, the resulting noise may look quite different than the non-smooth option, depending on the Simplex variant. The default value isfalse
, in order to be true to the original implementation.orient
: Either the symbol:x
or the valuenothing
:nothing
: Use the standard orientation.:x
: The noise space will be re-oriented with the Y axis pointing down the main diagonal to improve visual isotropy.:xy
: Re-orient the noise space to have better visual isotropy in the XY plane.:xz
: Re-orient the noise space to have better visual isotropy in the XZ plane.:xyz
: Re-orient the noise space to be better suited for time-varied animations, where the W axis is time.
CoherentNoise.opensimplex2s_2d Method
opensimplex2s_2d(; seed=nothing, orient=nothing)
Construct a sampler that outputs 2-dimensional OpenSimplex2S noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.orient
: Either the symbol:x
or the valuenothing
:nothing
: Use the standard orientation.:x
: The noise space will be re-oriented with the Y axis pointing down the main diagonal to improve visual isotropy.
CoherentNoise.opensimplex2s_3d Method
opensimplex2s_3d(; seed=nothing, smooth=false, orient=nothing)
Construct a sampler that outputs 3-dimensional OpenSimplex2S noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.smooth
: Specify whether to have continuous gradients. Simplex variants, even the original Simplex noise by Ken Perlin, overshoot the radial extent for the signal reconstruction kernel in order to improve the visual of the noise. Normally this is okay, especially if layering multiple octaves of the noise. However, in some applications, such as creating height or bump maps, this will produce discontinuities visually identified by jarring creases in the generated noise. This option changes the falloff in order to produce smooth continuous noise, however, the resulting noise may look quite different than the non-smooth option, depending on the Simplex variant. The default value isfalse
, in order to be true to the original implementation.orient
: Either the symbol:x
or the valuenothing
:nothing
: Use the standard orientation.:x
: The noise space will be re-oriented with the Y axis pointing down the main diagonal to improve visual isotropy.:xy
: Re-orient the noise space to have better visual isotropy in the XY plane.:xz
: Re-orient the noise space to have better visual isotropy in the XZ plane.
CoherentNoise.opensimplex2s_4d Method
opensimplex2s_4d(; seed=nothing, smooth=false, orient=nothing)
Construct a sampler that outputs 4-dimensional OpenSimplex2S noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, or
nothing
for non-deterministic results.
smooth
: Specify whether to have continuous gradients. Simplex variants, even the original Simplex noise by Ken Perlin, overshoot the radial extent for the signal reconstruction kernel in order to improve the visual of the noise. Normally this is okay, especially if layering multiple octaves of the noise. However, in some applications, such as creating height or bump maps, this will produce discontinuities visually identified by jarring creases in the generated noise. This option changes the falloff in order to produce smooth continuous noise, however, the resulting noise may look quite different than the non-smooth option, depending on the Simplex variant. The default value isfalse
, in order to be true to the original implementation.orient
: Either the symbol:x
or the valuenothing
:nothing
: Use the standard orientation.:x
: The noise space will be re-oriented with the Y axis pointing down the main diagonal to improve visual isotropy.:xy
: Re-orient the noise space to have better visual isotropy in the XY plane.:xz
: Re-orient the noise space to have better visual isotropy in the XZ plane.:xyz
: Re-orient the noise space to be better suited for time-varied animations, where the W axis is time.
CoherentNoise.opensimplex_2d Method
opensimplex_2d(; seed=nothing, smooth=false)
Construct a sampler that outputs 2-dimensional legacy OpenSimplex noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.smooth
: Specify whether to have continuous gradients. Simplex variants, even the original Simplex noise by Ken Perlin, overshoot the radial extent for the signal reconstruction kernel in order to improve the visual of the noise. Normally this is okay, especially if layering multiple octaves of the noise. However, in some applications, such as creating height or bump maps, this will produce discontinuities visually identified by jarring creases in the generated noise. This option changes the falloff in order to produce smooth continuous noise, however, the resulting noise may look quite different than the non-smooth option, depending on the Simplex variant. The default value isfalse
, in order to be true to the original implementation.
See also:
CoherentNoise.opensimplex_3d Method
opensimplex_3d(; seed=nothing, smooth=false)
Construct a sampler that outputs 3-dimensional legacy OpenSimplex noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.smooth
: Specify whether to have continuous gradients. Simplex variants, even the original Simplex noise by Ken Perlin, overshoot the radial extent for the signal reconstruction kernel in order to improve the visual of the noise. Normally this is okay, especially if layering multiple octaves of the noise. However, in some applications, such as creating height or bump maps, this will produce discontinuities visually identified by jarring creases in the generated noise. This option changes the falloff in order to produce smooth continuous noise, however, the resulting noise may look quite different than the non-smooth option, depending on the Simplex variant. The default value isfalse
, in order to be true to the original implementation.
See also:
CoherentNoise.opensimplex_4d Method
opensimplex_4d(; seed=nothing, smooth=false)
Construct a sampler that outputs 4-dimensional legacy OpenSimplex noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.smooth
: Specify whether to have continuous gradients. Simplex variants, even the original Simplex noise by Ken Perlin, overshoot the radial extent for the signal reconstruction kernel in order to improve the visual of the noise. Normally this is okay, especially if layering multiple octaves of the noise. However, in some applications, such as creating height or bump maps, this will produce discontinuities visually identified by jarring creases in the generated noise. This option changes the falloff in order to produce smooth continuous noise, however, the resulting noise may look quite different than the non-smooth option, depending on the Simplex variant. The default value isfalse
, in order to be true to the original implementation.
See also:
CoherentNoise.perlin_1d Method
perlin_1d(; seed=nothing)
perlin_improved_1d(; seed=nothing)
Construct a sampler that outputs 1-dimensional Perlin "Improved" noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
Notes:
perlin_improved_1d
is deprecated and will be removed in favor ofperlin_1d
in a future major version release.It is strongly recommended not to use this function for quality noise; the results will be very regular. There are many tricks people have done to combat this issue, but they all have trade-offs that are not worth the burden. The recommended alternatives are to either use
simplex_1d
, or useperlin_3d
with 2 of the coordinates fixed, and not close to0.0
,0.5
, or1.0
.
CoherentNoise.perlin_2d Method
perlin_2d(; seed=nothing)
perlin_improved_2d(; seed=nothing)
Construct a sampler that outputs 2-dimensional Perlin "Improved" noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
Notes:
perlin_improved_2d
is deprecated and will be removed in favor ofperlin_2d
in a future major version release.
CoherentNoise.perlin_3d Method
perlin_3d(; seed=nothing)
perlin_improved_3d(; seed=nothing)
Construct a sampler that outputs 3-dimensional Perlin "Improved" noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
Notes:
perlin_improved_3d
is deprecated and will be removed in favor ofperlin_3d
in a future major version release.
CoherentNoise.perlin_4d Method
perlin_4d(; seed=nothing)
perlin_improved_4d(; seed=nothing)
Construct a sampler that outputs 4-dimensional Perlin "Improved" noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
Notes:
perlin_improved_4d
is deprecated and will be removed in favor ofperlin_4d
in a future major version release.
CoherentNoise.simplex_1d Method
simplex_1d(; seed=nothing)
Construct a sampler that outputs 1-dimensional Perlin Simplex noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
CoherentNoise.simplex_2d Method
simplex_2d(; seed=nothing)
Construct a sampler that outputs 2-dimensional Perlin Simplex noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
CoherentNoise.simplex_3d Method
simplex_3d(; seed=nothing, smooth=false)
Construct a sampler that outputs 3-dimensional Perlin Simplex noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.smooth
: Specify whether to have continuous gradients. Simplex variants, even the original Simplex noise by Ken Perlin, overshoot the radial extent for the signal reconstruction kernel in order to improve the visual of the noise. Normally this is okay, especially if layering multiple octaves of the noise. However, in some applications, such as creating height or bump maps, this will produce discontinuities visually identified by jarring creases in the generated noise. This option changes the falloff in order to produce smooth continuous noise, however, the resulting noise may look quite different than the non-smooth option, depending on the Simplex variant. The default value isfalse
, in order to be true to the original implementation.
CoherentNoise.simplex_4d Method
simplex_4d(; seed=nothing, smooth=false)
Construct a sampler that outputs 4-dimensional Perlin Simplex noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.smooth
: Specify whether to have continuous gradients. Simplex variants, even the original Simplex noise by Ken Perlin, overshoot the radial extent for the signal reconstruction kernel in order to improve the visual of the noise. Normally this is okay, especially if layering multiple octaves of the noise. However, in some applications, such as creating height or bump maps, this will produce discontinuities visually identified by jarring creases in the generated noise. This option changes the falloff in order to produce smooth continuous noise, however, the resulting noise may look quite different than the non-smooth option, depending on the Simplex variant. The default value isfalse
, in order to be true to the original implementation.
CoherentNoise.value_1d Method
value_1d(; seed=nothing)
Construct a sampler that outputs 1-dimensonal value noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
CoherentNoise.value_2d Method
value_2d(; seed=nothing)
Construct a sampler that outputs 2-dimensonal value noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
CoherentNoise.value_3d Method
value_3d(; seed=nothing)
Construct a sampler that outputs 3-dimensonal value noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
CoherentNoise.value_4d Method
value_4d(; seed=nothing)
Construct a sampler that outputs 4-dimensonal value noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
CoherentNoise.value_cubic_1d Method
value_cubic_1d(; seed=nothing)
Construct a sampler that outputs 1-dimensonal value cubic noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
CoherentNoise.value_cubic_2d Method
value_cubic_2d(; seed=nothing)
Construct a sampler that outputs 2-dimensonal value cubic noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
CoherentNoise.value_cubic_3d Method
value_cubic_3d(; seed=nothing)
Construct a sampler that outputs 3-dimensonal value cubic noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
CoherentNoise.value_cubic_4d Method
value_cubic_4d(; seed=nothing)
Construct a sampler that outputs 4-dimensonal value cubic noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.
CoherentNoise.worley_1d Method
worley_1d(; seed=nothing, jitter=1.0, output=:f1)
Construct a sampler that outputs 1-dimensional Worley noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.jitter
: AReal
number between 0.0 and 1.0, with values closer to one randomly distributing cells away from their grid alignment.output
: One of the following symbols::f1
: Calculate the distance to the nearest cell as the output.:f2
: Calculate the distance to the second-nearest cell as the output.:+
: Calculate:f1
+:f2
as the output.:-
: Calculate:f2
-:f1
as the output.:*
: Calculate:f1
*:f2
as the output.:/
: Calculate:f1
/:f2
as the output.:value
: Use the cell's hash value as the output.
CoherentNoise.worley_2d Method
worley_2d(; seed=nothing, jitter=1.0, output=:f1, metric=:euclidean)
Construct a sampler that outputs 2-dimensional Worley noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.jitter
: AReal
number between 0.0 and 1.0, with values closer to one randomly distributing cells away from their grid alignment.output
: One of the following symbols::f1
: Calculate the distance to the nearest cell as the output.:f2
: Calculate the distance to the second-nearest cell as the output.:+
: Calculate:f1
+:f2
as the output.:-
: Calculate:f2
-:f1
as the output.:*
: Calculate:f1
*:f2
as the output.:/
: Calculate:f1
/:f2
as the output.:value
: Use the cell's hash value as the output.
metric
: One of the following symbols::manhattan
: Use the Manhattan distance to the next cell (Minkowski metric). :euclidean
: Use the Euclidean distance to the next cell (Minkowski metric). :euclidean²
: Same as:euclidean
but slighter faster due to no. :minkowski4
: Use Minkowski metric withfor the distance to the next cell. :chebyshev
: Use the Chebyshev distance to the next cell (Minkowski metric).
CoherentNoise.worley_3d Method
worley_3d(; seed=nothing, jitter=1.0, output=:f1, metric=:euclidean)
Construct a sampler that outputs 3-dimensional Worley noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.jitter
: AReal
number between 0.0 and 1.0, with values closer to one randomly distributing cells away from their grid alignment.output
: One of the following symbols::f1
: Calculate the distance to the nearest cell as the output.:f2
: Calculate the distance to the second-nearest cell as the output.:+
: Calculate:f1
+:f2
as the output.:-
: Calculate:f2
-:f1
as the output.:*
: Calculate:f1
*:f2
as the output.:/
: Calculate:f1
/:f2
as the output.:value
: Use the cell's hash value as the output.
metric
: One of the following symbols::manhattan
: Use the Manhattan distance to the next cell (Minkowski metric). :euclidean
: Use the Euclidean distance to the next cell (Minkowski metric). :euclidean²
: Same as:euclidean
but slighter faster due to no. :minkowski4
: Use Minkowski metric withfor the distance to the next cell. :chebyshev
: Use the Chebyshev distance to the next cell (Minkowski metric).
CoherentNoise.worley_4d Method
worley_4d(; seed=nothing, jitter=1.0, output=:f1, metric=:euclidean)
Construct a sampler that outputs 4-dimensional Worley noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.jitter
: AReal
number between 0.0 and 1.0, with values closer to one randomly distributing cells away from their grid alignment.output
: One of the following symbols::f1
: Calculate the distance to the nearest cell as the output.:f2
: Calculate the distance to the second-nearest cell as the output.:+
: Calculate:f1
+:f2
as the output.:-
: Calculate:f2
-:f1
as the output.:*
: Calculate:f1
*:f2
as the output.:/
: Calculate:f1
/:f2
as the output.:value
: Use the cell's hash value as the output.
metric
: One of the following symbols::manhattan
: Use the Manhattan distance to the next cell (Minkowski metric). :euclidean
: Use the Euclidean distance to the next cell (Minkowski metric). :euclidean²
: Same as:euclidean
but slighter faster due to no. :minkowski4
: Use Minkowski metric withfor the distance to the next cell. :chebyshev
: Use the Chebyshev distance to the next cell (Minkowski metric).
CoherentNoise.billow_fractal_1d Method
billow_fractal_1d(; kwargs...)
Construct a sampler that outputs a 1-dimensional billow fractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=simplex_1d()
: A 1-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.billow_fractal_2d Method
billow_fractal_2d(; kwargs...)
Construct a sampler that outputs a 2-dimensional billow fractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_2d()
: A 2-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.billow_fractal_3d Method
billow_fractal_3d(; kwargs...)
Construct a sampler that outputs a 3-dimensional billow fractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_3d()
: A 3-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.billow_fractal_4d Method
billow_fractal_4d(; kwargs...)
Construct a sampler that outputs a 4-dimensional billow fractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_4d()
: A 4-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.fbm_fractal_1d Method
fbm_fractal_1d(; kwargs...)
Construct a sampler that outputs a 1-dimensional fractional Brownian motion fractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=simplex_1d()
: A 1-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.fbm_fractal_2d Method
fbm_fractal_2d(; kwargs...)
Construct a sampler that outputs a 2-dimensional fractional Brownian motion fractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2_2d()
: A 2-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.fbm_fractal_3d Method
fbm_fractal_3d(; kwargs...)
Construct a sampler that outputs a 3-dimensional fractional Brownian motion fractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2_3d()
: A 3-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.fbm_fractal_4d Method
fbm_fractal_4d(; kwargs...)
Construct a sampler that outputs a 4-dimensional fractional Brownian motion fractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2_4d()
: A 4-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.hybrid_fractal_1d Method
hybrid_fractal_1d(; kwargs...)
Construct a sampler that outputs a 1-dimensional hybrid multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=simplex_1d()
: A 1-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.25
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.hybrid_fractal_2d Method
hybrid_fractal_2d(; kwargs...)
Construct a sampler that outputs a 2-dimensional hybrid multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_2d()
: A 2-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.25
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.hybrid_fractal_3d Method
hybrid_fractal_3d(; kwargs...)
Construct a sampler that outputs a 3-dimensional hybrid multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_3d()
: A 3-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.25
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.hybrid_fractal_4d Method
hybrid_fractal_4d(; kwargs...)
Construct a sampler that outputs a 4-dimensional hybrid multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_4d()
: A 4-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.25
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.multi_fractal_1d Method
multi_fractal_1d(; kwargs...)
Construct a sampler that outputs a 1-dimensional multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=simplex_1d()
: A 1-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.multi_fractal_2d Method
multi_fractal_2d(; kwargs...)
Construct a sampler that outputs a 2-dimensional multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_2d()
: A 2-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.multi_fractal_3d Method
multi_fractal_3d(; kwargs...)
Construct a sampler that outputs a 3-dimensional multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_3d()
: A 3-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.multi_fractal_4d Method
multi_fractal_4d(; kwargs...)
Construct a sampler that outputs a 4-dimensional multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_4d()
: A 4-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=0.5
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.
CoherentNoise.ridged_fractal_1d Method
ridged_fractal_1d(; kwargs...)
Construct a sampler that outputs a 1-dimensional ridged multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=simplex_1d()
: A 1-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=1.0
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.attenuation=2.0
: The attenuation to apply to the weight of each octave.
CoherentNoise.ridged_fractal_2d Method
ridged_fractal_2d(; kwargs...)
Construct a sampler that outputs a 2-dimensional ridged multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_2d()
: A 2-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=1.0
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.attenuation=2.0
: The attenuation to apply to the weight of each octave.
CoherentNoise.ridged_fractal_3d Method
ridged_fractal_3d(; kwargs...)
Construct a sampler that outputs a 3-dimensional ridged multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_3d()
: A 3-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=1.0
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.attenuation=2.0
: The attenuation to apply to the weight of each octave.
CoherentNoise.ridged_fractal_4d Method
ridged_fractal_4d(; kwargs...)
Construct a sampler that outputs a 4-dimensional ridged multifractal noise when it is sampled from.
Arguments
seed
: An unsigned integer used to seed the random number generator for this sampler, ornothing
for non-deterministic results.source::AbstractSampler=opensimplex2s_4d()
: A 4-dimensional sampler instance to use as the source of the fractal.octaves=4
: An integer between 1 and 32, denoting the number of octaves to apply.frequency=1.0
: The frequency of the first octave's signal.lacunarity=2.0
: A multiplier that determines how quickly the frequency increases for successive octaves.persistence=1.0
: A multiplier that determines how quickly the amplitude diminishes for successive octaves.attenuation=2.0
: The attenuation to apply to the weight of each octave.
Base.:* Method
*(x::AbstractSampler, y::AbstractSampler)
Construct a modifier sampler that outputs the product of the outputs samplers x
and y
.
Base.:* Method
*(x::AbstractSampler, y::Real)
Construct a modifier sampler that outputs the product of the output of sampler x
by the scalar y
.
Base.:+ Method
+(x::AbstractSampler, y::AbstractSampler)
Construct a modifier sampler that outputs the sum of the outputs of samplers x
and y
.
Base.:+ Method
+(x::AbstractSampler, y::Real)
Construct a modifier sampler that outputs the sum of the output of sampler x
and the scalar y
.
Base.:- Method
-(x::AbstractSampler, y::AbstractSampler)
Construct a modifier sampler that outputs the difference of the outputs of samplers x
and y
.
Base.:- Method
-(x::AbstractSampler, y::Real)
Construct a modifier sampler that outputs the difference of the output of sampler x
and the scalar y
.
Base.:- Method
-(x::AbstractSampler)
Construct a modifier sampler that outputs the negated output of sampler x
.
Base.:/ Method
/(x::AbstractSampler, y::AbstractSampler)
Construct a modifier sampler that performs division of the output of sampler x
by the output of sampler y
.
Base.:/ Method
/(x::AbstractSampler, y::Real)
Construct a modifier sampler that performs division of the output of sampler x
by the scalar y
.
Base.:^ Method
^(x::AbstractSampler, y::Real)
Construct a modifier sampler that raises the output of sampler x
to the power of the scalar y
.
Base.abs Method
abs(x::AbstractSampler)
Construct a modifier sampler that outputs the absolute value of its source when it is sampled from.
Base.clamp Method
clamp(x::AbstractSampler, lo::AbstractSampler, hi::AbstractSampler)
Construct a modifier sampler that clamps the output of sampler x
to be within the range of of output values from samplers lo
and hi
.
Base.clamp Method
clamp(x::AbstractSampler, lo=-1.0, hi=1.0)
Construct a modifier sampler that clamps the output of sampler x
to be within the range of of the scalars lo
and hi
.
Base.copysign Method
copysign(x::AbstractSampler, y::AbstractSampler)
Construct a modifier sampler that outputs the value of sampling from x
with the sign copied from the value of sampling from y
.
Base.max Method
max(x::AbstractSampler, y::AbstractSampler)
Construct a modifier sampler that outputs the maximum value of the outputs of sampling from samplers x
and y
.
Base.min Method
min(x::AbstractSampler, y::AbstractSampler)
Construct a modifier sampler that outputs the minimum value of the outputs of sampling from samplers x
and y
.
Base.muladd Method
muladd(x::AbstractSampler, strength=1.0, bias=0.0)
Construct a modifier sampler that performs multiplies the output of sampler x
by the scalar strength
, followed by adding the scalar bias
. sampler y
.
CoherentNoise.cache Method
cache(x::AbstractSampler)
Construct a modifier sampler that caches the set of the input coordinates and their corresponding output value of its source sampler. If the input coordinates differs from the previously cached output, the cache is invalidated and the new output is cached.
Caching is useful if a sampler is used as a source for multiple modifiers. Without caching, the duplicated input sources would redundantly compute the same outputs, which would be expensive, especially if long pipelines share a long subgraph.
CoherentNoise.curve Method
curve(x::AbstractSampler, points::Vector{Pair{Float64,Float64}})
Construct a modifier sampler that outputs the result of sampling from x
after remapping its output to an arbitrary curve.
The curve is defined by a Vector
of Pair
s given by points
. Each pair of points represents an input and output number. The curve is a cubic spline, and so points
must contain a list of four point pairs at a minimum. Additionally, no two point pairs can contain the same input point value.
When sampling from sampler x
, the output is evaluated using the curve data, and maps it to a new output value.
CoherentNoise.mix Method
mix(x::AbstractSampler, y::AbstractSampler, t::AbstractSampler)
Construct a modifier sampler that outputs the result of linearly interpolating the output of samplers x
and y
by the output of sampler t
.
CoherentNoise.mix Method
mix(x::AbstractSampler, y::AbstractSampler, t::Real)
Construct a modifier sampler that outputs the result of linearly interpolating the output of samplers x
and y
by the scalar t
.
CoherentNoise.rotate Method
rotate(source::AbstractSampler; x=0.0, y=0.0, z=0.0)
Construct a modifier sampler that rotates the input coordinates of sampler source
around the origin before sampling from it.
The coordinate system is assumed to be left-handed.
The angle of rotation is specified in radians for the corresponding axis given by x
, y
, and z
.
CoherentNoise.scale Method
scale(source::AbstractSampler, scale::Real)
Construct a modifier sampler that uniformly scales the input coordinates of sampler source
by the scalar scale
before sampling from it.
CoherentNoise.scale Method
scale(source::AbstractSampler; x=1.0, y=1.0, z=1.0, w=1.0)
Construct a modifier sampler that scales the input coordinates of sampler source
before sampling from it.
Each axis can be scaled independently with x
, y
, z
, or w
.
CoherentNoise.select Method
select(x::AbstractSampler, y::AbstractSampler; kwargs...)
Construct a modifier sampler that outputs either the out of sampler x
or y
, depending on the output of sampler z
.
If the output of sampler z
is within the range denoted by min
and max
, the output of sampler y
is chosen. If the output of sampler z
is outside of this range, the output of sampler x
is chosen.
Arguments
min
: A real number between -1.0 and 1.0 defining the lower bound of the selection range.max
: A real number between -1.0 and 1.0 defining the upper bound of the selection range.falloff
: A real number between 0.0 and 1.0 specifying the smoothness of the transition.
CoherentNoise.terrace Method
terrace(x::AbstractSampler, points::Vector{Pair{Float64,Float64}}; invert=false)
Construct a modifier sampler that outputs the result of sampling from x
after remapping its output to a terrace-forming curve.
The curve is defined by a Vector
of Float64
s given by points
. Each point represents an input and output number.
When sampling from sampler x
, the output is evaluated using the curve data, and maps it to a new output value.
Arguments
invert
: Specify whether the curve is inverted between control points.
CoherentNoise.translate Method
translate(source::AbstractSampler; x=0.0, y=0.0, z=0.0, w=0.0)
Construct a modifier sampler that translates the input coordinates of sampler source
along a specified vector, with a direction and magnitude given by the coordinates x
, y
, z
, and w
.
CoherentNoise.turbulence Method
turbulence(s1::AbstractSampler; s2::AbstractSampler; kwargs...)
Construct a modifier sampler that displaces the input coordinates of sampler s1
by the output of sampler s2
with a fractional Brownian motion fractal applied to it.
Sampler s2
's input coordinates are randomly generated using the seed of sampler s1
.
Arguments
frequency=1.0
: The frequency of the fractal signal to apply to samplers2
.roughness=3
: The number of octaves of the fractal to apply to samplers2
.power=1.0
: A scaling factor that is applied to the displaced result before sampling from samplers1
.
CoherentNoise.warp Method
warp(source::AbstractSampler; kwargs...)
Construct a modifier sampler that performs domain warping of the sampler source
before sampling from it.
Domain warping feeds the output of other samplers to the input of a sampler. For this modifier, each input coordinate can specify a different sampler to warp with.
If a sampler is not supplied for x
, y
, z
, or w
, a sampler that outputs a constant zero will be used instead.
Arguments
x::AbstractSampler=constant_1d()
: A sampler to warp the X axis by.y::AbstractSampler=constant_1d()
: A sampler to warp the Y axis by.z::AbstractSampler=constant_1d()
: A sampler to warp the Z axis by.w::AbstractSampler=constant_1d()
: A sampler to warp the W axis by.