Last active
May 22, 2020 15:25
-
-
Save ikekou/26a020257f50f9f0c2139baee383e190 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec2 random2(vec2 st){ | |
st = vec2( dot(st,vec2(127.1,311.7)), | |
dot(st,vec2(269.5,183.3)) ); | |
return -1.0 + 2.0*fract(sin(st)*43758.5453123); | |
} | |
// Gradient Noise by Inigo Quilez - iq/2013 | |
// https://www.shadertoy.com/view/XdXGW8 | |
float noise2(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