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
520 downloads per month
Used in noise-functions-config
1MB
42K
SLoC
Noise Functions
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 off64
.
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:
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
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.