
float4 sddx;
texture Texture0 : ZBlurTexture;

sampler textureMap = 
sampler_state
{
    Texture = <Texture0>;
    MinFilter = Linear;
	MagFilter = Linear;
	AddressU = Clamp;
	AddressV = Clamp;
};


//------------------------------------
struct vertexOutput {
    float4 HPosition : POSITION;
    float2 UV0	: TEXCOORD0;
};


struct PS_OUTPUT
{
    float4 Color : COLOR0;   
};

PS_OUTPUT PS(vertexOutput In) 
{ 
    PS_OUTPUT Output;
    
	Output.Color = 0;	
    float2 SamplePos;
    float2 ddx = sddx.xy;
    
    for (int i = 0; i < 8; i++)
    {
        SamplePos = In.UV0 + ddx * 4.0 * float2(
													sin((3.141 / 4.0) * i),
													cos((3.141 / 4.0) * i)
												);
        Output.Color += tex2D(textureMap, SamplePos);
    }
    
    Output.Color = Output.Color / 8.0;
	Output.Color.a = 1.0;

    return Output;
}
///////////////////////////////////////
//Technique
///////////////////////////////////////

technique Effect
{
    pass P0
    {
    	ColorOp[0] = SelectArg1;
    	ColorArg1[0] = Texture;
    	ColorOp[1] = Disable;
		
	VertexShader = NULL;
	PixelShader  = compile ps_2_0 PS();	
	
	CullMode = None;
	ZEnable = true;
	ZFunc = ALWAYS;
	ZWriteEnable = false;
    }
}
