FastNoise Lite Released!

A faster and more portable version of the original.

Hello!

Today FastNoise Lite made its first stable release, being both faster and more portable than the original, while still offering the same customisation and features of the original. The library has been redesigned from the ground up to allow for easier porting to more languages, including procedural languages such as C.

For those who do not know, FastNoise (now Lite) is a coherent noise library, with a focus on speed. This library is optimised for realtime use, for example in games or simulations. Making this library portable allows it to run on many more platforms than the original, for example in shaders with the HLSL port (Allowing for use of noise in vertex, fragment or even compute shaders).

The FastNoise Lite API is also far more simple in comparison to the original, with only 2 methods to retrieve noise (one for each dimension).

FastNoise Lite features:

  • 2D & 3D noise
  • OpenSimplex2 Noise
  • OpenSimplex2S Noise
  • Cellular (Voronoi) Noise
  • Perlin Noise
  • Value Noise
  • Value Cubic Noise
  • OpenSimplex2-based Domain Warp
  • Basic Grid Domain Warp
  • Multiple fractal options for all of the above
  • Supports floats or doubles.

FastNoise Lite is officially available for the following languages:

  • C#
  • C++98
  • C99
  • Java
  • HLSL

Here is an example in C# of generating simplex noise in a 512x512 grid and storing the data in an array.

1// Create and configure FastNoise object
2FastNoiseLite noise = new FastNoiseLite(1337);
3noise.SetNoiseType(FastNoiseLite.NoiseType.OpenSimplex2);
4
5// Gather noise data
6var noiseData = new float[512 * 512];
7int index = 0;
8for (int x = 0; x < 512; x++)
9{
10    for (int y = 0; y < 512; y++)
11    {
12        noiseData[index++] = noise.GetNoise(x, y);
13    }
14}
15
16// Do something with this data...
C#

Here is that very same example in C (HLSL has the exact same API)

1// Create and configure noise state
2fnl_state noise = fnlCreateState(1337);
3noise.noise_type = FNL_NOISE_OPENSIMPLEX2;
4
5// Gather noise data
6float *noiseData = malloc(512 * 512 * sizeof(float));
7int index = 0;
8for (int x = 0; x < 512; x++) {
9    for (int y = 0; y < 512; y++) {
10        noiseData[index++] = fnlGetNoise2D(&noise, x, y);
11    }
12}
13
14// Do something with this data...
15
16// Free data later
17free(noiseData);
C

And again in C++,

1// Create and configure FastNoise object.
2FastNoiseLite noise = FastNoiseLite(1337);
3noise.SetNoiseType(FastNoiseLite::NoiseType_OpenSimplex2);
4
5// Gather noise data
6float *noiseData = new float[512 * 512];
7int index = 0;
8for (int x = 0; x < 512; x++) {
9    for (int y = 0; y < 512; y++) {
10        noiseData[index++] = noise.GetNoise<float>(x, y);
11    }
12}
13
14// Do something with this data...
15
16// Free data later
17delete[] noiseData;
C++

As you can see, the API is nearly identical across all languages, and will produce exactly the same results, regardless of host system or language. For example, this can mean that you can run a game's procedural generation either on the CPU or GPU of the host system (to boost performance for capable hardware) and not have any differences between the two methods, making every player see exactly the same content, but generated faster by their system.

Included in the FastNoise Lite repository is the Preview App, this allows you to tweak with all of the settings FastNoise Lite has to offer, and to give you a visual representation of the noise you are using in your algorithms.

You can download the tool, and the library in every supported language at the official GitHub repository.

Here are some examples of Fast Noise Lite:

PreviewApp Example 1 PreviewApp Example 2 PreviewApp Example 3 PreviewApp Example 4 PreviewApp Example 5 PreviewApp Example 6 PreviewApp Example 7