How to make glow effect in cocos2dx

Discussion in 'Public Game Developers Forum' started by Umen, Jun 1, 2014.

  1. Umen

    Umen Member

    Dec 16, 2013
    10
    0
    0
    #1 Umen, Jun 1, 2014
    Last edited: Jun 1, 2014
    i searching the web for glowing effect , i like to be able to create misc glowing effects ,
    like lasers , glow around sprites and such .
    couldn't find any thing on the web , any body have any direction ?
    something like this :
    [​IMG]
     
  2. cadaei

    cadaei Well-Known Member
    Patreon Bronze

    One simple way is to make a copy of the sprite image. Change it all to white. Apply a nice blur to it (all of that in a graphics program), then add the glow sprite behind the main sprite.

    If you use white, then in code you can simply tint the glow to whatever color you need.
     
  3. Umen

    Umen Member

    Dec 16, 2013
    10
    0
    0
    Good idea

    i was wandering if it can be done combining shaders , what is better ?
     
  4. Rogue

    Rogue Well-Known Member
    Patreon Bronze

    Feb 9, 2011
    174
    0
    0
    Games Developer
    Brisbane, Australia
    #4 Rogue, Jun 2, 2014
    Last edited: Jun 2, 2014
    Blur shaders can be hefty due to needing to do multiple samples of a texture (depending on the size of the blur) and you also need to account for the fragments in the sprite (number or samples x number of fragments). On a desktop GPU this is not an issue but on a mobile it adds up fast. I did a basic one way blur effect recently and only got to 4 samples before it started getting a bit dicey on an iPad 2.

    Your best move (as noted above me) is to preprocess the glow effect in a sprite. Now, whether you do that as an art asset or by using a blur shader to render to an FBO (do it during startup) is up to you. Easiest way is an art asset.
     

Share This Page