varying vec2 		texcoord;
uniform sampler2D 	tex;
float wnear = 4.0;
float wfar = 50000.0;

void main()
{
	float depth = (wnear / (wfar - texture2D(tex,texcoord).x * (wfar - wnear))) * wfar;
	gl_FragColor=vec4(max(0.0,depth*0.00001));
	gl_FragColor.a=1.0;
}
