NoiseDotNet

March 31, 2026 ยท View on GitHub

Overview

NoiseDotNet is a coherent noise library written in C#. It is

  • Extremely optimized (w/ SIMD acceleration)
  • Lightweight (single file you can drop into your project)
  • Compatible with both CoreCLR and Unity

It supports 4 basic noise functions:

  • Noise.GradientNoise2D
  • Noise.GradientNoise3D
  • Noise.CellularNoise2D
  • Noise.CellularNoise3D

And it supports 4 fractal (fBM) variants:

  • Noise.GradientNoise2D
  • Noise.GradientNoise3D
  • Noise.CellularNoise2D
  • Noise.CellularNoise3D

You add a #define QUADRATIC statement to the top of the NoiseImpls.cs file. to use the Quadratic noise algorithm instead of Perlin Noise.

Preformance

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.35ns1.37nsN/A
Gradient2D (perlin)1.14ns1.11ns1.62ns
Gradient3D (quadratic)2.97ns2.39nsN/A
Gradient3D (perlin)2.57ns1.94ns3.93ns
Cellular2D2.67ns2.13ns7.29ns
Cellular3D16.3ns9.32ns22.7ns

Profiled on an M4 Macbook Air. .NET 10.

NoiseDotNet (CoreCLR)NoiseDotNet (Unity)FastNoise2 (Clang)
Gradient2D (quadratic)1.71ns1.49nsN/A
Gradient2D (perlin)1.32ns1.24ns2.55ns
Gradient3D (quadratic)2.98ns2.90nsN/A
Gradient3D (perlin)2.44ns2.34ns5.03ns
Cellular2D2.78ns4.06ns9.40ns
Cellular3D10.89ns14.2ns25.8ns

How to add to your project

Copy the NoiseDotNet folder into your project, and remove the .csproj file if you are using Unity. That's it!

How to use

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.