uniform sampler2D uTexNoise; float noise( vec3 x ) { vec3 i = floor(x); vec3 f = fract(x); f = f*f*(3.0-2.0*f); vec2 uv = (i.xy+vec2(37.0,17.0)*i.z) + f.xy; vec2 rg = texture( uTexNoise, (uv+0.5)/256.0).yx; return mix( rg.x, rg.y, f.z ); } const mat3 m = mat3( 0.00, 0.80, 0.60, -0.80, 0.36, -0.48, -0.60, -0.48, 0.64 ); float fractalNoise( vec3 x ) { vec3 q = 8.0*x; float f; f = 0.5000*noise( q ); q = m*q*2.01; f += 0.2500*noise( q ); q = m*q*2.02; f += 0.1250*noise( q ); q = m*q*2.03; f += 0.0625*noise( q ); q = m*q*2.01; return f; }