Hello,
upon trying to use Looki's Background Offset shader to distort my game background for an "underwater" type effect (like in Nifflas's 'The Great Work') I came across a really big problem:
Please login to see this attachment.
it seems to distort my water overlay horribly, making everything behind it blurry regardless of what type of overlay design I use (including different colors).
Here's an image from Nifflas' Game:
Please login to see this attachment.
now compare that to this image from the same area, only built in my version of mmf2 and using the exact same overlay/settings:
Please login to see this attachment.
any help would be appreciated. I'm pretty sure that it is only something as simple as me having an outdated version, since I got it secondhand.
here's the code for the shader in case it sets off any flags:
<effect>
<name>Background Offset</name>
<description>Offsets the background using the object's texture (Red for X, Green for Y).</description>
<author>Looki</author>
<BackgroundTexture>1</BackgroundTexture>
<parameter>
<name>Width</name>
<variable>width</variable>
<type>float</type>
<value>10</value>
<description>Width of the shift in pixels.</description>
</parameter>
<parameter>
<name>Height</name>
<variable>height</variable>
<type>float</type>
<value>10</value>
<description>Height of the shift in pixels.</description>
</parameter>
</effect>
Display More
sampler2D img;
sampler2D bg : register(s1);
float width,height,fPixelWidth,fPixelHeight;
float4 ps_main(in float2 In : TEXCOORD0) : COLOR0
{
float4 shift = tex2D(img,In);
float2 off = float2(width*fPixelWidth,height*fPixelHeight);
off.x *= 2*(shift.r-0.5);
off.y *= 2*(shift.g-0.5);
float4 o = tex2D(bg,In+off);
o += tex2D(bg,In+off+float2(fPixelWidth*0.5,0));
o += tex2D(bg,In+off+float2(fPixelWidth*-0.5,0));
o += tex2D(bg,In+off+float2(0,fPixelHeight*0.5));
o += tex2D(bg,In+off+float2(0,fPixelHeight*-0.5));
o /= 5;
return o;
}
technique tech_main { pass P0 { PixelShader = compile ps_2_0 ps_main(); }}
Display More
EDIT: also messes up the waterfalls that use the same effect
EDIT 2: ignore this image