12 releases (7 breaking)

0.7.0 Jan 19, 2025
0.5.0 Jan 16, 2025
0.3.0 Nov 29, 2024
0.2.1 May 4, 2024

#306 in Algorithms

Download history 139/week @ 2024-11-27 32/week @ 2024-12-04 26/week @ 2024-12-11 5/week @ 2024-12-18 6/week @ 2025-01-08 507/week @ 2025-01-15 3/week @ 2025-01-22 4/week @ 2025-01-29

520 downloads per month
Used in noise-functions-config

MIT/Apache

1MB
42K SLoC

Noise Functions

Crates.io Documentation Rust License

A collection of fast and lightweight noise functions.

Check out the live demo!

Example Images

Click on the images to view the code that created them.

Basic

Fractal

Domain warped

Tileable

Motivation

Noise libraries like noise or libnoise create a permutation table at runtime for each instance of Perlin and the like. This library uses static permutation tables / hashing instead. As such, there is no need to store and reuse noise structs for the sake of efficiency. There is no downside to writing code like this:

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

[!NOTE] This library uses f32 instead of f64.

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 or you want to compose multiple noises in a custom way then this design is less efficient and less convenient. There is the noise-functions-config crate that provides a similar configurable struct (the demo is powered by it). It opts to return a trait object like Box<dyn Sample<2>> instead of branching on each sample call.

License

Licensed under either of:

at your option.

Your contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies