Support our Sponsors:

Go Back   Touch Arcade > Developer Discussion > Public Game Developers Forum

Reply
 
Thread Tools Display Modes
  #1  
Old 06-01-2014, 08:10 AM
Umen Umen is offline
Junior Member
iPhone 5, iOS 7.x
 
Join Date: Dec 2013
Posts: 2
Default 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..
Reply With Quote
  #2  
Old 06-01-2014, 10:55 AM
cadaei cadaei is offline
Junior Member
iPhone 5, iOS 6.x
 
Join Date: Apr 2013
Location: Seattle
Posts: 17
Default

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.
Reply With Quote
  #3  
Old 06-01-2014, 12:26 PM
Umen Umen is offline
Junior Member
iPhone 5, iOS 7.x
 
Join Date: Dec 2013
Posts: 2
Default Good idea

i was wandering if it can be done combining shaders , what is better ?
Reply With Quote
  #4  
Old 06-02-2014, 03:35 AM
Rogue's Avatar
Rogue Rogue is offline
Junior Member
iPad 2, iOS 5.x
 
Join Date: Feb 2011
Location: Brisbane, Australia
Posts: 27
Default

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.

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

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 2012, TouchArcade.com, LLC.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Copyright 2008 - 2011, TouchArcade.com. Privacy Policy / DMCA Copyright Agent