8 releases (breaking)

new 0.8.0 Dec 6, 2024
0.7.0 Jul 10, 2024
0.6.0 Feb 23, 2024
0.5.0 Nov 6, 2023
0.1.0 Oct 25, 2022

#544 in Game dev

Download history 46/week @ 2024-08-19 90/week @ 2024-08-26 79/week @ 2024-09-02 91/week @ 2024-09-09 159/week @ 2024-09-16 197/week @ 2024-09-23 140/week @ 2024-09-30 40/week @ 2024-10-07 124/week @ 2024-10-14 76/week @ 2024-10-21 135/week @ 2024-10-28 92/week @ 2024-11-04 73/week @ 2024-11-11 73/week @ 2024-11-18 190/week @ 2024-11-25 248/week @ 2024-12-02

587 downloads per month
Used in 2 crates

MIT license

93KB
285 lines

noisy_bevy

crates.io MIT docs.rs

Simple stupid noise primitives for glam types (Vec2, Vec3) and wgsl.

Main motivations are:

  • ergonomic usage with Bevy
  • same results on rust and wgsl (not bit-level perfect, though)

screenshot of an asteroid generated on the gpu and cpu

Implemented noise primitives:

Usage

From rust

Zero initialization, just call the noise functions:

use bevy::prelude::*;
use noisy_bevy::simplex_noise_2d;

let p = Vec2::new(12.3, 45.6);
let value = simplex_noise_2d(p);

From wgsl shaders

First add the plugin to the Bevy app:

App::new()
    .add_plugins(NoisyShaderPlugin)

And import it and use it in your shaders, with the same API as on the CPU-side:

#import noisy_bevy::simplex_noise_2d

// ...

let p = vec2(12.3, 45.6);
let value = simplex_noise_2d(p);

See the asteroids example, for an example that uses noise to procedurally generate a tilemap on the CPU and a matching background in a wgsl shader.

Bevy Version Support

The main branch targets the latest bevy release.

bevy noisy_bevy
0.15 0.8, main
0.14 0.7
0.13 0.6
0.12 0.5
0.11 0.4
0.10 0.3
0.9 0.2
0.8 0.1

License

MIT

The original simplex noise source is MIT-only, however all changes made by me or PRs to this repo are also available under Apache-2.0.

Acknowledgments

The noise primitives are ports/copies of these

Contributions

PRs welcome!

Dependencies

~40–72MB
~1.5M SLoC