Skip to content

Instantly share code, notes, and snippets.

@elkraneo
Created May 19, 2019 16:49
Show Gist options
  • Save elkraneo/50b429e56666b04351bfc911687a01da to your computer and use it in GitHub Desktop.
Save elkraneo/50b429e56666b04351bfc911687a01da to your computer and use it in GitHub Desktop.
Gradient Noise by Inigo Quilez - iq/2013 https://www.shadertoy.com/view/XdXGW8
float noise(vec2 st) {
vec2 i = floor(st);
vec2 f = fract(st);
vec2 u = f * f * (3.0 - 2.0 * f);
return mix( mix( dot( random2(i + vec2(0.0, 0.0) ), f - vec2(0.0, 0.0) ),
dot( random2(i + vec2(1.0, 0.0) ), f - vec2(1.0, 0.0) ), u.x),
mix( dot( random2(i + vec2(0.0, 1.0) ), f - vec2(0.0, 1.0) ),
dot( random2(i + vec2(1.0, 1.0) ), f - vec2(1.0, 1.0) ), u.x), u.y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment