float N21(vec2 p) { //return fract( sin(p.x*100.0+p.y*6574.0)*5647.0 ); p = fract(p*vec2(233.32, 851.73)); p += dot(p, p+23.45); return fract(p.x*p.y); } float SmoothNoise(vec2 uv) { vec2 lv = fract(uv); vec2 id = floor(uv); lv = smoothstep(0.0,1.0, lv); // = lv*lv*(3.-2.*lv); float bl = N21(id); float br = N21(id+vec2(1.0, 0.0)); float b = mix(bl, br, lv.x); float tl = N21(id+vec2(0.0,1.0)); float tr = N21(id+vec2(1.0,1.0)); float t = mix(tl, tr, lv.x); return mix(b,t, lv.y); } float SmoothNoise2(vec2 uv, int ocataves) { float c = 0.0; float norm = 0.0; float limit = pow(2.0, float(ocataves)); for(float i=1.0; i<=limit; i*=2.0){ float norm_fract = 1.0/i; c += SmoothNoise(uv*i)*norm_fract; norm+= norm_fract; } return c/norm; } void mainImage ( out vec4 fragColor, in vec2 fragCoord) { vec2 uv = fragCoord/iResolution.xy; float x = SmoothNoise(uv*4.+mod(127.+iTime*2000.7, 337.)); float y = SmoothNoise(uv*4.+mod(111.+iTime*11110.7, 1337.)); float r = SmoothNoise2(vec2(x,y),1); fragColor = vec4( vec3(SmoothNoise2(uv+r+iTime*2.,3)), 1.0 )*0.5; fragColor -= vec4(r)*0.1; }