Class
- Namespace
- CoreFramework.Random
Provides stateless, deterministic 32-bit noise using integer indexing and optional seeding.
[BurstCompile]
public static class SquirrelNoise32Bit
- Inheritance
-
object
Fields
DefaultNoiseType
Represents the default noise type used in the SquirrelNoise32Bit class for noise generation methods.
The default value is NoiseType.MangledBitsBalancedMix, which provides balanced mixing of bits for noise generation.
private const NoiseType DefaultNoiseType = MangledBitsBalancedMix
Field Value
Methods
Billow(float3, uint, int, float, float, float, float, bool, NoiseType)
Generates a 3D Billow noise value by using a series of octaves and applying transformations to create a smooth, continuous noise pattern. This function allows customization of frequency, amplitude, lacunarity, gain, and noise type, and can optionally normalize the result.
public static float Billow(float3 p, uint seed = 0, int octaves = 5, float frequency = 1, float amplitude = 1, float lacunarity = 2, float gain = 0.5, bool normalize = true, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The 3D position input as a float3 vector.
seeduintAn optional seed value to initialize noise generation. Default is 0.
octavesintThe number of noise layers or octaves to combine. Default is 5.
frequencyfloatThe base frequency of the noise. Default is 1.
amplitudefloatThe base amplitude of the noise. Default is 1.
lacunarityfloatThe frequency multiplier for each successive octave. Default is 2.
gainfloatThe amplitude multiplier for each successive octave. Default is 0.5.
normalizeboolDetermines whether to normalize the output to the range [-1, 1]. Default is true.
typeNoiseTypeThe type of noise algorithm to use. Default is MangledBitsBalancedMix.
Returns
- float
A float value representing the computed Billow noise, optionally normalized to the range [-1, 1].
Cellular2D(float2, uint, float, float, CellularDistance, NoiseType)
Computes 2D cellular noise based on the given input parameters, including position, seed, frequency, jitter, distance metric, and noise type. The function calculates distances between the input position and feature points within a grid, determining the closest feature points, their distances, and the corresponding grid cell.
public static HashBasedNoiseUtils.Cellular2DResult Cellular2D(float2 p, uint seed = 0, float frequency = 1, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat2The input position in 2D space for computing the cellular noise.
seeduintA seed value for deterministic noise generation. Defaults to 0.
frequencyfloatThe frequency scaling factor for altering the noise detail. Defaults to 1.
jitterfloatThe amount of displacement applied to feature points within cells. Defaults to 1.
metricHashBasedNoiseUtils.CellularDistanceThe metric used to calculate distance between points. Options include Euclidean, Manhattan, and Chebyshev. Defaults to Euclidean.
typeNoiseTypeThe noise type dictating the algorithm used for producing hash values. Defaults to the implementation's default noise type.
Returns
- HashBasedNoiseUtils.Cellular2DResult
A HashBasedNoiseUtils.Cellular2DResult representing the computed cellular noise, including distances to feature points, positions, and grid cell data.
Cellular3D(float3, uint, float, float, CellularDistance, NoiseType)
Generates a 3D cellular noise pattern based on the given parameters using a specified algorithm. The result contains the closest two feature points, their distances, coordinates, and origin cells.
public static HashBasedNoiseUtils.Cellular3DResult Cellular3D(float3 p, uint seed = 0, float frequency = 1, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The position in 3D space where the noise is evaluated.
seeduintAn unsigned integer seed value to introduce randomness.
frequencyfloatThe scale of the noise, controlling how detailed the noise pattern appears.
jitterfloatA value to adjust the randomness of feature points within each cell; ranges from 0 (no jitter) to 1 (maximum jitter).
metricHashBasedNoiseUtils.CellularDistanceThe distance metric used to compute distances between feature points and the input position (e.g., Euclidean, Manhattan, Chebyshev).
typeNoiseTypeThe noise generation type dictating the specific algorithm or behavior of the noise function.
Returns
- HashBasedNoiseUtils.Cellular3DResult
A
Cellular3DResultstructure containing the closest two feature point distances, the coordinates of the nearest feature point, and the cell indices for the best feature point.
CellularEdge01(float2, uint, float, float, CellularDistance, float, NoiseType)
Computes a cellular-based noise value mapped to the range [0, 1] with specific edge characteristics. Allows customization of frequency, jitter, metric, edge width, and noise type. Great default for “wormy” patterns: Euclidean + jitter=1.0.
public static float CellularEdge01(float2 p, uint seed = 0, float frequency = 0.005, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, float edgeWidth = 0.1, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat2The input 2D coordinates to evaluate the noise at.
seeduintThe seed value for randomization, ensuring deterministic output for the same seed.
frequencyfloatThe frequency of the noise, affecting the scale of features.
jitterfloatThe jitter factor to introduce randomness into the cellular pattern.
metricHashBasedNoiseUtils.CellularDistanceThe distance metric used to compute cell distances (e.g., Euclidean, Manhattan, or Chebyshev).
edgeWidthfloatThe width of the edge effect in the noise pattern, controlling the transition.
typeNoiseTypeThe noise type, specifying the algorithm used for random number generation and value mixing.
Returns
- float
A floating-point value in the range [0, 1], representing the computed cellular noise at the specified input.
CellularEdge01(float3, uint, float, float, CellularDistance, float, NoiseType)
Calculates a procedural cellular edge effect that transitions smoothly between cell boundaries. The result is a normalized value in the range [0, 1] where the smoothness of the edge is controlled by the specified edge width.
public static float CellularEdge01(float3 p, uint seed = 0, float frequency = 0.006, float jitter = 0.9, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, float edgeWidth = 0.12, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The input 3D position where the cellular noise will be evaluated.
seeduintAn optional seed value for controlling the randomness of the cellular noise.
frequencyfloatThe frequency of the cellular noise, which influences the scale of the generated pattern.
jitterfloatControls the variation of cell point positions. A higher value results in more irregular cell distributions.
metricHashBasedNoiseUtils.CellularDistanceThe distance metric used for calculating the cellular noise, such as Euclidean or Manhattan.
edgeWidthfloatThe size of the edge transition, defining how smoothly the noise transitions between cells.
typeNoiseTypeSpecifies the noise variation type to be used (e.g., Mangled Bits, Mangled Bits Balanced Mix).
Returns
- float
A normalized float value representing the procedural edge effect at the specified position.
CellularEdgeExp01(float2, uint, float, float, CellularDistance, float, NoiseType)
Computes a value that represents the exponential weighting of cellular edge noise between the first and second feature points, normalized to the range [0, 1]. The result applies an exponential decay falloff: exp(-k*(F2-F1)) based on the difference between the distances to the two closest feature points. Larger k ⇒ thinner/sharper lines.
public static float CellularEdgeExp01(float2 p, uint seed = 0, float frequency = 0.005, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, float k = 8, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat2The 2D point in space for which to calculate the noise.
seeduintAn optional integer seed used for random generation, which affects the noise calculation.
frequencyfloatThe frequency of the cellular noise. Higher values result in finer noise patterns.
jitterfloatThe amount of randomness applied to the feature point positions. A value of 1.0 adds full jitter.
metricHashBasedNoiseUtils.CellularDistanceThe distance metric used to determine the distance between feature points. Options include Euclidean, Manhattan, and Chebyshev distance.
kfloatThe exponential scaling factor that determines how quickly the weighting decays based on the feature point distances.
typeNoiseTypeThe type of noise algorithm used. Defaults to a balanced mix of mangled bits.
Returns
- float
A floating-point value between 0 and 1 that represents the weighted contribution of the cellular edge noise.
CellularEdgeExp01(float3, uint, float, float, CellularDistance, float, NoiseType)
Computes a cell-based edge noise function normalized between 0 and 1, uses exponential weighting to emphasize cellular vein patterns. The noise is derived based on a 3D coordinate and various parameters affecting frequency, jitter, and distance metric.
public static float CellularEdgeExp01(float3 p, uint seed = 0, float frequency = 0.006, float jitter = 0.9, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, float k = 8, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3A 3D coordinate input.
seeduintA seed value for randomization (default is 0).
frequencyfloatThe frequency of the cellular noise (default is 0.006).
jitterfloatThe amount of displacement applied to the cell points (default is 0.9).
metricHashBasedNoiseUtils.CellularDistanceThe metric used to calculate the distance between cells (default is Euclidean).
kfloatAn exponential scaling factor influencing the contrast of the noise (default is 8).
typeNoiseTypeThe noise type used for hashing (default is MangledBitsBalancedMix).
Returns
- float
A floating-point value normalized between 0 and 1 representing the weighted cell edge noise.
CellularEdgeSigned(float2, uint, float, float, CellularDistance, float, NoiseType)
Evaluates a signed cellular edge noise value at a given point in 2D space. The result is derived by scaling and offsetting the unsigned cellular edge noise to produce a signed range of values.
public static float CellularEdgeSigned(float2 p, uint seed = 0, float frequency = 0.005, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, float edgeWidth = 0.1, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat2The 2D coordinates at which to evaluate the noise.
seeduintThe seed value for generating deterministic noise. Defaults to 0.
frequencyfloatThe frequency of the noise, which determines the scale of noise features. Defaults to 0.005f.
jitterfloatThe amount of jitter applied to the grid points. Higher values produce more variation. Defaults to 1.0f.
metricHashBasedNoiseUtils.CellularDistanceThe distance metric used for cellular noise computations, which affects the shape of features. Defaults to Euclidean.
edgeWidthfloatThe width of the edge region. This controls the blend between edges and cell interiors. Defaults to 0.1f.
typeNoiseTypeThe noise type used for calculations, affecting the mixing and appearance of the final result. Defaults to MangledBitsBalancedMix.
Returns
- float
A signed float value representing the cellular edge noise at the given point, normalized to a range of [-1, 1].
CellularEdgeSigned(float3, uint, float, float, CellularDistance, float, NoiseType)
Computes a signed cellular noise value by generating patterns of cellular structures. The output is scaled and shifted to a signed range of -1 to 1.
public static float CellularEdgeSigned(float3 p, uint seed = 0, float frequency = 0.006, float jitter = 0.9, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, float edgeWidth = 0.12, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The 3D position input as a float3 vector.
seeduintThe seed value used for deterministic randomness. Defaults to 0.
frequencyfloatThe frequency of the noise, controlling the size of individual cells. Defaults to 0.006f.
jitterfloatThe amount of jitter applied to modify the cell center positions. Defaults to 0.9f.
metricHashBasedNoiseUtils.CellularDistanceThe distance metric used to determine cellular patterns (e.g., Euclidean, Manhattan, etc.). Defaults to CellularDistance.Euclidean.
edgeWidthfloatThe width of the cellular edges. Smaller values produce sharper edges. Defaults to 0.12f.
typeNoiseTypeThe noise type used to calculate cellular patterns. Defaults to NoiseType.MangledBitsBalancedMix.
Returns
- float
A float value representing the signed cellular noise, scaled to the range -1 to 1.
CellularF1(float2, uint, float, float, CellularDistance, NoiseType)
Computes the F1 value for cellular noise at a given 2D point. The F1 value represents the distance to the nearest feature point, offering a basis for cellular noise generation. Convenience: return F1 only.
public static float CellularF1(float2 p, uint seed = 0, float frequency = 1, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat2The 2D point for which the F1 noise value is computed.
seeduintThe seed value for generating deterministic noise results.
frequencyfloatThe frequency at which the noise is sampled, affecting the size of the cells.
jitterfloatThe amount of jitter applied to feature point positions within the cells.
metricHashBasedNoiseUtils.CellularDistanceThe distance metric used to compute feature point distances, such as Euclidean or Manhattan.
typeNoiseTypeThe type of noise used for hashing and mixing values, e.g., Mangled Bits or ChaCha variants.
Returns
- float
The F1 value, representing the distance to the nearest feature point from the input point.
CellularF2MinusF1(float2, uint, float, float, CellularDistance, NoiseType)
Computes the difference between the second and first closest distances (F2 - F1) for a 2D cellular noise function at a given point. Convenience: classic “cell edges”: F2 - F1.
public static float CellularF2MinusF1(float2 p, uint seed = 0, float frequency = 1, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat2The 2D point at which the cellular noise function is evaluated.
seeduintThe seed value used for the noise calculation. Defaults to 0.
frequencyfloatThe frequency factor applied to the noise function. Defaults to 1f.
jitterfloatThe amount of jitter applied to cell positions. Defaults to 1f.
metricHashBasedNoiseUtils.CellularDistanceThe distance metric used to calculate noise. Defaults to Euclidean.
typeNoiseTypeThe noise type used for hashing. Defaults to MangledBitsBalancedMix.
Returns
- float
The difference between the second and first closest distances (F2 - F1) in the cellular noise result.
CellularFill01(float2, uint, float, float, CellularDistance, NoiseType)
Generates a procedural cellular noise value in the range [0, 1]. The computation is based on a 2D point, with optional parameters controlling seed value, frequency, jitter, distance metric, and noise type. Normalized F1 fill in [0,1] (2D)
public static float CellularFill01(float2 p, uint seed = 0, float frequency = 1, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat2The 2D position for evaluating the cellular noise.
seeduintAn optional seed value to control noise generation (default is 0).
frequencyfloatThe frequency to scale the input position by (default is 1).
jitterfloatThe jitter level to affect cell boundary shapes (default is 1).
metricHashBasedNoiseUtils.CellularDistanceThe distance metric used for cellular computation (default is Euclidean).
typeNoiseTypeThe noise type determining hashing and mixing behavior (default is MangledBitsBalancedMix).
Returns
- float
A float value in the range [0, 1] representing the computed cellular noise at the input position.
CellularFill01(float3, uint, float, float, CellularDistance, NoiseType)
Generates a noise-based value mapped to a range of 0 to 1 using cellular noise. The noise is influenced by parameters for frequency, jitter, distance metric, and noise type.
public static float CellularFill01(float3 p, uint seed = 0, float frequency = 1, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The input 3D point for which noise will be generated.
seeduintA seed value for ensuring deterministic results. Defaults to 0 if not provided.
frequencyfloatControls the scale of the noise. Higher values result in smaller features. Defaults to 1.
jitterfloatDetermines the amount of randomness in cell boundaries. Defaults to 1.
metricHashBasedNoiseUtils.CellularDistanceSpecifies the distance metric used in cellular noise computation. Defaults to Euclidean.
typeNoiseTypeDefines the type of noise to apply. Defaults to MangledBitsBalancedMix.
Returns
- float
A normalized noise value between 0 and 1 for the given input parameters.
DomainWarp(float3, uint, float, float, int, float, float, int, float, float, float, NoiseType)
Generates domain-warped noise based on a given position, seed, and various warp and value noise parameters. Used to create complex, non-repetitive noise patterns by warping the input domain.
public static float DomainWarp(float3 p, uint seed = 0, float warpAmplitude = 1, float warpFrequency = 0.5, int warpOctaves = 1, float warpLacunarity = 2, float warpGain = 0.5, int valueOctaves = 5, float valueFrequency = 1, float valueGain = 0.5, float valueLacunarity = 2, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The input 3D position at which to evaluate the noise.
seeduintThe seed value for generating random noise, enabling reproducibility. Defaults to 0.
warpAmplitudefloatThe amplitude of the warp distortion. Higher values result in more intense warping. Defaults to 1f.
warpFrequencyfloatThe frequency of the warp distortion, controlling the scale of the warp pattern. Defaults to 0.5f.
warpOctavesintThe number of octaves to use for the warp noise. Higher values provide more detail. Defaults to 1.
warpLacunarityfloatThe lacunarity of the warp noise, affecting the frequency increment between octaves. Defaults to 2f.
warpGainfloatThe gain of the warp noise, controlling the contribution of each octave. Defaults to 0.5f.
valueOctavesintThe number of octaves to use for the value noise evaluation at the warped position. Defaults to 5.
valueFrequencyfloatThe frequency of the value noise evaluation, controlling the scale of the value pattern. Defaults to 1f.
valueGainfloatThe gain of the value noise, controlling the contribution of each octave. Defaults to 0.5f.
valueLacunarityfloatThe lacunarity of the value noise, affecting the frequency increment between octaves. Defaults to 2f.
typeNoiseTypeThe type of noise to use for the computations, specifying different blending or mixing mechanisms. Defaults to the default noise type.
Returns
- float
A single float value representing the computed domain-warped noise at the specified position.
FBm(float3, uint, int, float, float, float, float, bool, NoiseType)
Generates a fractal Brownian motion (fBm) value using noise functions and specified parameters. Combines multiple octaves of noise to produce a fractal-like effect, with adjustable frequency, amplitude, and other properties.
public static float FBm(float3 p, uint seed = 0, int octaves = 5, float frequency = 1, float amplitude = 1, float lacunarity = 2, float gain = 0.5, bool normalize = true, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The 3D position at which the noise should be evaluated.
seeduintA seed value used for noise generation to ensure repeatability.
octavesintThe number of noise layers (octaves) to combine. Higher values create more detail.
frequencyfloatThe base frequency of the noise function. Higher values increase the noise frequency.
amplitudefloatThe initial amplitude of the noise. Determines the range of values for the first octave.
lacunarityfloatThe rate of frequency change between octaves. Defaults to 2, doubling the frequency per octave.
gainfloatThe rate of amplitude change between octaves. Defaults to 0.5, halving the amplitude per octave.
normalizeboolSpecifies whether the result should be normalized based on the amplitude sum of all octaves.
typeNoiseTypeThe type of noise function to use for generating noise values.
Returns
- float
A floating-point value representing the fBm noise at the given position. Normalized to ~[-1,1] when
normalizeis true.
Get1DNoise(int, uint, NoiseType)
Returns a 32-bit unsigned integer containing reasonably well-scrambled bits, based on a given (signed) integer input parameter (position/index) and [optional] seed. Kind of like looking up a value in an infinitely large [non-existent] table of previously generated random numbers.
The base bit-noise constants were crafted to have distinctive and interesting bits and have so far produced excellent experimental test results.
public static uint Get1DNoise(int index, uint seed, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
indexintseeduinttypeNoiseType
Returns
- uint
Remarks
Squirrel Eiserloh call this particular approach SquirrelNoise, specifically SquirrelNoise3 (version 3).
Get1DNoise01(int, uint, NoiseType)
Generates a deterministic pseudo-random floating-point value between 0.0 and 1.0, inclusive. This method is derived from a 1D deterministic noise generation function.
public static float Get1DNoise01(int index, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
indexintA signed integer representing the input position or index for the noise generation process.
seeduintAn optional 32-bit unsigned integer used as a seed value to alter the randomness deterministically. Defaults to 0 if not provided.
typeNoiseTypeThe noise generation type, which defines the noise computation method.
Returns
- float
A single-precision floating-point value ranging from 0.0 to 1.0, representing the computed 1D noise.
Get1DNoiseNeg1To1(int, uint, NoiseType)
Generates a deterministic pseudo-random noise value based on a 1-dimensional index and an optional seed, normalized to a range between -1 and 1.
public static float Get1DNoiseNeg1To1(int index, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
indexintA signed integer representing the index or position used to generate the noise value.
seeduintAn optional 32-bit unsigned integer used as a seed for controlling the randomness of the output. If not specified, the default seed value is 0.
typeNoiseTypeThe noise generation type, which defines the noise computation method.
Returns
- float
A floating-point value in the range of -1 to 1, representing the normalized pseudo-random noise.
Get2DNoise(int, int, uint, NoiseType)
Computes a 2D pseudo-random noise value based on the input coordinates and an optional seed. This method generates a deterministic random noise value using the given x and y coordinates combined with the seed.
public static uint Get2DNoise(int x, int y, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xintThe x-coordinate used as input for generating the noise value.
yintThe y-coordinate used as input for generating the noise value.
seeduintAn optional 32-bit unsigned integer used as a seed to influence the randomness of the generated value. Defaults to 0 if not specified.
typeNoiseTypeThe noise generation type, which defines the noise computation method.
Returns
- uint
A 32-bit unsigned integer representing the computed pseudo-random noise value for the specified 2D coordinates.
Get2DNoise01(int, int, uint, NoiseType)
Generates a deterministic 2D noise value scaled to the range [0, 1]. This method combines two-dimensional coordinates and an optional seed to produce pseudo-random output.
public static float Get2DNoise01(int x, int y, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xintThe x-coordinate for generating the noise value.
yintThe y-coordinate for generating the noise value.
seeduintAn optional 32-bit unsigned integer value to alter the randomness. Default is 0.
typeNoiseTypeThe noise generation type, which defines the noise computation method.
Returns
- float
A floating-point number in the range [0, 1] representing the generated noise value.
Get2DNoiseNeg1To1(int, int, uint, NoiseType)
Generates a deterministic pseudo-random noise value for two-dimensional integer coordinates and normalizes the result to a floating-point value within the range of -1 to 1.
public static float Get2DNoiseNeg1To1(int x, int y, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xintThe X-coordinate used to determine the position for generating noise.
yintThe Y-coordinate used to determine the position for generating noise.
seeduintAn optional 32-bit unsigned integer seed to modify the behavior of the noise generation. The default value is 0.
typeNoiseTypeThe noise generation type, which defines the noise computation method.
Returns
- float
A floating-point value within the range of -1 to 1, derived from the generated pseudo-random noise.
Get3DNoise(int, int, int, uint, NoiseType)
Generates a deterministic pseudo-random 32-bit unsigned integer value based on the provided 3D coordinates and an optional seed. This method computes noise by combining the x, y, and z coordinates with prime multipliers, and then applies a 1D noise function.
public static uint Get3DNoise(int x, int y, int z, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xintAn integer representing the x-coordinate in 3D space used for the noise calculation.
yintAn integer representing the y-coordinate in 3D space used for the noise calculation.
zintAn integer representing the z-coordinate in 3D space used for the noise calculation.
seeduintAn optional 32-bit unsigned integer used as a seed to control the randomness of the output. Defaults to 0 if not provided.
typeNoiseTypeThe noise generation type, which defines the noise computation method.
Returns
- uint
A 32-bit unsigned integer representing the deterministic pseudo-random noise value calculated using the input coordinates and seed.
Get3DNoise01(int, int, int, uint, NoiseType)
Generates a 3D noise value between 0.0 and 1.0 using deterministic pseudo-random algorithms. This method computes noise based on 3D coordinates and an optional seed value.
public static float Get3DNoise01(int x, int y, int z, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xintAn integer representing the X-coordinate in the 3D space for noise generation.
yintAn integer representing the Y-coordinate in the 3D space for noise generation.
zintAn integer representing the Z-coordinate in the 3D space for noise generation.
seeduintAn optional 32-bit unsigned integer used to alter the randomness of the generated noise. The default value is 0.
typeNoiseTypeThe noise generation type, which defines the noise computation method.
Returns
- float
A floating-point value between 0.0 and 1.0 representing the calculated deterministic 3D noise.
Get3DNoiseNeg1To1(int, int, int, uint, NoiseType)
Generates deterministic pseudo-random noise for a 3D coordinate and normalizes the result within the range of -1 to 1.
public static float Get3DNoiseNeg1To1(int x, int y, int z, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xintThe x-coordinate used in the noise generation process.
yintThe y-coordinate used in the noise generation process.
zintThe z-coordinate used in the noise generation process.
seeduintA 32-bit unsigned integer used to control the randomness and reproducibility of the output. Defaults to 0 if not specified.
typeNoiseTypeThe noise generation type, which defines the noise computation method.
Returns
- float
A floating-point value within the range of -1 to 1, representing the normalized noise for the given coordinates and seed.
Get4DNoise(int, int, int, int, uint, NoiseType)
Computes a 32-bit unsigned integer noise value in four dimensions based on the input coordinates and an optional seed. This function is deterministic and produces consistent results for the same inputs.
public static uint Get4DNoise(int x, int y, int z, int w, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xintThe x-coordinate as a signed integer representing the first dimension in the noise space.
yintThe y-coordinate as a signed integer representing the second dimension in the noise space.
zintThe z-coordinate as a signed integer representing the third dimension in the noise space.
wintThe w-coordinate as a signed integer representing the fourth dimension in the noise space.
seeduintAn optional 32-bit unsigned integer used to control the randomness of the noise generation. Defaults to 0.
typeNoiseTypeThe noise generation type, which defines the noise computation method.
Returns
- uint
A 32-bit unsigned integer representing the computed noise value.
Get4DNoise01(int, int, int, int, uint, NoiseType)
Computes a 4D noise value normalized to the range [0, 1]. This function generates pseudo-random noise for a four-dimensional space based on the provided coordinates and an optional seed.
public static float Get4DNoise01(int x, int y, int z, int w, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xintThe X-coordinate in the 4D space.
yintThe Y-coordinate in the 4D space.
zintThe Z-coordinate in the 4D space.
wintThe W-coordinate in the 4D space.
seeduintAn optional 32-bit unsigned integer used to control the randomness of the output. Defaults to 0 if not specified.
typeNoiseTypeThe noise generation type, which defines the noise computation method.
Returns
- float
A floating-point value between 0 and 1 representing the normalized 4D noise.
Get4DNoiseNeg1To1(int, int, int, int, uint, NoiseType)
Generates a deterministic pseudo-random noise value in 4D space and normalizes it to the range of -1 to 1. This method ensures consistent results for the same inputs, making it suitable for procedural generation.
public static float Get4DNoiseNeg1To1(int x, int y, int z, int w, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xintThe X coordinate, an integer used to determine the noise position in the 4D space.
yintThe Y coordinate, an integer used to determine the noise position in the 4D space.
zintThe Z coordinate, an integer used to determine the noise position in the 4D space.
wintThe W coordinate, an integer used to determine the noise position in the 4D space.
seeduintA 32-bit unsigned integer used as a seed value to control the randomness of the output. Defaults to 0.
typeNoiseTypeThe noise generation type, which defines the noise computation method.
Returns
- float
A floating-point value in the range of -1 to 1, representing the normalized 4D noise value.
GetCellSeed2D(int2, uint, NoiseType)
Generates a 2D cell seed using the provided cell coordinates and world seed. The resulting value is determined by applying a specific noise function.
public static uint GetCellSeed2D(int2 cell, uint worldSeed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
cellint2The 2D coordinates of the cell as an
int2structure.worldSeeduintA seed value that determines the randomization of the noise function. The default value is 0.
typeNoiseTypeThe type of noise function to use. The default is
NoiseType.MangledBitsBalancedMix.
Returns
- uint
A 32-bit unsigned integer representing the cell's seed value.
GetCellSeed3D(int3, uint, NoiseType)
Generates a seed value for a specific 3D cell in space using 3D noise functions. The resulting value is determined by the cell coordinates, a world seed, and the selected noise type.
public static uint GetCellSeed3D(int3 cell, uint worldSeed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
cellint3The 3D integer coordinates of the cell.
worldSeeduintAn optional seed value to differentiate results across different worlds or contexts. Defaults to 0.
typeNoiseTypeThe type of noise used for generating the seed. Defaults to MangledBitsBalancedMix.
Returns
- uint
Returns a 32-bit unsigned integer representing the generated 3D cell seed.
GetUInt128(int, uint, NoiseType)
Computes a 128-bit unsigned integer by combining two 64-bit pseudo-random numbers derived from the input parameters. This method generates low and high 64-bit components based on a deterministic noise function.
public static ulong2 GetUInt128(int index, uint seed, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
indexintA signed integer used to indicate the position or index for generating pseudo-random noise.
seeduintA 32-bit unsigned integer used as an additional input to control the randomness of the output.
typeNoiseTypeThe noise generation type that determines the method used for computing the noise values. Optional, defaults to a predefined type if not provided.
Returns
- ulong2
An instance of
ulong2representing a 128-bit unsigned integer, composed of two 64-bit pseudo-random values.
GetUInt64(int, uint, NoiseType)
Generates a 64-bit unsigned pseudo-random integer by combining two noise values. This method uses a deterministic noise function derived from the provided parameters.
public static ulong GetUInt64(int index, uint seed, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
indexintA signed integer representing the index or position used for generating the pseudo-random value.
seeduintA 32-bit unsigned integer serving as a secondary input to influence the randomness of the output.
typeNoiseTypeThe noise generation algorithm type that specifies the method for producing the noise values. If not specified, a default noise type is used.
Returns
- ulong
A 64-bit unsigned integer combining two noise components (high and low) to produce a unified pseudo-random value.
GradientCentral(float2, uint, float, NoiseType)
Calculates the central gradient of a 2D Perlin noise function at a given point. This method estimates the gradient by sampling the function in each dimension using a small step size and computing the finite differences.
public static float2 GradientCentral(float2 p, uint seed, float eps = 0.001, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat2A
float2instance representing the 2D coordinates where the gradient should be evaluated.seeduintA 32-bit unsigned integer used as an additional input to control the randomness of the Perlin noise.
epsfloatA small floating-point value representing the step size used for computing finite differences. Defaults to
1e-3f.typeNoiseTypeThe noise generation type that influences the Perlin noise computation. Optional, defaults to
NoiseType.MangledBitsBalancedMix.
Returns
- float2
A
float2instance representing the gradient vector at the specified coordinates. The x and y components of the returned vector correspond to the gradient along the x and y axes, respectively.
GradientCentral(float3, uint, float, NoiseType)
Calculates the central gradient of the Perlin noise function at a given point in 3D space. It computes the gradient by approximating partial derivatives across all axes using central difference with a small epsilon step size for numerical differentiation.
public static float3 GradientCentral(float3 p, uint seed, float eps = 0.001, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The 3D point where the gradient is evaluated.
seeduintThe seed value used for noise generation, ensuring determinism.
epsfloatThe small step size used for central difference computation. Default is 1e-3f.
typeNoiseTypeThe type of noise function used, defaulting to MangledBitsBalancedMix.
Returns
Perlin(float, float, float, uint, NoiseType)
Generates a Perlin noise value based on the input coordinates and a specified seed. This method calculates smooth noise by blending integer-based deterministic noise values at each corner of the cube enclosing the input coordinates.
public static float Perlin(float x, float y, float z, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xfloatThe x-coordinate of the noise input.
yfloatThe y-coordinate of the noise input.
zfloatThe z-coordinate of the noise input.
seeduintA 32-bit unsigned integer used to control the pseudo-randomness of the noise generation.
typeNoiseTypeSpecifies the type of noise function to use for generating corner values. Defaults to MangledBitsBalancedMix.
Returns
- float
A single-precision floating-point value representing the Perlin noise at the given coordinates.
Perlin(float, float, uint, NoiseType)
Generates a Perlin noise value based on the provided 2D coordinates, seed, and noise type. The noise value is computed by hashing the corners of the surrounding grid and applying interpolation.
public static float Perlin(float x, float y, uint seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xfloatThe X coordinate (continuous) used for generating the noise value.
yfloatThe Y coordinate (continuous) used for generating the noise value.
seeduintAn optional 32-bit unsigned integer seed to enhance the determinism of the noise generation. Defaults to 0 if not provided.
typeNoiseTypeThe type of noise used to hash the corners of the grid. Defaults to the method's default noise type.
Returns
- float
A floating-point value representing the generated Perlin noise.
PerlinWithDeriv(float, float, float, uint, out float3, NoiseType)
Computes Perlin noise with derivatives for the given coordinates and seed value. The method generates smooth noise and calculates gradients based on the noise type.
public static float PerlinWithDeriv(float x, float y, float z, uint seed, out float3 d, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xfloatThe x-coordinate in the 3D noise space.
yfloatThe y-coordinate in the 3D noise space.
zfloatThe z-coordinate in the 3D noise space.
seeduintThe seed value used for generating consistent noise output.
dfloat3The resulting gradients of the Perlin noise, provided as a float3 vector.
typeNoiseTypeThe noise type used to control the behavior and mixing of the noise, with a default value.
Returns
- float
The computed Perlin noise value for the provided input.
PerlinWithDeriv(float, float, uint, out float2, NoiseType)
Generates a Perlin noise value with derivative, based on the provided 2D coordinates, seed, and noise type.
public static float PerlinWithDeriv(float x, float y, uint seed, out float2 d, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xfloatThe x-coordinate for the noise calculation.
yfloatThe y-coordinate for the noise calculation.
seeduintThe seed value used for deterministic noise generation.
dfloat2The derivative of the noise with respect to x and y, returned as a float2.
typeNoiseTypeThe type of noise to generate; defaults to the specified
DefaultNoiseType.
Returns
- float
A float value representing the generated Perlin noise at the given coordinates.
Ridge(float3, uint, int, float, float, float, float, float, float, bool, NoiseType)
Computes a ridge noise value using Perlin noise with specific parameters such as frequency, amplitude, lacunarity, gain, ridge offset, and ridge sharpness. This function applies multiple octaves of noise generation and can optionally normalize the output across the range [-1, 1].
public static float Ridge(float3 p, uint seed = 0, int octaves = 5, float frequency = 1, float amplitude = 1, float lacunarity = 2, float gain = 0.5, float ridgeOffset = 1, float ridgeSharpness = 2, bool normalize = true, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The input 3D position for the noise function.
seeduintThe seed value to ensure determinism in the generation. Default is 0.
octavesintThe number of noise octaves used to compute the ridge noise. Default is 5.
frequencyfloatThe starting frequency for the noise generation. Default is 1f.
amplitudefloatThe starting amplitude for the noise generation. Default is 1f.
lacunarityfloatThe frequency multiplier applied after each octave. Default is 2f.
gainfloatThe amplitude multiplier applied after each octave. Default is 0.5f.
ridgeOffsetfloatThe offset applied to the ridge transformation. Default is 1.0f.
ridgeSharpnessfloatThe sharpness applied to the ridge calculation. Default is 2.0f.
normalizeboolA boolean flag indicating whether the resulting noise values should be normalized across the range [-1, 1]. Default is true.
typeNoiseTypeThe noise type used for the computation. Default is MangledBitsBalancedMix.
Returns
- float
A float value representing the computed ridge noise. The output can range from [-1, 1].
Simplex2DCore(float2, uint, float, NoiseType)
Generates 2D simplex noise at a given position using specified parameters. The noise function allows adjustable parameters such as seed, frequency, and noise type.
public static float Simplex2DCore(float2 position, uint seed = 0, float frequency = 1, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
positionfloat2The 2D position at which to sample the noise.
seeduintThe random seed used for generating the noise. Defaults to 0.
frequencyfloatThe frequency of the noise. Defaults to 1.0.
typeNoiseTypeThe type of noise to use, defined by the NoiseType enum. Defaults to MangledBitsBalancedMix.
Returns
- float
Returns a single precision float value representing the generated noise at the specified position.
Simplex3DCore(float3, uint, float, NoiseType)
Generates a 3D simplex noise value based on the input position, seed, frequency, and noise type.
public static float Simplex3DCore(float3 position, uint seed = 0, float frequency = 1, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
positionfloat3The 3D position in space for which the noise value should be calculated.
seeduintA seed value used to initialize the noise generation. Defaults to 0.
frequencyfloatThe frequency of the noise, altering the scale at which it repeats. Defaults to 1.
typeNoiseTypeThe specific noise type to be used in the calculation. Uses the default noise type if not specified.
Returns
- float
A floating-point value representing the computed 3D simplex noise at the given position.
UberNoise(float3, uint, int, float, float, float, float, float, int, float, float, int, float, NoiseType)
Generates a procedural noise value based on chained domain warps and fractional Brownian motion (fBm),
with optional ridge component subtraction. This method produces rich and detailed noise patterns
by combining multiple layers of octaves, domain warping, and ridging, allowing for enhanced control
over frequency, amplitude, and tonal complexity.
“Uber” composition inspired by 
public static float UberNoise(float3 p, uint seed = 0, int octaves = 6, float frequency = 1, float lacunarity = 2, float gain = 0.5, float warp1Amp = 0.75, float warp1Freq = 0.5, int warp1Oct = 2, float warp2Amp = 0.35, float warp2Freq = 1.2, int warp2Oct = 2, float ridgeMix = 0.3, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The input 3D position for noise evaluation.
seeduintThe seed value for noise generation, ensuring repeatability.
octavesintThe number of noise layers (octaves) to compute for fBm.
frequencyfloatThe base frequency of the noise function.
lacunarityfloatThe frequency multiplier for each successive octave.
gainfloatThe amplitude multiplier for each successive octave.
warp1AmpfloatAmplitude of the first domain warp.
warp1FreqfloatFrequency of the first domain warp.
warp1OctintNumber of octaves used for the first domain warp.
warp2AmpfloatAmplitude of the second domain warp.
warp2FreqfloatFrequency of the second domain warp.
warp2OctintNumber of octaves used for the second domain warp.
ridgeMixfloatThe weight used to mix the ridged noise component with fBm.
typeNoiseTypeThe noise type that alters how the procedural noise is calculated.
Returns
- float
A procedural noise value clamped between -1 and 1.
ValueAndGrad(float, float, uint, out float2, NoiseType)
Computes the value of Perlin noise and its gradient at a given 2D point.
public static float ValueAndGrad(float x, float y, uint seed, out float2 grad, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
xfloatThe x-coordinate of the input point.
yfloatThe y-coordinate of the input point.
seeduintA seed value for the noise generation.
gradfloat2An output parameter that returns the 2D gradient vector of the noise value at the input point.
typeNoiseTypeThe type of noise to use during computation.
Returns
- float
The Perlin noise value at the given 2D point.
ValueAndGrad(float2, uint, out float2, NoiseType)
Computes a Perlin noise value at a given 2D position and provides the gradient of the noise at that position. The method uses a noise function influenced by the provided seed and noise type to generate the result.
public static float ValueAndGrad(float2 p, uint seed, out float2 grad, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat2A
float2representing the 2D position where the noise value is evaluated.seeduintA 32-bit unsigned integer that determines the seed used for generating the noise.
gradfloat2An output parameter of type
float2that contains the gradient of the noise at the given position.typeNoiseTypeThe noise generation type that determines the method used for computing the noise values. Defaults to a predefined type if not provided.
Returns
- float
A
floatrepresenting the computed Perlin noise value at the specified position.
ValueAndGrad(float3, uint, out float3, NoiseType)
Computes the Perlin noise value at the given point and calculates its gradient.
public static float ValueAndGrad(float3 p, uint seed, out float3 grad, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The input position represented as a 3D vector.
seeduintThe seed value used to ensure deterministic noise generation.
gradfloat3The resulting gradient of the Perlin noise at the specified position.
typeNoiseTypeThe type of noise to be used for computation.
Returns
- float
Returns the Perlin noise value at the given position.
WorleyBlocky2D(float2, uint, float, float, CellularDistance, float, NoiseType)
Generates a 2D Worley noise value with a blocky aesthetic. The noise is evaluated based on the input position and a variety of parameters influencing the frequency, jitter, distance metric, edge blending, and noise type. Defaults: Chebyshev, jitter=0.1, freq=0.01, edgeWidth=0.1.
public static float WorleyBlocky2D(float2 p, uint seed = 0, float frequency = 0.01, float jitter = 0.1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Chebyshev, float edgeWidth = 0.1, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat2The 2D position at which to evaluate the noise.
seeduintThe seed value for randomization. Default is 0.
frequencyfloatThe frequency of the noise pattern. Default is 0.01f.
jitterfloatThe amount of jitter to apply to cell points. Default is 0.1f.
metricHashBasedNoiseUtils.CellularDistanceThe distance metric used to compute cellular distances. Default is Chebyshev.
edgeWidthfloatThe width of the edge blending between cells. Default is 0.1f.
typeNoiseTypeThe type of hash-based noise used for value generation. Default is MangledBitsBalancedMix.
Returns
- float
A float value representing the Worley noise result at the specified position. Cellular edges in [-1,1]
WorleyBlocky3D(float3, uint, float, float, CellularDistance, float, NoiseType)
Computes a 3D Worley noise with a blocky appearance using the specified parameters. The calculation uses Cellular Edge Signed noise with adjustable frequency, jitter, and edge width.
public static float WorleyBlocky3D(float3 p, uint seed = 0, float frequency = 0.012, float jitter = 0.1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Chebyshev, float edgeWidth = 0.12, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The 3D position to sample the noise at.
seeduintAn optional seed value to control the randomization of the noise.
frequencyfloatThe frequency scale of the noise.
jitterfloatThe amount of randomness in the cell positions.
metricHashBasedNoiseUtils.CellularDistanceThe cellular distance metric used for computing noise, such as Chebyshev or Euclidean.
edgeWidthfloatThe width of the edges between cells in the noise.
typeNoiseTypeThe noise type used for hashing during calculations.
Returns
- float
A floating-point value representing the computed 3D Worley noise at the given position. Cellular edges in [-1,1]
WorleyWormy2D(float2, uint, float, float, CellularDistance, float, NoiseType)
Generates a signed 2D Worley noise value based on the given position, seed, frequency, and other parameters. This function uses cellular edge detection and supports multiple distance metrics for noise computation. 2D “Wormy” (veiny) Cellular edges in [-1,1]. Defaults: Euclidean, jitter=1.0, freq=0.005, edgeWidth=0.1.
public static float WorleyWormy2D(float2 p, uint seed = 0, float frequency = 0.005, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, float edgeWidth = 0.1, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat2The 2D position for which the noise value is computed.
seeduintAn optional seed value to introduce variability in noise generation. Defaults to 0.
frequencyfloatThe frequency scale applied to the noise pattern. Defaults to 0.005.
jitterfloatThe level of jitter applied to the cell points. Higher values increase randomness. Defaults to 1.0.
metricHashBasedNoiseUtils.CellularDistanceSpecifies the distance metric used in cellular noise calculations. Defaults to Euclidean.
edgeWidthfloatDefines the width of the edges between cells in the noise pattern. Defaults to 0.1.
typeNoiseTypeThe type of noise used for computation. Defaults to MangledBitsBalancedMix.
Returns
- float
A signed floating-point value representing the computed 2D Worley noise at the specified position.
WorleyWormy3D(float3, uint, float, float, CellularDistance, float, NoiseType)
Generates a 3D Worley noise value with signed distance based on provided parameters. This function computes the noise by analyzing the nearest feature points in a 3D space, applying a jitter and a frequency for distortion, and returns a signed edge value based on the distance metric and edge width. 3D “Wormy” (veiny) Cellular edges in [-1,1].
public static float WorleyWormy3D(float3 p, uint seed = 0, float frequency = 0.006, float jitter = 0.9, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, float edgeWidth = 0.12, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
pfloat3The input 3D position for noise computation.
seeduintThe seed value for noise generation, used to ensure deterministic results.
frequencyfloatThe frequency scale of the noise pattern, determining its granularity.
jitterfloatThe amount of perturbation applied to feature points, affecting the noise detail.
metricHashBasedNoiseUtils.CellularDistanceThe distance calculation mode (e.g., Euclidean, Manhattan, Chebyshev).
edgeWidthfloatThe width of the noise's edge transition, influencing edge smoothness.
typeNoiseTypeThe noise algorithm used, determining the hashing method and sequence.
Returns
- float
A floating-point value representing the signed edge with applied noise in 3D space.