Skip to content

Documentation

Jordan Peck edited this page Jul 24, 2021 · 4 revisions

FastNoise Lite Documentation

float GetNoise(float x, float y)

float GetNoise(float x, float y, float z)

These are the main noise generating functions in FastNoise Lite, they generates coherent noise at the given x, y{, z} position. SetNoiseType() sets the noise algorithm used by these functions.

All noise outputs are bounded from -1.0 to 1.0.

Noise settings are initialised to sensible values so all noise types will function correctly without any setup

void SetSeed(int seed)

Default: 1337

Using different seeds will cause the noise output to change

void SetFrequency(float frequency)

Default: 0.01

Affects how coarse the patterns in the noise output are

void SetNoiseType(NoiseType noiseType)

Default: OpenSimplex2

Sets the type of noise returned by GetNoise()

Possible noise types:

  • OpenSimplex2
  • OpenSimplex2S
  • Cellular
  • Perlin
  • ValueCubic
  • Value

void SetRotationType3D(RotationType3D rotationType3D)

Default: None

Sets domain rotation type for 3D Noise and 3D DomainWarp. Can aid in reducing directional artifacts when sampling a 2D plane in 3D

  • None
  • ImproveXYPlanes
  • ImproveXZPlanes

Fractal

void SetFractalType(FractalType fractalType)

Default: None

Sets method for combining octaves into a fractal

Possible fractal types:

  • None
  • FBm
  • Rigid
  • PingPong
  • DomainWarpProgressive
  • DomainWarpIndependent

Note: DomainWarp... types only affects DomainWarp()

void SetFractalOctaves(int octaves)

Default: 3

The amount of noise layers used to create the fractal

void SetFractalLacunarity(float lacunarity)

Default: 2.0

The frequency multiplier between each octave

void SetFractalGain(float gain)

Default: 0.5

The relative strength of noise from each layer when compared to the last

void SetFractalWeightedStrength(float weightedStrength)

Default: 0.0

Sets octave weighting for all none DomainWarp fratal types

Higher weighting means higher octaves have less impact if lower octaves have a large impact

Note: Keep between 0...1 to maintain -1...1 output bounding

void SetFractalPingPongStrength(float pingPongStrength)

Default: 2.0

Sets strength of the fractal ping pong type

Cellular

void SetCellularDistanceFunction(CellularDistanceFunction cellularDistanceFunction)

Default: EuclideanSq

The distance function used to calculate the cell for a given point

Possible distance functions:

Euclidean EuclideanSq Manhattan Hybrid (blend of Euclidean and Manhattan to give curved cell boundaries)

void SetCellularReturnType(CellularReturnType cellularReturnType)

Default: Distance

What value does the cellular function return from its calculations

Possible return types:

CellValue Distance Distance2 Distance2Add Distance2Sub Distance2Mul Distance2Div

void SetCellularJitter(float cellularJitter)

Default: 1.0

Sets the maximum distance a cellular point can move from it's grid position

Note: Setting this higher than 1 will cause artifacts

Domain Warp

void DomainWarp(ref float x, ref float y)

void DomainWarp(ref float x, ref float y, ref float z)

Warps the position passed in with the x, y(, z) parameters

Uses the same seed and frequency settings as GetNoise()

Will also use fractal settings (excluding weighted) when fractal type is set to DomainWarp...

Example usage:

fnlWarp.DomainWarp(ref x, ref y, ref z);
noise = fnl.GetNoise(x, y, z);

It is advised to use a separate FastNoise Lite instance for domain warp because many of the settings used to adjust domain warp also affect normal noise generation

void SetDomainWarpType(DomainWarpType domainWarpType)

Default: OpenSimplex2

Sets the warp algorithm when using DomainWarp()

Possible types:

  • OpenSimplex2
  • OpenSimplex2Reduced
  • BasicGrid

void SetDomainWarpAmp(float domainWarpAmp)

Default: 1.0

Sets the maximum warp distance from original position