Erase .fx modification

This forum is currently in read-only mode.
From the Asset Store
Impact fx, explosions, fireballs, puffs of smoke, magic fx, lightning fx, bonus & pick-up fx, blood splatters, and more
  • I know this is more of a shader request, but having taken a look at erase.fx, I thought someone could help me:

    What I need is a shader that works like Erase, but instead of taking the alpha channel and erasing with it, I'd like it to take one of the color channels instead.

    I need it for pasting transparency into a Canvas, where the opacity would be stored in one of the color channels. I already tried the Grayscale To Opacity shader with Erase on top of it, as well as through an intermediate Canvas, but it didn't work.

    Thank you in advance.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • erase.fx was done with altered render states. I'm not experienced with it, but here is a list with possible blend modes (explanation of each one further down the page):

    D3DBLEND enumeration

    Blending is done between source and destination.

    Just make sure to omit the suffix D3DBLEND_ and remember case sensitivity. Write them in uppercase as shown in the list. It's trial and error, I'm afraid. Just use combinations for SrcBlend and DestBlend, eg.

    SrcBlend = DESTALPHA;

    DestBlend = SRCCOLOR;

    (don't know if this one makes sense^^)

    EDIT: Also have a look at Construct's source code. It seems that only a subset is supported. Common renderer definitions (start at line 156)

  • It does make perfect sense.

    However, blending modes won't help in this case and not because Construct only supports a subset.

    It seems that there are none that blend across channels. Alpha only blends with Alpha, R with R etc.

    Yet I managed to find a solution - I'm in the process of cannibalizing the Color Mask Effect to do what I require - the logic flow is quite clear and easy to replace with a simple channel shifter - I have the basic operation done, but before releasing, I want to add the following:

    -ability to manually select the channel to shift over to alpha

    -a choice of either multiplication by the existing alpha or replacement

    -an option to inverse the incoming channel

    Once done, I'll post it in the Completed addons forum.

    Thank you for pointing me in the right direction.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)