//@author: unc / bj-rn
//@help: template for texture fx
//@tags: texture
//@credits: 

Texture2D tex0: PREVIOUS;
Texture2D tex1 <string uiname="Texture In 2";>;

SamplerState linearSampler : IMMUTABLE
{
    Filter = MIN_MAG_MIP_LINEAR;
    AddressU = Clamp;
    AddressV = Clamp;
};

float4 Boost=0;
bool Signed=false;

struct psInput
{
	float4 p : SV_Position;
	float2 uv : TEXCOORD0;
};


float4 PS(psInput input) : SV_Target
{
	float4 previous = tex0.Sample(linearSampler,input.uv);
	float4 current = tex1.Sample(linearSampler,input.uv);
	float4 c = (previous-current) *pow(2,Boost);
	if(!Signed)c=abs(c);
	return c;
}

technique10 Process
{
	pass P0
	{
		SetPixelShader(CompileShader(ps_4_0,PS()));
	}
}



