krubbles /
Icaria-Noise
A highly-optimized C# noise-function library.
Loading repository data…
krubbles / repository
Optimized noise library for C# using SIMD. Works with both Unity Burst and .NET Core.
NoiseDotNet is a coherent noise library written in C#. It is
It supports 4 basic noise functions:
And it supports 4 fractal (fBM) variants:
You add a #define QUADRATIC statement to the top of the NoiseImpls.cs file. to use the Quadratic noise algorithm instead of Perlin Noise.
Here are some preformance charts for NoiseDotNet, with FastNoise2 included as a baseline. Preformance is measured in nanoseconds per sample.
Profiled on a Ryzen 9 6900HS, AVX2 compadibility level, Windows 11. .NET 9.
| NoiseDotNet (CoreCLR) | NoiseDotNet (Unity) | FastNoise2 (Clang) | |
|---|---|---|---|
| Gradient2D (quadratic) | 1.35ns | 1.37ns | N/A |
| Gradient2D (perlin) | 1.14ns | 1.11ns | 1.62ns |
| Gradient3D (quadratic) | 2.97ns | 2.39ns | N/A |
| Gradient3D (perlin) | 2.57ns | 1.94ns | 3.93ns |
| Cellular2D | 2.67ns | 2.13ns | 7.29ns |
| Cellular3D | 16.3ns | 9.32ns | 22.7ns |
Profiled on an M4 Macbook Air. .NET 10.
| NoiseDotNet (CoreCLR) | NoiseDotNet (Unity) | FastNoise2 (Clang) | |
|---|---|---|---|
| Gradient2D (quadratic) | 1.71ns | 1.49ns | N/A |
| Gradient2D (perlin) | 1.32ns | 1.24ns | 2.55ns |
| Gradient3D (quadratic) | 2.98ns | 2.90ns | N/A |
| Gradient3D (perlin) | 2.44ns | 2.34ns | 5.03ns |
| Cellular2D | 2.78ns | 4.06ns | 9.40ns |
| Cellular3D | 10.89ns | 14.2ns | 25.8ns |
Copy the NoiseDotNet folder into your project, and remove the .csproj file if you are using Unity. That's it!
The noise functions are in the static Noise class in the NoiseDotNet namespace. Here is a short example of using the Noise class:
int width = 16, height = 16;
int sampleCount = width * height;
// here we create a 2D grid of points to evaluate the noise function on
float[] xCoords = new float[sampleCount];
float[] yCoords = new float[sampleCount];
int index = 0;
for (int y = 0; y < height; ++y)
for (int x = 0; x < width; ++x)
{
xCoords[index] = x;
yCoords[index] = y;
index++;
}
// allocating a buffer to use as the output
float[] output = new float[sampleCount];
// settings for the noise function evaluation. Supports xFreq, yFreq, zFreq, seed, amplitude, amplitude2
// second amplitude is used by cellular noise which has 2 outputs, cell center dist is amplitude and cell edge dist is amplitude2
// coordinates are multiplied by their corresponding frequencies before being passed into the noise function
// the outputs of the noise function are multipled by their corresponding amplitudes before being passed into the output buffer.
// note that if the amplitude is zero (which it defaults to if you default construct the settings struct), the output will always be zero.
// non-default constructors default amplitudes to 1.
// zFreq is ignored by 3D functions.
NoiseDotNet.NoiseSettings settings = new(xFreq: 0.1f, yFreq: 0.1f, seed: 100);
NoiseDotNet.Noise.GradientNoise2D(
xCoords: xCoords,
yCoords: yCoords,
output: output,
settings);
// The result of the noise function calculation is now in the output buffer.
// output[i] = GradientNoise(xCoords[i], yCoords[i])
Note: This repo is a newer version of my Icaria-Noise repo.
Selected from shared topics, language and repository description—not editorial ratings.
krubbles /
A highly-optimized C# noise-function library.
MathysFernandez /
A procedural 3D voxel engine developed in pure C, using the Raylib library. This project explores infinite terrain generation via Perlin noise and dynamic mesh optimization.
dalibor-frivaldsky /
C++, noise-generating, header-only library inspired by the libnoise library. It's aim is to provide various noise generating algorithms optimized for modern CPU architectures using SSE and AVX instruction sets. It also tries to keep the original public API of the libnoise library unchanged as much as possible to allow easy "Plug-and-Play"
AAT-RR /
A thread-safe, high-performance C/C++ dynamic link library (DLL) optimized for industrial acoustics, noise-vibration-harshness (NVH) testing, automated product quality screening, and lab-scale spectrum calculations.