GithubHelp home page GithubHelp logo

sjmueller / noisy_bevy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from johanhelsing/noisy_bevy

0.0 0.0 0.0 118 KB

Simple stupid noise primitives for WGSL and Rust (glam/bevy types)

License: Other

Rust 55.73% WGSL 44.27%

noisy_bevy's Introduction

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:

  • [simplex_noise_2d]
  • [simplex_noise_2d_seeded]
  • [simplex_noise_3d]
  • [fbm_simplex_2d]
  • [fbm_simplex_2d_seeded]
  • [fbm_simplex_3d]

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.

bevy noisy_bevy
0.13 0.6, main
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!

noisy_bevy's People

Contributors

johanhelsing avatar andrewexton373 avatar sjmueller avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.