★ TouchArcade needs your help. Click here to support us on Patreon.

How to make glow effect in cocos2dx

06-01-2014, 08:10 AM
Junior Member [Original Poster]
Joined: Dec 2013
Posts: 6
How to make glow effect in cocos2dx

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 :

Last edited by Umen; 06-01-2014 at 08:28 AM.
06-01-2014, 10:55 AM
Joined: Apr 2013
Location: Seattle
Posts: 60
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.
06-01-2014, 12:26 PM
Junior Member [Original Poster]
Joined: Dec 2013
Posts: 6
Good idea

i was wandering if it can be done combining shaders , what is better ?
06-02-2014, 03:35 AM
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.

Roguebox Studios
Like us on Facebook
Follow us on Twitter
Subscribe to our Youtube Channel

Last edited by Rogue; 06-02-2014 at 03:39 AM.