#version 120

uniform sampler2D tex0;
uniform sampler2D tex1;

varying vec3 vertex;
varying vec2 uv;

void main()
{
  vec3 color = texture2D(tex0, uv).rgb;
	vec3 current = texture2D(tex1, uv).rgb;
	float a = length(color) - length(current);
	if (a > 0.3) {
		color = mix(vec3(a/3.0), current, color);
	} else {
		color = current;
	}
  gl_FragColor = vec4(texture2D(tex0, uv).xyz + texture2D(tex1, uv).xyz, 1.0);
}
