sampler RT : register(s0);
sampler noiseVol : register(s1);

float4 NightVision_ps(	float2 TexCoord : TEXCOORD0,
			uniform float4 lum,
			uniform float time) : COLOR
{	
	float4 oC;
	oC = tex2D(RT, TexCoord);
	
	//obtain luminence value
	oC = dot(oC,lum);
	
	//add some random noise
	oC += 0.2 *(tex3D(noiseVol, float3(TexCoord*5,time)))- 0.05;
	
	//add lens circle effect
	//(could be optimised by using texture)
	float dist = distance(TexCoord, float2(0.5,0.5));
	oC *= smoothstep(0.5,0.45,dist);
	
	//add rb to the brightest pixels
	oC.rb = max (oC.r - 0.75, 0)*4;
	
	return oC ;
}