float2 PixelKernel[4] =
{
    { 0,  1},
    { 1,  0},
    { 0, -1},
    {-1,  0}
};

//float2 TexelKernel[4];

struct Output {
  float4 color : COLOR;
};

//-----------------------------------------------------------------------------
// Pixel Shader: EdgeDetect
// Desc: Performs post-processing effect that detects and highlights edges.
//-----------------------------------------------------------------------------
float3 LuminanceConv = { 0.2125f, 0.7154f, 0.0721f };

Output EdgeDetect( float2 texCoord : TEXCOORD0,
					uniform sampler2D decal : TEX0 )
{
	Output OUT;
    float4 Orig = tex2D( decal, texCoord );
		
    float4 Sum = 0;

    for( int i = 0; i < 4; i++ )
        Sum += ( abs( Orig - tex2D( decal, texCoord + PixelKernel[i] ) ) - 0.5f ) * 1.2 + 0.5f;

    //return saturate( dot( LuminanceConv, Sum ) ) * 5;
	
	OUT.color = saturate (dot( LuminanceConv, Sum ) ) * 5 ;
	//OUT.color = saturate (dot( LuminanceConv, Orig ) ) * 5;
	return OUT;
}