User Tag List

Results 1 to 10 of 10

Thread: More than one effect?

  1. #1
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    More than one effect?

    Hey, is there any way to have more than one effect on something like a layer? I can't seem to figure out how to do that :P

  2. #2
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are effect for entire Layers?

  3. #3
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2011
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No you can't have more than one pixel shader effect per layer. However what you can do is easily combine pixel shader code so you'll have multiple effects in 1 pixel shader. I've done this personally myself and it works like a charm. Make sure you update the .xml file so it displays the correct information in MMF2 aswell. If you need more help i'll post an example of 2 shaders combined



    As you can see I combined the Flip + Tint shaders.

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, thanks I will see if I can do that, but my programming skills aren't the best. An example would be appreciated. I am trying to combine the monochrome and directional blur effects right now. The problem is that I need to "fuse together" the output colour codes, and I really don't know how to do that xD

    Edit: Is there btw a way to make everything black and white, except the reds? So everything is black and white but blood and other red things are normal..

  5. #5
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,964
    Mentioned
    25 Post(s)
    Tagged
    0 Thread(s)
    Check my shaders page, I believe someone made one like that...

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jul 2008
    Location
    The U of K.
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    At the '11 convention Clickteam didn't seem to think there'd be a problem with implementing stacking pixel shaders in MMF3. I hope that's still the case as it's a staple of many good game dev tools.

  7. #7
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2011
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Copy & Paste this in a new .fx text file


    Code:
    // Pixel shader input structure
    struct PS_INPUT
    {
        float4 Position   : POSITION;
        float2 Texture    : TEXCOORD0;
    };
    
    // Pixel shader output structure
    struct PS_OUTPUT
    {
        float4 Color   : COLOR0;
    };
    
    // Global variables
    sampler2D Tex0;
    float fCoeff;
    
    PS_OUTPUT ps_main( in PS_INPUT In )
    {
        // Output pixel
        PS_OUTPUT Out;
        PS_OUTPUT TexT;
        PS_OUTPUT TexTL;
        PS_OUTPUT TexL;
        PS_OUTPUT TexBL;
        PS_OUTPUT TexB;
        PS_OUTPUT TexBR;
        PS_OUTPUT TexR;
        PS_OUTPUT TexTR;
    
    //CS_Blur
    
    TexT.Color = tex2D(Tex0, float2(In.Texture.x,In.Texture.y-
    
    fCoeff));
        TexTL.Color = tex2D(Tex0, float2(In.Texture.x-
    
    fCoeff,In.Texture.y-fCoeff));
        TexL.Color = tex2D(Tex0, float2(In.Texture.x-
    
    fCoeff,In.Texture.y));
        TexBL.Color = tex2D(Tex0, float2(In.Texture.x-
    
    fCoeff,In.Texture.y+fCoeff));
        TexB.Color = tex2D(Tex0, float2
    
    (In.Texture.x,In.Texture.y+fCoeff));
        TexBR.Color = tex2D(Tex0, float2(In.Texture.x
    
    +fCoeff,In.Texture.y+fCoeff));
        TexR.Color = tex2D(Tex0, float2(In.Texture.x
    
    +fCoeff,In.Texture.y));
        TexTR.Color = tex2D(Tex0, float2(In.Texture.x
    
    +fCoeff,In.Texture.y-fCoeff));
        Out.Color = tex2D(Tex0, float2
    
    (In.Texture.x,In.Texture.y));
        
        Out.Color = (Out.Color+TexT.Color+TexTL.Color+TexL.Color
    
    +TexBL.Color+TexB.Color+TexBR.Color+TexR.Color+TexTR.Color)/9;
    
    //monochrome
    
        
        float4 f4 = (Out.Color+TexT.Color+TexTL.Color+TexL.Color
    
    +TexBL.Color+TexB.Color+TexBR.Color+TexR.Color+TexTR.Color)/9 * 
    
    float4(0.299f, 0.587f, 0.114f, 1.0f);
        float f = f4.r + f4.g + f4.b;
        Out.Color.rgb = f;
    
        return Out;
    }
    
    // Effect technique
    technique tech_main
    {
        pass P0
        {
            // shaders
            VertexShader = NULL;
            PixelShader  = compile ps_2_0 ps_main();
        }  
    }
    --------------------------------------------------------
    The only thing I did was made sure the Out.Color = (Out.Color+TexT.Color+TexTL.Color+TexL.Color+TexBL .Color+TexB.Color+TexBR.Color+TexR.Color+TexTR.Col or)/9) * the float4 of the monochrome value. The only parameter you need is the fCoeff which is for adjusting the blur.
    --------------------------------------------------------
    For the .xml document you can make it however it want, but here is how I structured it:

    Code:
    <effect>
    <name>MonoChrome + Blur Shader Example</name>
    <description>Monochrome does not have any parameters. Blur provides Blurring through the coefficient parameter.</description>
    
    <parameter>
            <name>Coeff</name>
            <code>fCoeff</code>
            <description>Blur offset coefficient</description>
            <type>float</type>
            <property>edit</property>
            <value>0.01</value>
            <min>0.0</min>
            <max>0.5</max>
    </parameter>
    </effect>
    --------------------------------------------------------

    View MFA

    Edit: I just realized you wanted directional blur instead of just a regular blur..err copy this instead to the .fx file:

    Code:
    // Pixel shader input structure
    struct PS_INPUT
    {
        float4 Position   : POSITION;
        float2 Texture    : TEXCOORD0;
    };
    
    // Pixel shader output structure
    struct PS_OUTPUT
    {
        float4 Color   : COLOR0;
    };
    
    // Global variables
    sampler2D Tex0;
    float fCoeff;
    float fAngle;
    
    
    PS_OUTPUT ps_main( in PS_INPUT In )
    {
        // Output pixel
        PS_OUTPUT Out;
      PS_OUTPUT OutA;
      PS_OUTPUT OutB;
        fAngle = fAngle*0.0174532925f;
        OutA.Color = tex2D(Tex0, float2(In.Texture.x+cos(fAngle)
    
    *fCoeff,In.Texture.y+sin(fAngle)*fCoeff));
        OutB.Color = tex2D(Tex0, float2(In.Texture.x-cos(fAngle)
    
    *fCoeff,In.Texture.y-sin(fAngle)*fCoeff));
        Out.Color = tex2D(Tex0, In.Texture.xy);
        Out.Color = (Out.Color+OutA.Color+OutB.Color)/3;
    
    //monochrome
    
        
        float4 f4 = (Out.Color+OutA.Color+OutB.Color)/3 * float4
    
    (0.299f, 0.587f, 0.114f, 1.0f);
        float f = f4.r + f4.g + f4.b;
        Out.Color.rgb = f;
    
        return Out;
    }
    
    // Effect technique
    technique tech_main
    {
        pass P0
        {
            // shaders
            VertexShader = NULL;
            PixelShader  = compile ps_2_0 ps_main();
        }  
    }
    --------------------------------------------------------
    and the .xml file :


    Code:
    <effect>
    <name>MonoChrome + Directional Blur Shader Example</name>
    <description>Monochrome does not have any parameters. DirBlur provides Blurring through direction and coefficient.</description>
    
    <parameter>
        <name>Coefficient</name>
        <code>fCoeff</code>
        <description>Strength of the blur.</description>
        <type>float</type>
        <property>edit</property>
        <value>0.1</value>
    </parameter>
    
    <parameter>
        <name>Angle</name>
        <code>fAngle</code>
        <description>direction of the blur.</description>
        <type>float</type>
        <property>edit</property>
        <value>45</value>
    </parameter>
    </effect>

  8. #8
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks! I really appreciate you taking the time to post the complete solution I will make sure I read the code properly so I understand it till next time

    And thanks Phi, I found a shader on the suggested webpage with a monochrome effect and excluded colours LOVE IT!

  9. #9
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by RobertRule View Post
    At the '11 convention Clickteam didn't seem to think there'd be a problem with implementing stacking pixel shaders in MMF3. I hope that's still the case as it's a staple of many good game dev tools.
    Nice, I hope they implement that Would make things a lot easier!

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anaconda runtime have that option and extension called anaconda Shaders...

Similar Threads

  1. Ink effect XOR
    By King_Cool in forum SWF/Flash Export Module Version 2.0
    Replies: 2
    Last Post: 16th August 2013, 02:48 PM
  2. ADD effect
    By Ls2 in forum Android Export Module Version 2.0
    Replies: 3
    Last Post: 4th May 2012, 03:38 AM
  3. Ink effect HWA?
    By danjo in forum Hardware Accelerated Runtime
    Replies: 5
    Last Post: 16th November 2009, 08:12 PM
  4. Best way to get a Fog of War effect
    By RickyRombo in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 24th May 2008, 08:39 PM
  5. Explosion effect - possible with particle effect?
    By MediYama in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 13th April 2008, 08:36 PM

Posting Permissions

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