Can't pass textures to shader properly. Please help?

I’m trying to make a distortion shader for water in my game. I have a rendertarget I render everything to, and the water mask, and I’m try to simply capture the pixels underneath the mask, but I can’t get it to work. When I pass the textures, it’s as if they’re both completely transparent. What could I be doing wrong?


    texture Screen;
    texture Mask;
    float2 Offset;
    sampler ScreenSampler = sampler_state
    	  Texture = <Screen>;
    sampler MaskSampler = sampler_state
    	  Texture = <Mask>;
    float4 PixelShaderFunction(float2 texCoord: TEXCOORD0) : COLOR
    	float4 mask = tex2D(MaskSampler, texCoord);
    	float4 color = tex2D(ScreenSampler, texCoord + Offset);
    	if (mask.a > 0)
    		return color;
    	return mask;
    technique Technique0
        pass Pass0
            PixelShader = compile ps_4_0 PixelShaderFunction();

Render target:

    sprites.Begin(SpriteSortMode.Deferred, null, null, null, null, waterEffect);
    sprites.Draw(renderTargetWater, Vector2.Zero, Color.White);

Finally, rendering the rendertarget:

    sprites.Draw(renderTargetDistortion, renderTargetPosition, Color.White);

PLEASE HELP - I was up until 4 am and nearly missed school cause of this. Holy shit shaders are difficult.

EDIT2 : here’s the error


sprites.Draw(renderTargetWater, Vector2.Zero, Color.White);

You use the renderTargetWater twice there, won’t work.

What i do is I usually sample the texture which i pass in spriteBatch.Draw(myTexture, …) like this in the shader code.
In this case this would be your mask.

Texture2D ScreenTexture;

// Our sampler for the texture, which is just going to be pretty simple
sampler TextureSampler = sampler_state
Texture = ;

this is the texture you pass in the draw - aka your mask.

Another error is that you pass the Mask and Screen parameters every frame before drawing. Just assign them ONCE when the rendertargets are created.