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
p
float3The 3D position input as a float3 vector.
seed
uintAn optional seed value to initialize noise generation. Default is 0.
octaves
intThe number of noise layers or octaves to combine. Default is 5.
frequency
floatThe base frequency of the noise. Default is 1.
amplitude
floatThe base amplitude of the noise. Default is 1.
lacunarity
floatThe frequency multiplier for each successive octave. Default is 2.
gain
floatThe amplitude multiplier for each successive octave. Default is 0.5.
normalize
boolDetermines whether to normalize the output to the range [-1, 1]. Default is true.
type
NoiseTypeThe 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
p
float2The input position in 2D space for computing the cellular noise.
seed
uintA seed value for deterministic noise generation. Defaults to 0.
frequency
floatThe frequency scaling factor for altering the noise detail. Defaults to 1.
jitter
floatThe amount of displacement applied to feature points within cells. Defaults to 1.
metric
HashBasedNoiseUtils.CellularDistanceThe metric used to calculate distance between points. Options include Euclidean, Manhattan, and Chebyshev. Defaults to Euclidean.
type
NoiseTypeThe 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
p
float3The position in 3D space where the noise is evaluated.
seed
uintAn unsigned integer seed value to introduce randomness.
frequency
floatThe scale of the noise, controlling how detailed the noise pattern appears.
jitter
floatA value to adjust the randomness of feature points within each cell; ranges from 0 (no jitter) to 1 (maximum jitter).
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to compute distances between feature points and the input position (e.g., Euclidean, Manhattan, Chebyshev).
type
NoiseTypeThe noise generation type dictating the specific algorithm or behavior of the noise function.
Returns
- HashBasedNoiseUtils.Cellular3DResult
A
Cellular3DResult
structure 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
p
float2The input 2D coordinates to evaluate the noise at.
seed
uintThe seed value for randomization, ensuring deterministic output for the same seed.
frequency
floatThe frequency of the noise, affecting the scale of features.
jitter
floatThe jitter factor to introduce randomness into the cellular pattern.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to compute cell distances (e.g., Euclidean, Manhattan, or Chebyshev).
edgeWidth
floatThe width of the edge effect in the noise pattern, controlling the transition.
type
NoiseTypeThe 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
p
float3The input 3D position where the cellular noise will be evaluated.
seed
uintAn optional seed value for controlling the randomness of the cellular noise.
frequency
floatThe frequency of the cellular noise, which influences the scale of the generated pattern.
jitter
floatControls the variation of cell point positions. A higher value results in more irregular cell distributions.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used for calculating the cellular noise, such as Euclidean or Manhattan.
edgeWidth
floatThe size of the edge transition, defining how smoothly the noise transitions between cells.
type
NoiseTypeSpecifies 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
p
float2The 2D point in space for which to calculate the noise.
seed
uintAn optional integer seed used for random generation, which affects the noise calculation.
frequency
floatThe frequency of the cellular noise. Higher values result in finer noise patterns.
jitter
floatThe amount of randomness applied to the feature point positions. A value of 1.0 adds full jitter.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to determine the distance between feature points. Options include Euclidean, Manhattan, and Chebyshev distance.
k
floatThe exponential scaling factor that determines how quickly the weighting decays based on the feature point distances.
type
NoiseTypeThe 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
p
float3A 3D coordinate input.
seed
uintA seed value for randomization (default is 0).
frequency
floatThe frequency of the cellular noise (default is 0.006).
jitter
floatThe amount of displacement applied to the cell points (default is 0.9).
metric
HashBasedNoiseUtils.CellularDistanceThe metric used to calculate the distance between cells (default is Euclidean).
k
floatAn exponential scaling factor influencing the contrast of the noise (default is 8).
type
NoiseTypeThe 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
p
float2The 2D coordinates at which to evaluate the noise.
seed
uintThe seed value for generating deterministic noise. Defaults to 0.
frequency
floatThe frequency of the noise, which determines the scale of noise features. Defaults to 0.005f.
jitter
floatThe amount of jitter applied to the grid points. Higher values produce more variation. Defaults to 1.0f.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used for cellular noise computations, which affects the shape of features. Defaults to Euclidean.
edgeWidth
floatThe width of the edge region. This controls the blend between edges and cell interiors. Defaults to 0.1f.
type
NoiseTypeThe 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
p
float3The 3D position input as a float3 vector.
seed
uintThe seed value used for deterministic randomness. Defaults to 0.
frequency
floatThe frequency of the noise, controlling the size of individual cells. Defaults to 0.006f.
jitter
floatThe amount of jitter applied to modify the cell center positions. Defaults to 0.9f.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to determine cellular patterns (e.g., Euclidean, Manhattan, etc.). Defaults to CellularDistance.Euclidean.
edgeWidth
floatThe width of the cellular edges. Smaller values produce sharper edges. Defaults to 0.12f.
type
NoiseTypeThe 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
p
float2The 2D point for which the F1 noise value is computed.
seed
uintThe seed value for generating deterministic noise results.
frequency
floatThe frequency at which the noise is sampled, affecting the size of the cells.
jitter
floatThe amount of jitter applied to feature point positions within the cells.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to compute feature point distances, such as Euclidean or Manhattan.
type
NoiseTypeThe 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
p
float2The 2D point at which the cellular noise function is evaluated.
seed
uintThe seed value used for the noise calculation. Defaults to 0.
frequency
floatThe frequency factor applied to the noise function. Defaults to 1f.
jitter
floatThe amount of jitter applied to cell positions. Defaults to 1f.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to calculate noise. Defaults to Euclidean.
type
NoiseTypeThe 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
p
float2The 2D position for evaluating the cellular noise.
seed
uintAn optional seed value to control noise generation (default is 0).
frequency
floatThe frequency to scale the input position by (default is 1).
jitter
floatThe jitter level to affect cell boundary shapes (default is 1).
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used for cellular computation (default is Euclidean).
type
NoiseTypeThe 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
p
float3The input 3D point for which noise will be generated.
seed
uintA seed value for ensuring deterministic results. Defaults to 0 if not provided.
frequency
floatControls the scale of the noise. Higher values result in smaller features. Defaults to 1.
jitter
floatDetermines the amount of randomness in cell boundaries. Defaults to 1.
metric
HashBasedNoiseUtils.CellularDistanceSpecifies the distance metric used in cellular noise computation. Defaults to Euclidean.
type
NoiseTypeDefines 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
p
float3The input 3D position at which to evaluate the noise.
seed
uintThe seed value for generating random noise, enabling reproducibility. Defaults to 0.
warpAmplitude
floatThe amplitude of the warp distortion. Higher values result in more intense warping. Defaults to 1f.
warpFrequency
floatThe frequency of the warp distortion, controlling the scale of the warp pattern. Defaults to 0.5f.
warpOctaves
intThe number of octaves to use for the warp noise. Higher values provide more detail. Defaults to 1.
warpLacunarity
floatThe lacunarity of the warp noise, affecting the frequency increment between octaves. Defaults to 2f.
warpGain
floatThe gain of the warp noise, controlling the contribution of each octave. Defaults to 0.5f.
valueOctaves
intThe number of octaves to use for the value noise evaluation at the warped position. Defaults to 5.
valueFrequency
floatThe frequency of the value noise evaluation, controlling the scale of the value pattern. Defaults to 1f.
valueGain
floatThe gain of the value noise, controlling the contribution of each octave. Defaults to 0.5f.
valueLacunarity
floatThe lacunarity of the value noise, affecting the frequency increment between octaves. Defaults to 2f.
type
NoiseTypeThe 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
p
float3The 3D position at which the noise should be evaluated.
seed
uintA seed value used for noise generation to ensure repeatability.
octaves
intThe number of noise layers (octaves) to combine. Higher values create more detail.
frequency
floatThe base frequency of the noise function. Higher values increase the noise frequency.
amplitude
floatThe initial amplitude of the noise. Determines the range of values for the first octave.
lacunarity
floatThe rate of frequency change between octaves. Defaults to 2, doubling the frequency per octave.
gain
floatThe rate of amplitude change between octaves. Defaults to 0.5, halving the amplitude per octave.
normalize
boolSpecifies whether the result should be normalized based on the amplitude sum of all octaves.
type
NoiseTypeThe 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
normalize
is 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
index
intseed
uinttype
NoiseType
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
index
intA signed integer representing the input position or index for the noise generation process.
seed
uintAn optional 32-bit unsigned integer used as a seed value to alter the randomness deterministically. Defaults to 0 if not provided.
type
NoiseTypeThe 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
index
intA signed integer representing the index or position used to generate the noise value.
seed
uintAn 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.
type
NoiseTypeThe 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
x
intThe x-coordinate used as input for generating the noise value.
y
intThe y-coordinate used as input for generating the noise value.
seed
uintAn optional 32-bit unsigned integer used as a seed to influence the randomness of the generated value. Defaults to 0 if not specified.
type
NoiseTypeThe 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
x
intThe x-coordinate for generating the noise value.
y
intThe y-coordinate for generating the noise value.
seed
uintAn optional 32-bit unsigned integer value to alter the randomness. Default is 0.
type
NoiseTypeThe 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
x
intThe X-coordinate used to determine the position for generating noise.
y
intThe Y-coordinate used to determine the position for generating noise.
seed
uintAn optional 32-bit unsigned integer seed to modify the behavior of the noise generation. The default value is 0.
type
NoiseTypeThe 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
x
intAn integer representing the x-coordinate in 3D space used for the noise calculation.
y
intAn integer representing the y-coordinate in 3D space used for the noise calculation.
z
intAn integer representing the z-coordinate in 3D space used for the noise calculation.
seed
uintAn optional 32-bit unsigned integer used as a seed to control the randomness of the output. Defaults to 0 if not provided.
type
NoiseTypeThe 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
x
intAn integer representing the X-coordinate in the 3D space for noise generation.
y
intAn integer representing the Y-coordinate in the 3D space for noise generation.
z
intAn integer representing the Z-coordinate in the 3D space for noise generation.
seed
uintAn optional 32-bit unsigned integer used to alter the randomness of the generated noise. The default value is 0.
type
NoiseTypeThe 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
x
intThe x-coordinate used in the noise generation process.
y
intThe y-coordinate used in the noise generation process.
z
intThe z-coordinate used in the noise generation process.
seed
uintA 32-bit unsigned integer used to control the randomness and reproducibility of the output. Defaults to 0 if not specified.
type
NoiseTypeThe 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
x
intThe x-coordinate as a signed integer representing the first dimension in the noise space.
y
intThe y-coordinate as a signed integer representing the second dimension in the noise space.
z
intThe z-coordinate as a signed integer representing the third dimension in the noise space.
w
intThe w-coordinate as a signed integer representing the fourth dimension in the noise space.
seed
uintAn optional 32-bit unsigned integer used to control the randomness of the noise generation. Defaults to 0.
type
NoiseTypeThe 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
x
intThe X-coordinate in the 4D space.
y
intThe Y-coordinate in the 4D space.
z
intThe Z-coordinate in the 4D space.
w
intThe W-coordinate in the 4D space.
seed
uintAn optional 32-bit unsigned integer used to control the randomness of the output. Defaults to 0 if not specified.
type
NoiseTypeThe 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
x
intThe X coordinate, an integer used to determine the noise position in the 4D space.
y
intThe Y coordinate, an integer used to determine the noise position in the 4D space.
z
intThe Z coordinate, an integer used to determine the noise position in the 4D space.
w
intThe W coordinate, an integer used to determine the noise position in the 4D space.
seed
uintA 32-bit unsigned integer used as a seed value to control the randomness of the output. Defaults to 0.
type
NoiseTypeThe 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
cell
int2The 2D coordinates of the cell as an
int2
structure.worldSeed
uintA seed value that determines the randomization of the noise function. The default value is 0.
type
NoiseTypeThe 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
cell
int3The 3D integer coordinates of the cell.
worldSeed
uintAn optional seed value to differentiate results across different worlds or contexts. Defaults to 0.
type
NoiseTypeThe 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
index
intA signed integer used to indicate the position or index for generating pseudo-random noise.
seed
uintA 32-bit unsigned integer used as an additional input to control the randomness of the output.
type
NoiseTypeThe 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
ulong2
representing 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
index
intA signed integer representing the index or position used for generating the pseudo-random value.
seed
uintA 32-bit unsigned integer serving as a secondary input to influence the randomness of the output.
type
NoiseTypeThe 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
p
float2A
float2
instance representing the 2D coordinates where the gradient should be evaluated.seed
uintA 32-bit unsigned integer used as an additional input to control the randomness of the Perlin noise.
eps
floatA small floating-point value representing the step size used for computing finite differences. Defaults to
1e-3f
.type
NoiseTypeThe noise generation type that influences the Perlin noise computation. Optional, defaults to
NoiseType.MangledBitsBalancedMix
.
Returns
- float2
A
float2
instance 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
p
float3The 3D point where the gradient is evaluated.
seed
uintThe seed value used for noise generation, ensuring determinism.
eps
floatThe small step size used for central difference computation. Default is 1e-3f.
type
NoiseTypeThe 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
x
floatThe x-coordinate of the noise input.
y
floatThe y-coordinate of the noise input.
z
floatThe z-coordinate of the noise input.
seed
uintA 32-bit unsigned integer used to control the pseudo-randomness of the noise generation.
type
NoiseTypeSpecifies 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
x
floatThe X coordinate (continuous) used for generating the noise value.
y
floatThe Y coordinate (continuous) used for generating the noise value.
seed
uintAn optional 32-bit unsigned integer seed to enhance the determinism of the noise generation. Defaults to 0 if not provided.
type
NoiseTypeThe 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
x
floatThe x-coordinate in the 3D noise space.
y
floatThe y-coordinate in the 3D noise space.
z
floatThe z-coordinate in the 3D noise space.
seed
uintThe seed value used for generating consistent noise output.
d
float3The resulting gradients of the Perlin noise, provided as a float3 vector.
type
NoiseTypeThe 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
x
floatThe x-coordinate for the noise calculation.
y
floatThe y-coordinate for the noise calculation.
seed
uintThe seed value used for deterministic noise generation.
d
float2The derivative of the noise with respect to x and y, returned as a float2.
type
NoiseTypeThe 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
p
float3The input 3D position for the noise function.
seed
uintThe seed value to ensure determinism in the generation. Default is 0.
octaves
intThe number of noise octaves used to compute the ridge noise. Default is 5.
frequency
floatThe starting frequency for the noise generation. Default is 1f.
amplitude
floatThe starting amplitude for the noise generation. Default is 1f.
lacunarity
floatThe frequency multiplier applied after each octave. Default is 2f.
gain
floatThe amplitude multiplier applied after each octave. Default is 0.5f.
ridgeOffset
floatThe offset applied to the ridge transformation. Default is 1.0f.
ridgeSharpness
floatThe sharpness applied to the ridge calculation. Default is 2.0f.
normalize
boolA boolean flag indicating whether the resulting noise values should be normalized across the range [-1, 1]. Default is true.
type
NoiseTypeThe 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
position
float2The 2D position at which to sample the noise.
seed
uintThe random seed used for generating the noise. Defaults to 0.
frequency
floatThe frequency of the noise. Defaults to 1.0.
type
NoiseTypeThe 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
position
float3The 3D position in space for which the noise value should be calculated.
seed
uintA seed value used to initialize the noise generation. Defaults to 0.
frequency
floatThe frequency of the noise, altering the scale at which it repeats. Defaults to 1.
type
NoiseTypeThe 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
p
float3The input 3D position for noise evaluation.
seed
uintThe seed value for noise generation, ensuring repeatability.
octaves
intThe number of noise layers (octaves) to compute for fBm.
frequency
floatThe base frequency of the noise function.
lacunarity
floatThe frequency multiplier for each successive octave.
gain
floatThe amplitude multiplier for each successive octave.
warp1Amp
floatAmplitude of the first domain warp.
warp1Freq
floatFrequency of the first domain warp.
warp1Oct
intNumber of octaves used for the first domain warp.
warp2Amp
floatAmplitude of the second domain warp.
warp2Freq
floatFrequency of the second domain warp.
warp2Oct
intNumber of octaves used for the second domain warp.
ridgeMix
floatThe weight used to mix the ridged noise component with fBm.
type
NoiseTypeThe 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
x
floatThe x-coordinate of the input point.
y
floatThe y-coordinate of the input point.
seed
uintA seed value for the noise generation.
grad
float2An output parameter that returns the 2D gradient vector of the noise value at the input point.
type
NoiseTypeThe 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
p
float2A
float2
representing the 2D position where the noise value is evaluated.seed
uintA 32-bit unsigned integer that determines the seed used for generating the noise.
grad
float2An output parameter of type
float2
that contains the gradient of the noise at the given position.type
NoiseTypeThe noise generation type that determines the method used for computing the noise values. Defaults to a predefined type if not provided.
Returns
- float
A
float
representing 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
p
float3The input position represented as a 3D vector.
seed
uintThe seed value used to ensure deterministic noise generation.
grad
float3The resulting gradient of the Perlin noise at the specified position.
type
NoiseTypeThe 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
p
float2The 2D position at which to evaluate the noise.
seed
uintThe seed value for randomization. Default is 0.
frequency
floatThe frequency of the noise pattern. Default is 0.01f.
jitter
floatThe amount of jitter to apply to cell points. Default is 0.1f.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to compute cellular distances. Default is Chebyshev.
edgeWidth
floatThe width of the edge blending between cells. Default is 0.1f.
type
NoiseTypeThe 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
p
float3The 3D position to sample the noise at.
seed
uintAn optional seed value to control the randomization of the noise.
frequency
floatThe frequency scale of the noise.
jitter
floatThe amount of randomness in the cell positions.
metric
HashBasedNoiseUtils.CellularDistanceThe cellular distance metric used for computing noise, such as Chebyshev or Euclidean.
edgeWidth
floatThe width of the edges between cells in the noise.
type
NoiseTypeThe 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
p
float2The 2D position for which the noise value is computed.
seed
uintAn optional seed value to introduce variability in noise generation. Defaults to 0.
frequency
floatThe frequency scale applied to the noise pattern. Defaults to 0.005.
jitter
floatThe level of jitter applied to the cell points. Higher values increase randomness. Defaults to 1.0.
metric
HashBasedNoiseUtils.CellularDistanceSpecifies the distance metric used in cellular noise calculations. Defaults to Euclidean.
edgeWidth
floatDefines the width of the edges between cells in the noise pattern. Defaults to 0.1.
type
NoiseTypeThe 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
p
float3The input 3D position for noise computation.
seed
uintThe seed value for noise generation, used to ensure deterministic results.
frequency
floatThe frequency scale of the noise pattern, determining its granularity.
jitter
floatThe amount of perturbation applied to feature points, affecting the noise detail.
metric
HashBasedNoiseUtils.CellularDistanceThe distance calculation mode (e.g., Euclidean, Manhattan, Chebyshev).
edgeWidth
floatThe width of the noise's edge transition, influencing edge smoothness.
type
NoiseTypeThe 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.