uniform samplerRECT samp0 : register(s0);

void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
  float4 c0 = texRECT(samp0, uv0).rgba;
  float red   = 0.0;
  float green = 0.0;
  float blue  = 0.0;

  red = c0.r;
  

  if (c0.r > 0.0)
  {
    if (c0.g > c0.r)
    {
 	green = (c0.g - (c0.g - c0.r)) / 3;
    }
  }

  if (c0.b > 0.0 && c0.r < 0.25)
  {
    red = c0.b;
    green = c0.b / 3;
  }

  if (c0.g > 0.0 && c0.r < 0.25)
  {
    red = c0.g;
    green = c0.g / 3;
  }

  if (((c0.r + c0.g + c0.b) / 3) > 0.9)
  {
    green = c0.r / 3;
  }
  
  ocol0 = float4(red, green, blue, 1.0);
}