Skip to content
PerduGames edited this page Dec 19, 2017 · 1 revision

DOC

You can use the constants below, as the example:

var noise = GDFastNoiseSIMD.new()
noise.setNoiseType(noise.VALUE)
enum TypesNoise {
    VALUE,
    VALUE_FRACTAL,
    PERLIN,
    PERLIN_FRACTAL,
    SIMPLEX,
    SIMPLEX_FRACTAL,
    WHITENOISE,
    CELULAR,
    CUBIC,
    CUBIC_FRACTAL
};

enum TypesFractal {
    FBM,
    BILLOW,
    RIGIDMULTI
 };

enum DistanceFunctionCellular {
    EUCLIDEAN,
    MANHATTAN,
    NATURAL
};

enum ReturnTypeCellular {
    CELLVALUE,
    DISTANCE,
    DISTANCE2,
    DISTANCE2ADD,
    DISTANCE2SUB,
    DISTANCE2MUL,
    DISTANCE2DIV,
    NOISELOOKUP,
    DISTANCE2CAVE
};

enum TypePerturb {
    NONE,
    GRADIENT,
    GRADIENTFRACTAL,
    NORMALISE,
    GRADIENT_NORMALISE,
    GRADIENTFRACTAL_NORMALISE
};

-------------------GENERAL--------------------------------------------

Returns highest detected level of CPU support:

  • ARM NEON
  • AVX512
  • AVX2 & FMA3
  • SSE4.1
  • SSE2
  • Fallback, no SIMD support

getSIMDLevel()

Sets the SIMD level for newly created FastNoiseSIMD objects:

  • ARM NEON
  • AVX512
  • AVX2 & FMA3
  • SSE4.1
  • SSE2
  • Fallback, no SIMD support

-1: Auto-detect fastest supported (Default) Caution: Setting this manually can cause crashes on CPUs that do not support that level Caution: Changing this after creating FastNoiseSIMD objects has undefined behaviour

setSIMDLevel(int level)

Returns seed used for all noise types:

getSeed()

Sets seed used for all noise types: Default: 1337

setSeed(int seed)

Sets frequency for all noise types: Default: 0.01

setFrequency(float frequency)

Sets noise return type of (Get/Fill)NoiseSet(): Default: SimplexFractal Possible noise types:

  • VALUE
  • VALUE_FRACTAL
  • PERLIN
  • PERLIN_FRACTAL
  • SIMPLEX
  • SIMPLEX_FRACTAL
  • WHITENOISE
  • CELULAR
  • CUBIC
  • CUBIC_FRACTAL

setNoiseType(TypesNoise type)

Sets scaling factor for individual axis: Defaults: 1.0

setAxisScales(int xScale, int yScale, int zScale)

This function returns a one-dimensional float array with the values generated by the type of noise chosen in setNoiseType:

PoolRealArray getNoiseSet(int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier=1.0f)

The functions below will return a one-dimensional float array with the values generated by its specific type of noise:

PoolRealArray getWhiteNoiseSet(int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier=1.0f)

PoolRealArray getValueSet(int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier=1.0f)

PoolRealArray getValueFractalSet(int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier=1.0f)

PoolRealArray getPerlinSet(int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier=1.0f)

PoolRealArray getPerlinFractalSet(int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier=1.0f)

PoolRealArray getSimplexSet(int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier=1.0f)

PoolRealArray getSimplexFractalSet(int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier=1.0f)

PoolRealArray getCellularSet(int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier=1.0f)

PoolRealArray getCubicSet(int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier=1.0f)

PoolRealArray getCubicFractalSet(int xStart, int yStart, int zStart, int xSize, int ySize, int zSize, float scaleModifier=1.0f)

-------------------FRACTAL--------------------------------------------

Sets octave count for all fractal noise types: Default: 3

setFractalOctaves(int octaves)

Sets octave lacunarity for all fractal noise types: Default: 2.0

setFractalLacunarity(float lacunarity)

Sets octave gain for all fractal noise types: Default: 0.5

setFractalGain(float gain)

Sets method for combining octaves in all fractal noise types: Default: FBM

setFractalType(TypesFractal type)

-------------------CELLULAR--------------------------------------------

Sets return type from cellular noise calculations: Default: Distance

setCellularReturnType(ReturnTypeCellular type)

Sets distance function used in cellular noise calculations: Default: Euclidean

setCellularDistanceFunction(DistanceFunctionCellular type)

Sets the type of noise used if cellular return type is set the NoiseLookup: Default: Simplex

setCellularNoiseLookupType(TypesNoise type)

Sets relative frequency on the cellular noise lookup return type: Default: 0.2

setCellularNoiseLookupFrequency(float cellularNoiseLookupFrequency)

Sets the 2 distance indicies used for distance2 return types: Default: 0, 1 Note: index0 should be lower than index1 Both indicies must be >= 0, index1 must be < 4

setCellularDistance2Indicies(int cellularDistanceIndex0, int cellularDistanceIndex1)

Sets the maximum distance a cellular point can move from it's grid position: Setting this high will make artifacts more common Default: 0.45

setCellularJitter(float cellularJitter)

-------------------PERTURB--------------------------------------------

Enables position perturbing for all noise types: Default: None

setPerturbType(TypePerturb type)

Sets the maximum distance the input position can be perturbed: Default: 1.0

setPerturbAmp(float perturbAmp)

Set the relative frequency for the perturb gradient: Default: 0.5

setPerturbFrequency(float perturbFrequency)

Sets octave count for perturb fractal types: Default: 3

setPerturbFractalOctaves(int perturbOctaves)

Sets octave lacunarity for perturb fractal types: Default: 2.0

setPerturbFractalLacunarity(float perturbLacunarity)

Sets octave gain for perturb fractal types: Default: 0.5

setPerturbFractalGain(float perturbGain)

Sets the length for vectors after perturb normalising: Default: 1.0

setPerturbNormaliseLength(float perturbNormaliseLength)

------------------GENERATING-2D----------------------------------

To generate the 2D noise is quite simple although there are no functions for this. You can generate 2D noise by limiting the x or y to 1 as in the example below. Do not limit z, for performance reasons z is recommended to be multiple of 8.

extends Node

var noise = GDFastNoiseSIMD.new()

func _ready():
  # Choose a seed to generate the noise. The results will be different for different seeds.
  noise.setSeed(16549)
  # Choose the type of noise.
  noise.setNoiseType(noise.SIMPLEX)
  # 2D noise
  # Always returns a one-dimensional float array.
  # If the size of the Z dimension is a multiple of 8 there is a slight performance boost.
  var otherArrayFloat = noise.getNoiseSet(0, 0, 0, 1, 16, 16)
  print(otherArrayFloat)

Clone this wiki locally