Table of Contents

Class NormalizedSimplexNoise

Namespace
Vintagestory.API.MathTools
Assembly
VintagestoryAPI.dll

It's generally pretty hard to get a neatly normalized coherent noise function due to the way perlin/open simplex works (gauss curve) and how random numbers are generated. So instead of trying to find the perfect normalization factor and instead try to perform some approximate normalization this class allows a small overflow and brings it down very close to the [0, 1] range using tanh().

Returns values in a range of [0..1]

public class NormalizedSimplexNoise
Inheritance
NormalizedSimplexNoise
Inherited Members
Extension Methods

Constructors

NormalizedSimplexNoise(double[], double[], long)

public NormalizedSimplexNoise(double[] inputAmplitudes, double[] frequencies, long seed)

Parameters

inputAmplitudes double[]
frequencies double[]
seed long

Fields

frequencies

public double[] frequencies

Field Value

double[]

inputAmplitudes

public double[] inputAmplitudes

Field Value

double[]

octaves

public SimplexNoiseOctave[] octaves

Field Value

SimplexNoiseOctave[]

scaledAmplitudes2D

public double[] scaledAmplitudes2D

Field Value

double[]

scaledAmplitudes3D

public double[] scaledAmplitudes3D

Field Value

double[]

Methods

ForColumn(double, double[], double[], double, double)

public NormalizedSimplexNoise.ColumnNoise ForColumn(double relativeYFrequency, double[] amplitudes, double[] thresholds, double noiseX, double noiseZ)

Parameters

relativeYFrequency double
amplitudes double[]
thresholds double[]
noiseX double
noiseZ double

Returns

NormalizedSimplexNoise.ColumnNoise

FromDefaultOctaves(int, double, double, long)

Generates the octaves and frequencies using following formulas freq[i] = baseFrequency * 2^i amp[i] = persistence^i

public static NormalizedSimplexNoise FromDefaultOctaves(int quantityOctaves, double baseFrequency, double persistence, long seed)

Parameters

quantityOctaves int
baseFrequency double
persistence double
seed long

Returns

NormalizedSimplexNoise

Noise(double, double)

2d noise

public virtual double Noise(double x, double y)

Parameters

x double
y double

Returns

double

Noise(double, double, double)

3d noise

public virtual double Noise(double x, double y, double z)

Parameters

x double
y double
z double

Returns

double

Noise(double, double, double, double[])

3d Noise using custom amplitudes

public virtual double Noise(double x, double y, double z, double[] amplitudes)

Parameters

x double
y double
z double
amplitudes double[]

Returns

double

Noise(double, double, double, double[], double[])

public double Noise(double x, double y, double z, double[] amplitudes, double[] thresholds)

Parameters

x double
y double
z double
amplitudes double[]
thresholds double[]

Returns

double

Noise(double, double, double[])

public double Noise(double x, double y, double[] thresholds)

Parameters

x double
y double
thresholds double[]

Returns

double

NoiseValueCurve(double)

public static double NoiseValueCurve(double value)

Parameters

value double

Returns

double

NoiseValueCurveInverse(double)

public static double NoiseValueCurveInverse(double value)

Parameters

value double

Returns

double