texture g_texturea;
texture g_textureb;

sampler2D g_samSrcColor =
sampler_state
{
    Texture = <g_texturea>;
    AddressU  = Wrap; 
    AddressV  = Wrap; 
};


sampler2D g_samAlpha =
sampler_state
{
    Texture = <g_textureb>;
};


float4 Refract( float2 Tex : TEXCOORD0, float2 TexB : TEXCOORD1  ) : COLOR0
{

    float4 Color;
    float4 Alpha;
 	
 	Alpha = tex2D( g_samAlpha, TexB );
 	Color = tex2D( g_samSrcColor, float2( Tex.x + (Alpha.r - 0.5)*1.0f, Tex.y + (Alpha.g - 0.5)*1.0f ) );
 	
 	Color.a = Alpha.a;
 	
    return Color;
}

technique PostProcess
{
    pass p0
    {
        VertexShader = null;
        PixelShader = compile ps_2_0 Refract();
    }

}