User Tag List

Results 1 to 5 of 5

Thread: Make black colour in shader white?

  1. #1
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)
    elvisish's Avatar
    Join Date
    Oct 2014
    Posts
    824
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)

    Make black colour in shader white?

    This shader fades between black and transparent, where white is defined as transparent. i'm trying to understand how i could change it so it fades from transparent to white:
    Code:
    sampler2D Texture0;
    float time;
    float4 a, b;
    
    float STEP = 1/3.0;
    
    float4 ps_main(float2 In : TEXCOORD0) : COLOR0
    { 
        //Source color
        float4 ret = tex2D(Texture0, In);
        float3 fade = 1;
    
        //Step A: black to A
        if(time < STEP)
        {
            fade *= a.rgb * (time/STEP);
        }
        //Step B: A to B
        else if(time >= STEP && time <= 2*STEP)
        {
            fade = lerp(a.rgb, b.rgb, (time-STEP)/STEP);
        }
        //Step C: B to white
        else if(time < 1)
        {
            fade = 1 - (1-b)*((1-time)/STEP);
        }
    
        //Apply fade
        ret.rgb *= fade;
        return ret;
    }
    
    technique Shader { pass P0 { PixelShader = compile ps_2_0 ps_main(); } }

  2. #2
    Clicker Multimedia Fusion 2
    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)
    FlipSwitchX's Avatar
    Join Date
    Feb 2012
    Location
    California
    Posts
    206
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb

    Which shader is this and what effect are you trying to pull off exactly? Because if you want to go from white to transparent you could use another shader called simple mask (pretty sure that's what it's called), forgot the group of shaders it is part of, I'd check for you but I'm on my phone. Anyway with this mask you can easily set it to white and then fade just the shader out, revealing your character is what it's for I'm assuming.

  3. #3
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)
    elvisish's Avatar
    Join Date
    Oct 2014
    Posts
    824
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)
    Here's the full shader in zip: https://www.dropbox.com/s/jwfypapksonoj2k/SonicFade.zip

    I still have no idea how to make it go through the colors to white instead of black?

  4. #4
    Clicker Fusion 2.5 Developer
    SHINGEN's Avatar
    Join Date
    Apr 2015
    Location
    England
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by elvisish View Post
    Here's the full shader in zip: https://www.dropbox.com/s/jwfypapksonoj2k/SonicFade.zip

    I still have no idea how to make it go through the colors to white instead of black?
    Did you ever work it out in the end? If so how did you do it as im looking for the exact same thing. A sonicfade that goes to white instead of black but as a dx11 shader

  5. #5
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)
    elvisish's Avatar
    Join Date
    Oct 2014
    Posts
    824
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)
    Yeah, @fnkycoldmadeanr helped me with this:Attachment 27159 - it's slightly different now in that the amount is the opposite end of the time slider; I've included an example mfa that shows it flashing in and flashing out if you press F.

    Unfortunately, I have no idea how to convert it to DX11, I'm afraid! Eventually I'll probably just take the SonicFade regular hlsl and fxc and just mod in the differences.

Similar Threads

  1. A way to desaturate colours or fade from colour to black/white/grey?
    By TheSynapse in forum Multimedia Fusion 2 - Technical Support
    Replies: 15
    Last Post: 6th February 2012, 08:33 PM
  2. Fade to Black/White
    By Pixelthief in forum Shader Development
    Replies: 7
    Last Post: 22nd October 2010, 01:29 AM
  3. Black background, text colour does not change
    By karimali831 in forum Install Creator and Patch Maker
    Replies: 3
    Last Post: 6th July 2009, 10:54 PM
  4. Colour "Black" bug
    By ChrisStreet in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 12th August 2006, 03:55 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
  •