Crate noisy_bevy

source ·
Expand description

§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_plugin(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.

bevynoisy_bevy
0.130.6, main
0.120.5
0.110.4
0.100.3
0.90.2
0.80.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!

Structs§

Functions§