#iChannel0::WrapMode "Repeat" #iChannel0 "file://./sand2.jpg" 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-0.5*iResolution.xy)/iResolution.y; uv = uv*4.; float tmp; float b = SmoothNoise2(uv+iTime*0.5,2)*0.5+SmoothNoise2(uv-iTime*0.2,2)*0.5; tmp = smoothstep(0.5, 0.505, b); b = tmp - smoothstep(0.505, 0.51, b); fragColor = vec4( texture(iChannel0, uv+ SmoothNoise2(uv+iTime*0.5,2)*0.4 ).xyz+b, 1.0 ); }