uniform sampler2D tex1;
uniform sampler2D tex2;
uniform sampler2D tex3;
varying vec2 texC;

void main()
{
	vec4 specCol =  texture2D(tex2,texC);
	vec2 texCM = texC;
	float lengthFromCent = 1.0-length(texCM-vec2(0.5));
	lengthFromCent = pow(lengthFromCent,2.0);
	texCM.x+=sin(specCol.r*0.03 + texCM.y*3.01)*specCol.r*lengthFromCent;
	texCM.y+=sin(specCol.r*0.02 +0.4 + texCM.x*2.02)*specCol.r*lengthFromCent;
	vec4 diffAmb = texture2D(tex1,texC);
	vec4 backr = texture2D(tex3,vec2(texCM.x,1.0-texCM.y));
	gl_FragColor = diffAmb*0.7 + specCol*1.0 + 1.0*(specCol.a+0.01)*backr;
	//gl_FragColor = backr;
}