no-std noise-functions

Fast and lightweight noise functions

7 releases

0.2.1 May 4, 2024
0.2.0 May 4, 2024
0.1.3 May 3, 2024
0.1.2 Apr 26, 2024
0.0.0 Apr 26, 2024

#463 in Algorithms

Download history 4/week @ 2024-06-10 7/week @ 2024-06-17 1/week @ 2024-07-22 79/week @ 2024-08-26 1/week @ 2024-09-02 39/week @ 2024-09-23

55 downloads per month
Used in noise-functions-config

MIT/Apache

180KB
4.5K SLoC

Noise Functions

Crates.io Documentation Rust License

Fast and lightweight noise algorithm implementations.

Check out the live demo!

The implementation of these noise functions are from FastNoiseLite.

Base noises

Fractal noises

Domain warped noises

Why not noise or libnoise?

With noise, constructing a noise struct like Perlin creates a permutation table at runtime. So to use the noise efficiently, you need to keep that instance of Perlin around.

With noise-functions, Perlin and friends don't carry any state. This makes noise algorithms easier to use efficiently. For example, you can use the noise algorithms without having to carry around state, without sacrificing performance:

fn my_noise(point: Vec2) -> f32 {
    Perlin.fbm(3, 0.5, 2.0).seed(42).frequency(3.0).sample2(point)
}

Pros: noise has more noise functions, more dimensions for noise functions and more noise combinators.

Difference: noise uses f64 instead of f32.

Why not fastnoise-lite?

fastnoise-lite provides its noise generation via a big struct that you are to mutate to get the noise you want. If you already know what noise you want this api is inconvenient and inefficient. There is the noise-functions-config crate that provides a similar api if you need it.

Pros: fastnoise-lite provides more cellular noise variations and has domain warping built into the config struct.

Dependencies

~130KB