varying vec2 		texcoord;
uniform sampler2D 	tex;
//uniform sampler2D	lum;
uniform float Threshold;//0.99;

void main()
{
	vec4 color=texture2D(tex, texcoord);
	//float lumval=texture2D(lum, texcoord).r;
	//vec3 luminanceVector = vec3(0.2125, 0.7154, 0.0721);
	//vec3 outcolor;
	//outcolor = color.rgb * (1.0/(lumval + 0.001));
	float luminance = max( 0.0, dot(vec3(0.2125, 0.7154, 0.0721), color.rgb) - Threshold );
	//luminance = max(0.0, luminance - Threshold);//Threshold);
	
	// compute color intensity
	gl_FragColor.xyz = color.rgb*sign(luminance);//max(0.0,color - vec3(0.9,0.9,0.9));
}
