highp float hash( highp float n ){
	return fract(sin(n)*43758.5453);
}

highp float noise( in highp vec2 x ){
	highp vec2 p = floor(x);
	highp vec2 f = fract(x);
    	f = f*f*(3.0-2.0*f);
    highp float n = p.x + p.y*57.0;
    highp float res = mix(mix( hash(n+  0.0), hash(n+  1.0),f.x), mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y);
return res;
}

highp float fbm(highp vec2 p, float speed, float density){
mat2 rot = mat2(cos(0.3), sin(0.3), -sin(0.3), cos(0.2));
highp float f = 0.020;
	p += TIME * speed;
	p *= 10.0 * rot;
	f += 0.50000*noise( p ); p = p*2.05;
	f += 0.25000*noise( p ); p = p*2.06;
	f += 0.12500*noise( p ); p = p*2.07;
	f += 0.06250*noise( p ); p = p*2.08;
	f += 0.03125*noise( p ); p = p*2.09;
	f/1.0;
highp float c = f - (1.0 - density);
if ( c < 0.0 )
	c = 0.0;
    f = 1.0 - (pow(0.01, c));
return f;
}
