I am trying to make a ripple effect with a HLSL shader, it works so far but I need to output negative numbers and that won't work for the calculations. Is there some way to do this with the SurfaceFormat
class? By the way I am rendering 2 RenderTarget2D
classes. This is how I calculate it:
float4 add = float4(0,0,0.5,0);
float4 input = tex2D( BaseSampler, Tex);
float4 cur = tex2D( RippleSampler, Tex);
float curY = 0;
float curX = cur.x;
float tempCurY = cur.y;
curY = (tex2D( RippleSampler, float2(Tex.x - pixelSizeX, Tex.y)).x + tex2D( RippleSampler, float2(Tex.x + pixelSizeX, Tex.y)).x + tex2D( RippleSampler, float2(Tex.x , Tex.y - pixelSizeY)).x + tex2D( RippleSampler, float2(Tex.x , Tex.y + pixelSizeY)).x) * 0.5f - tempCurY;
curY *= damping;
if(curY < 0.01f){
cur = float4(curX,curY + input.x,0.5,1);
}else{
cur = float4(curX,curY,0.5,1);
}
return cur;