sampler texture0 : register(s0);
sampler texture1 : register(s1);

float4x4 WorldViewProjectionTransform  : WORLDVIEWPROJ;
float fRelativePosition;
float fDisplayAspect;
float2 fTextureSize;

struct VS_OUTPUT 
{
   float4 Position  : POSITION;
   float2 TexCoord  : TEXCOORD0;
};

struct PS_OUTPUT
{
    float4 RGBColor : COLOR0;  // Pixel color    
};

VS_OUTPUT vertexMain(
				float4 vPosition : POSITION,
				float2 texCoord : TEXCOORD0)
{
	VS_OUTPUT Output; 

	Output.Position = mul(vPosition, WorldViewProjectionTransform);
	Output.TexCoord = texCoord;
	return Output;
}

PS_OUTPUT pixelMain(VS_OUTPUT In)
{
	float2 coord = In.TexCoord + 1.f / fTextureSize / 2.f;
	
	PS_OUTPUT Output;

	float x = coord.x - 0.5f;
	float y = (coord.y - 0.5f) / fDisplayAspect;
   
	float fdist = sqrt(x * x + y * y);
	fdist -= fRelativePosition;
   
	float factor1 = saturate(sign(fdist));
	float factor2 = 1 - factor1;
  
	Output.RGBColor  = factor1 * tex2D(texture0, coord);
	Output.RGBColor += factor2 * tex2D(texture1, coord);

	Output.RGBColor.a = 1.0;

	return Output; 
	
}