uniform sampler2D tu0;
uniform sampler2D tu1;
uniform sampler2D tu2;
uniform sampler2D tu3;


void main()
{
	vec4 res = texture2D( tu0, gl_TexCoord[1].st );

	vec4 ind0 = texture2D( tu1, res.st * gl_TexCoord[2].st + 0.5 ) ;
	vec4 ind1 = texture2D( tu2, res.tq * gl_TexCoord[2].st + 0.5 ) ;

	vec4 mask = texture2D( tu3, gl_TexCoord[0].st );

	gl_FragColor = vec4( (ind0 + ind1) - 0.3 ) * mask;
}

