Herteby/simplex-noise/1.2.2

Simplex

Permutation tables

type alias PermutationTable =
{ perm : Array Int
, permMod12 : Array Int
}

A Permutation table is a big list of random values needed for noise generation.

permutationTableGenerator : Generator PermutationTable

Generator of random permutation tables.

permutationTableFromInt : Int -> PermutationTable

Generate a PermutationTable using an Int as a seed

Simplex noise

noise2d : PermutationTable -> Float -> Float -> Float

Generates a noise value between -1 and 1 based on the given x and y value and a seeded permutation table.

noise3d : PermutationTable -> Float -> Float -> Float -> Float

Generates a noise value between -1 and 1 based on the given x, y and z value and a seeded permutation table.

noise4d : PermutationTable -> Float -> Float -> Float -> Float -> Float

Generates a noise value between -1 and 1 based on the given x, y, z and w value and a seeded permutation table.

Fractal noise

type alias FractalConfig =
{ steps : Int
, stepSize : Float
, persistence : Float
, scale : Float
}

Options for fractal noise generation

  • steps: The number of noise layers to combine. The more layers, the larger the features will be. Increases processing time.
  • stepSize: A value of 2 means that each noise layer is twice as large as the previous one.
  • persistence: A persistence greater than 1 means that the larger noise layers are weighed more more heavily.
  • scale: This scales all the noise, making it smoother/blurrier

Use this previewer to experiment with different options: https://herteby.github.io/simplex-noise/preview/

fractal2d : FractalConfig -> PermutationTable -> Float -> Float -> Float

2-Dimensional fractal noise

fractal3d : FractalConfig -> PermutationTable -> Float -> Float -> Float -> Float

3-Dimensional fractal noise

FractalConfig
-> PermutationTable
-> Float
-> Float
-> Float
-> Float
-> Float

4-Dimensional fractal noise