User Tag List

Results 1 to 4 of 4

Thread: Background Offset shader distorting background horribly

  1. #1
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    644
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)

    Background Offset shader distorting background horribly

    Hey all. Recently I was looking around for Looki's Background Offset shader in order to create a decent "water" effect for my game (I got the idea from nifflas after checking out his post in this thread:http://community.clickteam.com/threads/80776-Shader-quot-Under-Water-quot-dosen-t-works and checking out The Great Work itself). Well, nivram was nice enough to give me the shader, but there's a problem when I use it.

    I want the shader to distort my background clearly, like here:
    niffwater.jpg

    however, whenever I apply the effect it ends up like this:
    brokewater.jpg

    I thought at first that I was doing something wrong with my actual overlay image, resulting in a bad distortion; but after trying several different variations and even downloading The Great Work's source and using the exact same image and settings, it still won't work correctly.

    any help appreciated. perhaps i have a beta version of the shader?

    mfa here:
    https://www.dropbox.com/s/5ekzb4aik9...rokenwater.mfa

  2. #2
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    644
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Anybody? I'm fairly certain it's as simple as me having an outdated shader...

    the shader code in case it sets off any flags with anybody:


    Code:
    <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>
    Code:
    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(); }}
    some more pictures to further reinforce my problem:

    gwgood.jpggwbad.jpg

    i should probably try moving this to the shader development forum now that I see them. i'll try posting it there as well.

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export Module

    Join Date
    Dec 2013
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is how it looks for me, after I gave the Water Distortion a Blend Coefficient of 150.

    brokenwater.jpg

  4. #4
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    644
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Vaxx, that's pretty odd. When I do the same nothing changes at all... so there's definitely something wrong somewhere. Thanks for your reply.

Similar Threads

  1. Looking for Looki's Offset Shader
    By casleziro in forum Fusion 2.5
    Replies: 3
    Last Post: 16th January 2014, 02:56 PM
  2. Scroll background (offset)
    By Evilized79 in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 23rd April 2013, 05:12 AM
  3. Reflection (Background) Shader
    By Pixelthief in forum Shaders
    Replies: 2
    Last Post: 28th May 2010, 07:05 PM
  4. Setting Static Text Background to MDI Background
    By droberson in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 9th September 2006, 04:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •