//------------------------------------
texture Texture0 : BackBuffer;
texture Texture1 : BlurBackBuffer;

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

sampler AmbientOcclusionMap = 
sampler_state
{
    Texture = <Texture1>;
    MinFilter = Linear;
	MagFilter = Linear;
	AddressU = Clamp;
	AddressV = Clamp;
};

struct vertexOutput {
    float4 HPosition : POSITION;
    float2 UV	: TEXCOORD0;
};

//------------------------------------
float4 PS_Texture(vertexOutput IN) : COLOR0
{
    float4 diffuse = tex2D(SceneMap, IN.UV) - (1.0-tex2D(AmbientOcclusionMap, IN.UV));
    return diffuse;
}

//-----------------------------------
technique ShowTexture
{
    pass p0 
    {		
		VertexShader = NULL;
		PixelShader = compile ps_2_0 PS_Texture();
		
		// Just use the color
		ColorArg1[0] = Diffuse;
		AlphaArg1[0] = Diffuse;
		ColorOp[0] = SelectArg1;
		AlphaOp[1] = SelectArg1;
		
		CullMode = None;
		ZEnable = true;
		ZFunc = ALWAYS;
		ZWriteEnable = false;
    }
}