
float hash(vec2 uv) {
  // added terms till it looked okay
  vec3 p3  = mod(uv.xyx * vec3(345.23,234.1,465.745),vec3(2,3,5));
  p3 += dot(p3, p3.yzx + 34.19);
  return fract((p3.x + p3.y) * p3.z);
}

float n2(vec2 st) {
  	vec2 i=floor(st-.5);
    vec2 f=fract(st-.5);
    f = f*f*f*(f*(f*6.0-15.0)+10.0);
    float rt=mix(hash(i),hash(i+vec2(1.,0.)),f.x);
    float rb=mix(hash(i+vec2(0.,1.)),hash(i+vec2(1.,1.)),f.x);
    return mix(rt,rb,f.y);
}

mat2 rot(float a) {
  return mat2(cos(a), -sin(a), sin(a), cos(a));
}

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    // Normalized pixel coordinates (from 0 to 1)
    vec2 uv = fragCoord.xy/iResolution.xy;

    vec2 tuv = uv + 1.;

    vec3 col = texture(iChannel0,uv).rgb;
    for (int i=0; i < 2; ++i) {
      tuv *= rot(4.);

      float nz = n2(tuv*vec2(10.,500.)*(1.+length(uv)/50.));
      nz += n2(tuv*vec2(3.,11.));

      col *= clamp(nz*vec3(1.)/2.+1.-length(uv-vec2(0.5)),0.,1.);
    }
    // Output to screen
    fragColor = vec4(col,1.0);
}