0 Favourites

Brightness effect that preserves alpha?

  • I wanted to use the brightness effect to create a black outline of my sprite (that I use for a specific game mechanic).

    More graphically speaking I have this

    Original Pic

    and I want to get this (through a smooth darkening animation (so using animations is out the question).

    Darkened silhouette

    However, after applying the brightness effect I actually got this:

    Non-alpha brightness

    The problem is that the effect does not preserve the alpha of the original sprite.

    Is there currently a way to get a brightness effect that does preserve alpha?

    Thanks in advance

    PS: I apologize if this is not the correct place to post but I wasn't sure if this was a bug (as most of the other effect do seem to preserve alpha) or a "how do I do?" (because there are well-known ways to do this) or a feature request (because that it is something that is known to be missing)

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • In the meantime, the "exposure" effect seems to also do something similar and it does preserve alpha. Hopefully this is not that much computationally intensive than the regular "brightness effect".

  • Try using the 'Set color' shader instead.

  • Thanks for the reply. Set color is slightly different though, as there is no value in which the object is presented as it would be normally (Brightness = 100 means no change applied).

    In any case, is there some sort of rule or reason for preserving alpha on some color effects and not in others?

    No biggie though, worst case scenario I would create another effect "alpha preserving brightness" on my own.

    Thanks again and happy new year!

  • A final tip for this.

    If there is an effect that does not preserve alpha and you want it to preserve alpha, go into your effect directory and find the name effect you want to edit.

    1) Open <effect_name>.fx

    2) See if you can find any of the following lines of javascript code:

       front.rgb /= front.a;

       front.rgb *= front.a;

    3) Comment them by adding "//" to the beginning of that line

    4) Save with a different name

    5) Open <effect_name>.xml and make sure to change the id that its found between "<id>" and "/<id>" to another value (each effect is required to have a different id).

    6) Save with the same name as your .fx file

    7) Close and Open C2 and use your new alpha preserving effect

    Of course, this does not work with every effect but I could at the least apply it to the "brightness" and the "vignette" effects that I wanted to use in my project.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
211 70,610
bioded's avatar
bioded
Unread sticky
276 261,927
gamecorpstudio's avatar
gamecorpstudio
Unread hot topic
164 38,119
totoe's avatar
totoe