Class
- Namespace
- CoreFramework.Random
Provides high-entropy stateless deterministic noise using a ChaCha-inspired mixing function.
[BurstCompile]
public static class SquirrelNoise64Bit
- Inheritance
-
object
Fields
DefaultNoiseType
A constant that defines the default noise type used in the SquirrelNoise64Bit methods. The default value is set to MangledBitsBalancedMix.
private const NoiseType DefaultNoiseType = MangledBitsBalancedMix
Field Value
Methods
Billow(float3, ulong, 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, ulong 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
ulongAn 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, ulong, float, float, CellularDistance, NoiseType)
Computes 2D cellular noise based on the input position, seed, frequency, and other custom parameters. This method evaluates the shortest and second shortest distances from the input position to the feature points within the cellular grid, returning the computed values along with additional information about the closest feature point and grid cell.
public static HashBasedNoiseUtils.Cellular2DResult Cellular2D(float2 p, ulong seed = 0, float frequency = 1, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
p
float2The input 2D position as a float2 value, representing the point in space where the cellular noise is evaluated.
seed
ulongAn optional unsigned 64-bit integer used to initialize the random number generator for noise computation, adding determinism and variability to the output.
frequency
floatThe scaling factor applied to the input position, controlling the density of features within the cellular grid. Default is 1.
jitter
floatThe displacement factor ranging from 0 to 1, which determines how much feature points are offset from their grid positions. Higher values result in more irregular patterns. Default is 1.
metric
HashBasedNoiseUtils.CellularDistanceSpecifies the distance metric used for computing distances between the input position and feature points (e.g., Euclidean, Manhattan, or Chebyshev). Default is Euclidean.
type
NoiseTypeDefines the noise type, determining the underlying hash algorithm and the approach for mixing values. Default is the framework's default noise type.
Returns
- HashBasedNoiseUtils.Cellular2DResult
An instance of the Cellular2DResult struct, containing the shortest distance, second shortest distance, closest feature point's position, and grid cell coordinates of the closest feature point.
Cellular3D(float3, ulong, float, float, CellularDistance, NoiseType)
Generates cellular noise in 3D space using the specified position, seed, frequency, and noise parameters.
public static HashBasedNoiseUtils.Cellular3DResult Cellular3D(float3 p, ulong seed = 0, float frequency = 1, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
p
float3The 3D position at which to evaluate the cellular noise.
seed
ulongA 64-bit unsigned integer seed used to introduce variability in the generated noise.
frequency
floatThe frequency of the noise, determining its scale or repetition. Higher values result in finer details.
jitter
floatThe amount of randomness applied to the base cell locations, affecting the “jitteriness” of the pattern.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to compute cellular distances between feature points (e.g., Euclidean, Manhattan).
type
NoiseTypeThe noise generation type that specifies the algorithm for mixing and producing noise results.
Returns
- HashBasedNoiseUtils.Cellular3DResult
An object containing information about the first and second closest distances to feature points, as well as the corresponding cell position and feature point location.
CellularEdge01(float2, ulong, float, float, CellularDistance, float, NoiseType)
Computes a value representing a cellular noise effect with a smooth edge transition between different cells, normalized to the range [0, 1].
public static float CellularEdge01(float2 p, ulong 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 at which to evaluate the cellular noise.
seed
ulongA 64-bit unsigned integer seed to add randomness to the noise generation.
frequency
floatThe frequency of the noise, controlling the scale and spacing of cells.
jitter
floatThe amount of positional variation applied to the cell points, influencing the randomness of cell shapes.
metric
HashBasedNoiseUtils.CellularDistanceThe distance calculation method used to evaluate the proximity between cell points, such as Euclidean or Manhattan.
edgeWidth
floatThe width of the transition area between different cells, affecting the sharpness of the edges.
type
NoiseTypeThe noise generation type, specifying the underlying algorithm for computing noise values.
Returns
- float
A floating-point value normalized to the range [0, 1], representing the computed cellular edge noise at the given position.
CellularEdge01(float3, ulong, float, float, CellularDistance, float, NoiseType)
Computes a smooth noise value representing a cellular pattern with a customizable edge effect, based on the provided position, seed, frequency, jitter, and edge parameters.
public static float CellularEdge01(float3 p, ulong 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 in space used to sample the noise value.
seed
ulongA 64-bit unsigned integer that introduces randomness to the generated noise. Defaults to 0.
frequency
floatA scalar value that scales the frequency of the cellular noise pattern. Higher values create more detailed patterns. Defaults to 0.006.
jitter
floatA factor controlling the randomness or displacement of cell centers. Higher values lead to more jittered patterns. Defaults to 0.9.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to compute the cellular noise. Defaults to Euclidean.
edgeWidth
floatThe width of the transition between cell edges and their interiors. Smaller values create sharper edges. Defaults to 0.12.
type
NoiseTypeThe noise generation type, specifying the algorithm or mixing strategy for noise computation. Defaults to MangledBitsBalancedMix.
Returns
- float
A floating-point value in the range [0, 1] representing the computed cellular noise with the specified edge effect applied.
CellularEdgeExp01(float2, ulong, float, float, CellularDistance, float, NoiseType)
Computes a value based on cellular noise and transforms it using an exponential decay function, providing a smoothly blended result between cellular distances.
public static float CellularEdgeExp01(float2 p, ulong 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 coordinate used to calculate the cellular noise at a specific position in space.
seed
ulongA seed value used to introduce randomness to the cellular noise calculation. Defaults to 0.
frequency
floatThe frequency of the cellular noise, determining the scale of features. Defaults to 0.005.
jitter
floatThe jitter factor controlling the variability in cell placements within the noise grid. Defaults to 1.0.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to compute cell boundaries, such as Euclidean, Manhattan, or Chebyshev. Defaults to Euclidean.
k
floatA sharpness factor for the exponential decay applied to the cellular noise result. Defaults to 8.0.
type
NoiseTypeThe noise generation type defining the mixing and hashing algorithm for the noise computation. Defaults to MangledBitsBalancedMix.
Returns
- float
A float value in the range [0, 1] representing the transformed cellular noise result, biased by the exponential function.
CellularEdgeExp01(float3, ulong, float, float, CellularDistance, float, NoiseType)
Computes a non-linear cellular noise value in a clamped range of [0, 1], using an exponential vein contrast effect based on the input position and parameters.
public static float CellularEdgeExp01(float3 p, ulong seed = 0, float frequency = 0.006, float jitter = 0.9, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, float k = 8, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
p
float3The 3D position vector used as input for the cellular noise computation.
seed
ulongA 64-bit unsigned integer that introduces randomness into the noise calculation. Defaults to 0.
frequency
floatThe frequency of the noise, scaling the input space. Defaults to 0.006f.
jitter
floatA value controlling the irregularity in the distance calculation of cellular features. Defaults to 0.9f.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to compute cellular noise features, such as Euclidean, Manhattan, or Chebyshev. Defaults to CellularDistance.Euclidean.
k
floatA scalar influencing the exponential contrast of the cellular vein effect. Higher values sharpen the contrast. Defaults to 8f.
type
NoiseTypeThe noise generation method to determine the mixing algorithm for noise computation. Defaults to NoiseType.MangledBitsBalancedMix.
Returns
- float
A clamped noise value in the range [0, 1] with non-linear vein structures based on the input parameters.
CellularEdgeSigned(float2, ulong, float, float, CellularDistance, float, NoiseType)
Computes a signed cellular edge noise value in the range [-1, 1] for a given 2D point, based on the provided parameters such as seed, frequency, jitter, distance metric, edge width, and noise type.
public static float CellularEdgeSigned(float2 p, ulong 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 input point for which the noise value is computed.
seed
ulongAn optional 64-bit unsigned integer seed value used to introduce randomness into the noise computation.
frequency
floatA scaling factor that determines the frequency of the noise pattern. Higher values result in more dense patterns.
jitter
floatThe amount of randomness applied to cell points for noise generation. Higher values create more irregular patterns.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to calculate distances between points for cellular noise. Options include Euclidean, Manhattan, and Chebyshev.
edgeWidth
floatThe normalized width of the cellular edges, controlling the transition area between cells.
type
NoiseTypeThe noise generation algorithm type, determining how input values are processed and mixed to produce the noise.
Returns
- float
A signed floating-point value in the range [-1, 1] representing the computed cellular edge noise for the given 2D point.
CellularEdgeSigned(float3, ulong, float, float, CellularDistance, float, NoiseType)
Computes a signed cellular edge noise value based on the given 3D position, seed, frequency, jitter, distance metric, edge width, and noise generation type. The result is remapped to the range [-1, 1].
public static float CellularEdgeSigned(float3 p, ulong 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 point for which the cellular edge noise should be computed.
seed
ulongA 64-bit unsigned integer that adds randomness to the noise computation. Defaults to 0.
frequency
floatControls the frequency of the noise. Higher values result in more granular noise variation. Defaults to 0.006.
jitter
floatAdjusts the randomness of the cell point distribution. Higher values increase irregularity. Defaults to 0.9.
metric
HashBasedNoiseUtils.CellularDistanceSpecifies the distance metric used for calculating cellular distances (e.g., Euclidean, Manhattan, Chebyshev). Defaults to Euclidean.
edgeWidth
floatDetermines the blend width at the edges of cells. Smaller values create sharper edges. Defaults to 0.12.
type
NoiseTypeSpecifies the noise generation type, which determines the method and mixing algorithm used. Defaults to MangledBitsBalancedMix.
Returns
- float
A signed floating-point noise value in the range [-1, 1] derived from cellular edge computation.
CellularF1(float2, ulong, 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, ulong 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
ulongThe 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, ulong, 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, ulong 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
ulongThe 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, ulong, float, float, CellularDistance, NoiseType)
Computes a value between 0 and 1 based on cellular noise, given a 2D position, seed, frequency, jitter, distance metric, and noise type. Normalized F1 fill in [0,1] (2D)
public static float CellularFill01(float2 p, ulong seed = 0, float frequency = 1, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
p
float2The 2D position point where the cellular noise is sampled.
seed
ulongAn optional 64-bit seed for randomness to diversify noise generation.
frequency
floatThe frequency of the noise, adjusting the scale of the generated pattern.
jitter
floatThe degree of irregularity added to the noise cell boundaries for variation.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used for calculating cellular distances, influencing the noise structure.
type
NoiseTypeThe noise generation type, determining the algorithm used for mixing noise values.
Returns
- float
A floating-point value normalized between 0 and 1, representing the result of cellular noise computation.
CellularFill01(float3, ulong, float, float, CellularDistance, NoiseType)
Computes a 0-1 normalized cellular noise pattern at a specific 3D point based on the provided seed, frequency, jitter, distance metric, and noise generation type. Normalized F1 fill in [0,1] (3D)
public static float CellularFill01(float3 p, ulong seed = 0, float frequency = 1, float jitter = 1, HashBasedNoiseUtils.CellularDistance metric = CellularDistance.Euclidean, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
p
float3The 3D point at which the cellular noise is computed.
seed
ulongA 64-bit unsigned integer seed value that introduces randomness into the pattern.
frequency
floatThe frequency of the noise, which alters the scale and detail of the pattern. Higher values produce finer details.
jitter
floatThe degree of irregularity or randomness in the cellular noise's grid cells. Ranges between 0 (no jitter) and 1 (maximum jitter).
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to compute cellular distances, such as Euclidean, Manhattan, or Chebyshev.
type
NoiseTypeThe noise generation type, controlling the underlying computation method for the noise values.
Returns
- float
A floating-point value between 0 and 1 representing the normalized cellular noise result at the given 3D point.
DomainWarp(float3, ulong, float, float, int, float, float, int, float, float, float, NoiseType)
Applies domain warping to a position in 3D space using fractal Brownian motion (FBm) as the primary technique, resulting in a distorted yet consistent noise value.
public static float DomainWarp(float3 p, ulong 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 to be warped, represented as a float3 structure.
seed
ulongAn optional 64-bit unsigned integer seed used to randomize the noise generation process. Default is 0.
warpAmplitude
floatThe amplitude of the warp, which controls the intensity of the distortion. Default is 1f.
warpFrequency
floatThe frequency of the domain warp, influencing the granularity of the warp. Default is 0.5f.
warpOctaves
intThe number of warp octaves, which controls the layering of warp detail. Default is 1.
warpLacunarity
floatThe lacunarity scaling factor between warp octaves. Higher values increase the frequency of each sequential octave. Default is 2f.
warpGain
floatThe gain factor that controls the contribution of each subsequent warp octave to the overall warp effect. Default is 0.5f.
valueOctaves
intThe number of octaves used for the evaluation of the warped position, which affects noise detail. Default is 5.
valueFrequency
floatThe frequency used in evaluating the final noise value at the warped position. Default is 1f.
valueGain
floatThe gain factor for the evaluation of noise value octaves. It influences the amplitude of subsequent octaves. Default is 0.5f.
valueLacunarity
floatThe lacunarity scaling factor for the evaluation of noise value octaves. Default is 2f.
type
NoiseTypeThe noise generation type, which determines the algorithm used for noise computation. Default is MangledBitsBalancedMix.
Returns
- float
A single-precision floating-point value representing the computed noise at the warped 3D position.
FBm(float3, ulong, 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, ulong 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
ulongA 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(ulong, ulong, NoiseType)
Computes a 1D noise value as a 32-bit unsigned integer based on the given index, seed, and noise generation algorithm type.
public static uint Get1DNoise(ulong index, ulong seed, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
index
ulongThe input index used to determine the specific noise value computation.
seed
ulongA 64-bit unsigned integer used as a seed for generating deterministic noise.
type
NoiseTypeThe noise generation type, specified by the NoiseType enumeration, which determines the algorithm and mixing strategy employed during computation.
Returns
- uint
A 32-bit unsigned integer representing the computed 1D noise value.
Get1DNoise01(ulong, ulong, NoiseType)
Generates a 1D noise value normalized to the range [0, 1].
public static float Get1DNoise01(ulong index, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
index
ulongThe index used to compute the noise value.
seed
ulongThe seed value for randomization, defaulting to 0 if not provided.
type
NoiseTypeThe type of noise algorithm to apply, defined by the NoiseType enumeration.
Returns
- float
A single-precision floating-point noise value in the range [0, 1].
Get1DNoiseNeg1To1(ulong, ulong, NoiseType)
Generates a 1D noise value normalized to the range of -1 to 1.
public static float Get1DNoiseNeg1To1(ulong index, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
index
ulongThe index used to calculate the noise value.
seed
ulongThe seed value for ensuring deterministic noise generation.
type
NoiseTypeThe type of noise algorithm to apply, defined by the NoiseType enumeration.
Returns
- float
A floating-point noise value in the range of -1 to 1.
Get2DNoise(ulong, ulong, ulong, NoiseType)
Generates a 2D noise value based on the given x and y coordinates and an optional seed using a deterministic algorithm.
public static uint Get2DNoise(ulong x, ulong y, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
ulongThe x-coordinate of the point for which to generate 2D noise.
y
ulongThe y-coordinate of the point for which to generate 2D noise.
seed
ulongAn optional seed value to modify the noise output. Defaults to 0.
type
NoiseTypeThe type of noise algorithm to apply, defined by the NoiseType enumeration.
Returns
- uint
A 32-bit unsigned integer representing the generated 2D noise value.
Get2DNoise01(ulong, ulong, ulong, NoiseType)
Generates a 2D procedural noise value normalized to the range [0, 1].
public static float Get2DNoise01(ulong x, ulong y, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
ulongThe x-coordinate of the input position.
y
ulongThe y-coordinate of the input position.
seed
ulongA value used to seed the noise generation process, defaulting to 0.
type
NoiseTypeThe type of noise algorithm to apply, defined by the NoiseType enumeration.
Returns
- float
A float value representing the 2D noise, normalized to the range [0, 1].
Get2DNoiseNeg1To1(ulong, ulong, ulong, NoiseType)
Generates a 2D noise value within the range [-1, 1] based on the provided coordinates and seed.
public static float Get2DNoiseNeg1To1(ulong x, ulong y, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
ulongThe x-coordinate used for the noise generation.
y
ulongThe y-coordinate used for the noise generation.
seed
ulongAn optional seed value for the noise function. Defaults to 0.
type
NoiseTypeThe type of noise algorithm to apply, defined by the NoiseType enumeration.
Returns
- float
A floating-point noise value in the range [-1, 1].
Get3DNoise(ulong, ulong, ulong, ulong, NoiseType)
Generates a pseudo-random 3D noise value based on the specified coordinates and seed.
public static uint Get3DNoise(ulong x, ulong y, ulong z, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
ulongThe X-coordinate for the 3D noise.
y
ulongThe Y-coordinate for the 3D noise.
z
ulongThe Z-coordinate for the 3D noise.
seed
ulongAn optional seed value to influence the noise generation.
type
NoiseTypeThe type of noise algorithm to apply, defined by the NoiseType enumeration.
Returns
- uint
A pseudo-random 3D noise value as a 32-bit unsigned integer.
Get3DNoise01(ulong, ulong, ulong, ulong, NoiseType)
Generates a 3D noise value mapped to the range [0, 1].
public static float Get3DNoise01(ulong x, ulong y, ulong z, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
ulongThe x-coordinate of the 3D point.
y
ulongThe y-coordinate of the 3D point.
z
ulongThe z-coordinate of the 3D point.
seed
ulongAn optional seed value for noise generation. Default is 0.
type
NoiseTypeThe type of noise algorithm to apply, defined by the NoiseType enumeration.
Returns
- float
A pseudo-random noise value in the range [0, 1].
Get3DNoiseNeg1To1(ulong, ulong, ulong, ulong, NoiseType)
Generates 3D noise in the range of -1 to 1 based on x, y, z coordinates and a seed value.
public static float Get3DNoiseNeg1To1(ulong x, ulong y, ulong z, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
ulongThe x-coordinate of the noise point.
y
ulongThe y-coordinate of the noise point.
z
ulongThe z-coordinate of the noise point.
seed
ulongAn optional seed value to initialize the noise generation, defaulting to 0.
type
NoiseTypeThe type of noise algorithm to apply, defined by the NoiseType enumeration.
Returns
- float
A floating-point noise value in the range of -1 to 1.
Get4DNoise(ulong, ulong, ulong, ulong, ulong, NoiseType)
Generates a pseudo-random 4D noise value based on the specified coordinates and seed.
public static uint Get4DNoise(ulong x, ulong y, ulong z, ulong w, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
ulongThe x-coordinate.
y
ulongThe y-coordinate.
z
ulongThe z-coordinate.
w
ulongThe w-coordinate.
seed
ulongThe seed used to initialize the noise generation. Default is 0.
type
NoiseTypeThe type of noise algorithm to apply, defined by the NoiseType enumeration.
Returns
- uint
A 32-bit unsigned integer representing the generated 4D noise value.
Get4DNoise01(ulong, ulong, ulong, ulong, ulong, NoiseType)
Generates 4D noise as a float value in the range [0, 1].
public static float Get4DNoise01(ulong x, ulong y, ulong z, ulong w, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
ulongThe x-coordinate of the 4D noise.
y
ulongThe y-coordinate of the 4D noise.
z
ulongThe z-coordinate of the 4D noise.
w
ulongThe w-coordinate of the 4D noise.
seed
ulongThe seed value used for randomizing the noise generation. Defaults to 0 if not specified.
type
NoiseTypeThe type of noise algorithm to apply, defined by the NoiseType enumeration.
Returns
- float
A float value representing the 4D noise in the range [0, 1].
Get4DNoiseNeg1To1(ulong, ulong, ulong, ulong, ulong, NoiseType)
Generates a 4D noise value mapped to the range [-1, 1].
public static float Get4DNoiseNeg1To1(ulong x, ulong y, ulong z, ulong w, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
ulongThe x-coordinate in the 4D space.
y
ulongThe y-coordinate in the 4D space.
z
ulongThe z-coordinate in the 4D space.
w
ulongThe w-coordinate in the 4D space.
seed
ulongThe seed value to control the noise generation.
type
NoiseTypeThe type of noise algorithm to apply, defined by the NoiseType enumeration.
Returns
- float
A floating-point noise value in the range [-1, 1].
GetCellSeed2D(int2, ulong, NoiseType)
Generates a 64-bit hash-based seed for a specified 2D cell coordinate using a given world seed and noise generation type.
public static ulong GetCellSeed2D(int2 cell, ulong worldSeed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
cell
int2The 2D cell coordinate specified as an int2 structure, which determines the location for seed generation.
worldSeed
ulongAn optional 64-bit unsigned integer used to introduce additional randomness into the generated seed. Defaults to 0 if not specified.
type
NoiseTypeSpecifies the noise generation algorithm used to compute the seed, defaulting to MangledBitsBalancedMix.
Returns
- ulong
Returns a 64-bit unsigned integer representing the computed seed value for the specified 2D cell.
GetCellSeed3D(int3, ulong, NoiseType)
Computes a 64-bit noise value specific to a 3D cell location, based on the provided cell coordinates, world seed, and noise generation type.
public static ulong GetCellSeed3D(int3 cell, ulong worldSeed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
cell
int3The 3D cell coordinates represented as an int3 structure, specifying the x, y, and z positions.
worldSeed
ulongA 64-bit unsigned integer seed applied to add randomness to the noise generation. Default is 0.
type
NoiseTypeThe noise generation type that determines the algorithm and mixing used for computation. Default is MangledBitsBalancedMix.
Returns
- ulong
A 64-bit unsigned integer representing the computed noise for the specified 3D cell.
GetUInt128(ulong, ulong, NoiseType)
Computes a 128-bit unsigned integer noise value consisting of two 64-bit parts, based on the provided index, seed, and noise generation type.
public static ulong2 GetUInt128(ulong index, ulong seed, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
index
ulongThe index value used to compute the noise, influencing the position or state of the generated noise.
seed
ulongA 64-bit unsigned integer that adds randomness to the computed noise.
type
NoiseTypeThe noise generation type, which determines the method and mixing algorithm used for noise computation.
Returns
- ulong2
A 128-bit unsigned integer represented as a struct containing two 64-bit parts of computed noise.
GetUInt64(ulong, ulong, NoiseType)
Computes a 64-bit unsigned integer noise value based on the provided index, seed, and noise generation type.
public static ulong GetUInt64(ulong index, ulong seed, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
index
ulongThe index value used to compute the noise, influencing the position or state of the generated noise.
seed
ulongA 64-bit unsigned integer that adds randomness to the computed noise.
type
NoiseTypeThe noise generation type, which determines the method and algorithm used for noise computation. Defaults to MangledBitsBalancedMix.
Returns
- ulong
A 64-bit unsigned integer representing the computed noise value.
GradientCentral(float2, ulong, float, NoiseType)
Computes the central gradient of a 2D Perlin noise function at a given position, using small directional offsets along the x and y axes.
public static float2 GradientCentral(float2 p, ulong seed, float eps = 0.001, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
p
float2The 2D position at which the gradient should be calculated.
seed
ulongA 64-bit unsigned integer value that provides randomness for the Perlin noise calculation.
eps
floatA small offset value used for finite difference calculations to approximate the derivatives. Default is 1e-3.
type
NoiseTypeThe noise generation type, determining the algorithm used for noise computation. Default is MangledBitsBalancedMix.
Returns
- float2
A float2 structure representing the gradient vector at the specified position, with x and y components calculated based on Perlin noise.
GradientCentral(float3, ulong, 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 a central difference with a small epsilon step size for numerical differentiation.
public static float3 GradientCentral(float3 p, ulong seed, float eps = 0.001, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
p
float3The 3D point where the gradient is evaluated.
seed
ulongThe seed value used for noise generation, ensuring determinism.
eps
floatThe small step size used for central difference computation. The default is 1e-3f.
type
NoiseTypeThe type of noise function used, defaulting to MangledBitsBalancedMix.
Returns
Perlin(float, float, float, ulong, NoiseType)
Computes a Perlin noise value for a specific 3D point using optional settings for seed value and noise computation type.
public static float Perlin(float x, float y, float z, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
floatThe X-coordinate of the input point in 3D space.
y
floatThe Y-coordinate of the input point in 3D space.
z
floatThe Z-coordinate of the input point in 3D space.
seed
ulongAn optional 64-bit unsigned seed value for adding randomness, defaulting to 0.
type
NoiseTypeAn optional noise type specifying the computation method, defaulting to a balanced mix.
Returns
- float
A single-precision floating-point value representing the computed Perlin noise at the given 3D coordinates.
Perlin(float, float, ulong, NoiseType)
Computes Perlin noise value for the specified 2D coordinates (x, y) using the given seed and noise type.
public static float Perlin(float x, float y, ulong seed = 0, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
floatThe x-coordinate of the sample point in the 2D noise field.
y
floatThe y-coordinate of the sample point in the 2D noise field.
seed
ulongAn optional 64-bit unsigned integer seed providing additional randomness to the noise output. Defaults to 0.
type
NoiseTypeThe noise generation algorithm type used for computing the noise. Defaults to the system's default noise type.
Returns
- float
A single-precision floating-point value representing the computed Perlin noise at the specified coordinates.
PerlinWithDeriv(float, float, float, ulong, out float3, NoiseType)
Computes Perlin noise with derivatives for the given 3D position, seed, and noise generation type.
public static float PerlinWithDeriv(float x, float y, float z, ulong seed, out float3 d, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
floatThe x-coordinate of the position in 3D space for noise computation.
y
floatThe y-coordinate of the position in 3D space for noise computation.
z
floatThe z-coordinate of the position in 3D space for noise computation.
seed
ulongA 64-bit unsigned integer seed value to control the randomness of the noise behavior.
d
float3An output parameter representing the 3D gradient of the noise at the specified position.
type
NoiseTypeThe noise generation type determining how the noise and gradients are computed.
Returns
- float
A single-precision floating-point value representing the computed Perlin noise at the specified position.
PerlinWithDeriv(float, float, ulong, out float2, NoiseType)
Computes a Perlin noise value at the specified 2D coordinates with derivatives, based on the provided seed and noise type.
public static float PerlinWithDeriv(float x, float y, ulong seed, out float2 d, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
x
floatThe X-coordinate of the input position.
y
floatThe Y-coordinate of the input position.
seed
ulongA 64-bit unsigned integer used as a randomization seed for the noise generation.
d
float2An output parameter that contains the 2D derivatives of the noise in the X and Y directions.
type
NoiseTypeThe noise generation type, which defines the method used for noise computation and mixing.
Returns
- float
A floating-point value representing the computed Perlin noise at the specified coordinates.
Ridge(float3, ulong, 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, ulong 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
ulongThe 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, ulong, float, NoiseType)
Computes a 2D Simplex noise value based on the specified position, seed, frequency, and noise type.
public static float Simplex2DCore(float2 position, ulong seed = 0, float frequency = 1, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
position
float2The 2D coordinates at which the noise value is to be computed.
seed
ulongA 64-bit unsigned integer used to initialize the random sequence for noise generation. Defaults to 0.
frequency
floatA scaling factor that determines the spatial frequency of the noise. Defaults to 1.
type
NoiseTypeThe noise computation type, influencing the gradient mixing method. Defaults to DefaultNoiseType.
Returns
- float
A floating-point number representing the computed Simplex noise value, scaled to approximately the range [-1, 1].
Simplex3DCore(float3, ulong, float, NoiseType)
Calculates a 3D Simplex noise value at the given position using the specified seed, frequency, and noise type.
public static float Simplex3DCore(float3 position, ulong seed = 0, float frequency = 1, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
position
float3The 3D position at which to evaluate the noise function.
seed
ulongAn optional 64-bit unsigned integer to seed the noise generation, providing deterministic randomness.
frequency
floatThe frequency of the noise, scaling the input position to control the level of detail.
type
NoiseTypeThe noise generation type, determining the method used for gradient computation and noise variation.
Returns
- float
A single-precision floating-point value representing the computed 3D Simplex noise.
UberNoise(float3, ulong, 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, ulong 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 3D position in space where the noise is evaluated.
seed
ulongA 64-bit unsigned integer used to initialize noise computation for added randomness. Default is 0.
octaves
intThe number of layers of fractal Brownian motion applied. Default is 6.
frequency
floatThe base frequency of the noise pattern. Default is 1.
lacunarity
floatThe scaling factor applied to the frequency for each octave. Default is 2.
gain
floatThe amplitude reduction factor for each successive octave. Default is 0.5.
warp1Amp
floatThe amplitude of the first domain warp. Default is 0.75.
warp1Freq
floatThe frequency of the first domain warp. Default is 0.5.
warp1Oct
intThe number of octaves used for the first domain warp. Default is 2.
warp2Amp
floatThe amplitude of the second domain warp. Default is 0.35.
warp2Freq
floatThe frequency of the second domain warp. Default is 1.2.
warp2Oct
intThe number of octaves used for the second domain warp. Default is 2.
ridgeMix
floatThe blend factor for mixing the ridged noise component with the primary noise. Default is 0.3.
type
NoiseTypeThe noise type used for all operations. Default is the predefined noise type.
Returns
- float
A floating-point value representing the computed noise, clamped within the range [-1, 1].
ValueAndGrad(float, float, ulong, 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, ulong 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
ulongA 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, ulong, out float2, NoiseType)
Computes the Perlin noise value at a given 2D coordinate, along with its gradient at that point, based on the provided seed and noise generation type.
public static float ValueAndGrad(float2 p, ulong seed, out float2 grad, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
p
float2A 2D coordinate represented as a float2 structure, specifying the point for which the noise value and gradient are computed.
seed
ulongA 64-bit unsigned integer that introduces randomness into the noise generation process.
grad
float2An output parameter that stores the computed gradient as a float2 structure for the given 2D point.
type
NoiseTypeThe noise generation type, determining the algorithm and mixing method used for computing the noise value and gradient.
Returns
- float
A single-precision floating-point value representing the computed Perlin noise at the specified 2D coordinate.
ValueAndGrad(float3, ulong, out float3, NoiseType)
Computes the Perlin noise value at the given point and calculates its gradient.
public static float ValueAndGrad(float3 p, ulong seed, out float3 grad, NoiseType type = NoiseType.MangledBitsBalancedMix)
Parameters
p
float3The input position represented as a 3D vector.
seed
ulongThe 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, ulong, float, float, CellularDistance, float, NoiseType)
Computes a 2D blocky Worley noise value based on the provided parameters. This function evaluates cellular noise and generates smooth transitions influenced by jitter and distance metrics. Defaults: Chebyshev, jitter=0.1, freq=0.01, edgeWidth=0.1.
public static float WorleyBlocky2D(float2 p, ulong 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 in space where the noise value will be sampled.
seed
ulongA 64-bit unsigned integer that introduces randomness to the noise generation process.
frequency
floatDetermines the frequency or “scale” of the noise pattern. Smaller values spread noise features further apart.
jitter
floatControls the variability of the cell center points, affecting the randomness of the generated pattern.
metric
HashBasedNoiseUtils.CellularDistanceSpecifies the distance metric used to calculate the cellular noise, influencing the shape of the noise cells.
edgeWidth
floatDefines the thickness of the edges between the noise cells. Higher values result in thicker transitions.
type
NoiseTypeThe noise generation type, impacting internal computation and mixing operations for noise synthesis.
Returns
- float
A floating-point value representing the computed 2D Worley blocky noise at the specified position.
WorleyBlocky3D(float3, ulong, float, float, CellularDistance, float, NoiseType)
Computes a 3D blocky Worley noise value based on the given input parameters, allowing customization of frequency, jitter, distance metrics, and edge width.
public static float WorleyBlocky3D(float3 p, ulong 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 at which the Worley noise is evaluated, represented as a float3.
seed
ulongThe base seed used for randomization, influencing variability in noise generation. Defaults to 0 if unspecified.
frequency
floatThe frequency of the noise, controlling the scale and number of cells in 3D space. Defaults to 0.012f if unspecified.
jitter
floatThe amount of randomness applied to cell points, ranging from 0 (no jitter) to higher values increasing randomness. Defaults to 0.1f.
metric
HashBasedNoiseUtils.CellularDistanceThe cellular distance metric used when determining proximity, such as Euclidean, Manhattan, or Chebyshev. Defaults to Chebyshev.
edgeWidth
floatThe width of the edges between cells, controlling transition smoothness between cell boundaries. Defaults to 0.12f.
type
NoiseTypeThe noise generation type that determines the mixing algorithm used during computation. Defaults to MangledBitsBalancedMix.
Returns
- float
A floating-point value representing the computed Worley 3D noise, ranging within [-1, 1].
WorleyWormy2D(float2, ulong, float, float, CellularDistance, float, NoiseType)
Generates a 2D Worley noise value based on the provided parameters, with additional control over frequency, jitter, and edge width.
public static float WorleyWormy2D(float2 p, ulong 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
ulongA 64-bit unsigned integer used to introduce randomness into the noise computation. Default is 0.
frequency
floatThe frequency of the noise pattern, determining the scale or repetition of features. Default is 0.005f.
jitter
floatThe level of randomness applied to cell points, affecting the distortion of the noise. Default is 1.0f.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used for computation, defining how distances between points are measured (e.g., Euclidean). Default is Euclidean.
edgeWidth
floatThe width of the edges in the noise pattern, controlling the interpolation around cellular boundaries. Default is 0.1f.
type
NoiseTypeThe noise generation type, dictating the method and mixing algorithm used in the calculation. Default is MangledBitsBalancedMix.
Returns
- float
A floating-point value representing the computed 2D Worley noise at the specified position and parameters.
WorleyWormy3D(float3, ulong, float, float, CellularDistance, float, NoiseType)
Generates a 3D cellular noise value with additional control over frequency, jitter, edge width, and distance metric, customized for a “Worley Wormy” effect.
public static float WorleyWormy3D(float3 p, ulong 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 coordinate at which to evaluate the noise.
seed
ulongAn optional seed for randomness to ensure variation in noise generation.
frequency
floatThe frequency of the noise, controlling its scale and detail.
jitter
floatControls the randomness of feature-point distribution within grid cells.
metric
HashBasedNoiseUtils.CellularDistanceThe distance metric used to compute cell distances, influencing the noise pattern.
edgeWidth
floatThe width of the transition between cells, affecting the sharpness or smoothness of edges.
type
NoiseTypeSpecifies the noise generation type, determining the algorithm used for computation.
Returns
- float
A float value representing the 3D noise at the given coordinate, customized with the provided parameters.