uniform sampler2DRect texture0; 

varying vec2 texCoord;

float readDepth( in vec2 coord ) {
	vec2 camerarange= vec2(-4000.0,24000.0);
	return (2.0 * camerarange.x) / (camerarange.y + camerarange.x - texture2DRect( texture0, coord ).x * (camerarange.y - camerarange.x));	
}

void main(void)
{	
	vec2 texCoord2=vec2(texCoord.x+4.0,texCoord.y+0.0);

	float a=readDepth( texCoord );
	float b=readDepth( texCoord2 );

	vec4 color=vec4(1,0,0,0.0);

	if( abs(min(a,b)/max(a,b))<0.991 )color = vec4(1,1,1,1.0);

	gl_FragColor = color;
}



