uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
  float4 c0 = texRECT(samp0, uv0).rgba;
  float4 c1 = texRECT(samp0, uv0 - float2(1, 0)).rgba;
  float4 c2 = texRECT(samp0, uv0 - float2(0, 1)).rgba;
  float4 c3 = texRECT(samp0, uv0 + float2(1, 0)).rgba;
  float4 c4 = texRECT(samp0, uv0 + float2(0, 1)).rgba;

  float red = c0.r;
  float blue = c0.b;
  float green = c0.g;

  float red2 = (c1.r + c2.r + c3.r + c4.r) / 4;
  float blue2 = (c1.b + c2.b + c3.b + c4.b) / 4;
  float green2 = (c1.g + c2.g + c3.g + c4.g) / 4;

 	if(red2 > 0.3)
		red = c0.r + c0.r /  2 ;
	 else
		red = c0.r - c0.r /  2 ;

	if(green2 >  0.3)
		green = c0.g+ c0.g / 2;
	 else
		green = c0.g - c0.g / 2;
	
		
	if(blue2  >  0.3)
		blue = c0.b+ c0.b / 2 ;
	  else
		blue = c0.b - c0.b / 2 ;
	
  ocol0 = float4(red, green, blue, c0.a);
}