noise_value {ambient}R Documentation

Value noise generator

Description

Value noise is a simpler version of cubic noise that uses linear interpolation between neighboring grid points. This creates a more distinct smooth checkerboard pattern than cubic noise, where interpolation takes all the surrounding grid points into accout.

Usage

noise_value(
  dim,
  frequency = 0.01,
  interpolator = "quintic",
  fractal = "fbm",
  octaves = 3,
  lacunarity = 2,
  gain = 0.5,
  pertubation = "none",
  pertubation_amplitude = 1
)

gen_value(
  x,
  y = NULL,
  z = NULL,
  frequency = 1,
  seed = NULL,
  interpolator = "quintic",
  ...
)

Arguments

dim

The dimensions (height, width, (and depth)) 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 'linear', 'hermite', or 'quintic' (default), ranging from lowest to highest quality.

fractal

The fractal type to use. Either 'none', 'fbm' (default), 'billow', or 'rigid-multi'. It is suggested that you experiment with the different types to get a feel for how they behaves.

octaves

The number of noise layers used to create the fractal noise. Ignored if fractal = 'none'. Defaults to 3.

lacunarity

The frequency multiplier between successive noise layers when building fractal noise. Ignored if fractal = 'none'. Defaults to 2.

gain

The relative strength between successive noise layers when building fractal noise. Ignored if fractal = 'none'. Defaults to 0.5.

pertubation

The pertubation to use. Either 'none' (default), 'normal', or 'fractal'. Defines the displacement (warping) of the noise, with 'normal' giving a smooth warping and 'fractal' giving a more eratic warping.

pertubation_amplitude

The maximal pertubation distance from the origin. Ignored if pertubation = 'none'. Defaults to 1.

x, y, z

Coordinates to get noise value from

seed

The seed to use for the noise. If NULL a random seed will be used

...

ignored

Value

For noise_value() a matrix if length(dim) == 2 or an array if length(dim) == 3. For gen_value() a numeric vector matching the length of the input.

Examples

# Basic use
noise <- noise_value(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_value(grid$x, grid$y)
plot(grid, noise)


[Package ambient version 1.0.2 Index]