bevy_shader_utils 0.11.0

A utility package that provides a series of noise functions and other utilities for use in wgpu shaders.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
//  MIT License. © Inigo Quilez, Munrocket
//  noise_2d() is any noise here: Value, Perlin, Simplex, Worley
//
var m_two: mat2x2<f32> = mat2x2<f32>(vec2<f32>(0.8, 0.6), vec2<f32>(-0.6, 0.8));
fn fbm(p: vec2<f32>, noise_2d: ) -> f32 {
  var f: f32 = 0.;
  f = f + 0.5000 * noise_2d(p); p = m_two * p * 2.02;
  f = f + 0.2500 * noise_2d(p); p = m_two * p * 2.03;
  f = f + 0.1250 * noise_2d(p); p = m_two * p * 2.01;
  f = f + 0.0625 * noise_2d(p);
  return f / 0.9375;
}