2D Toolkit Forum

2D Toolkit => Support => Topic started by: ItsMeAlan on October 25, 2013, 11:51:51 pm

Title: Easy way to have shader create red outline around sprite?
Post by: ItsMeAlan on October 25, 2013, 11:51:51 pm
In my game I want to indicate that the player is able to interact with an object by having a glowing red outline appear around it, pulsating in color. I want to do this with code so I can slap it on different objects with several frames of animation without having to come up with a ton of new art assets. Is there an easy way to do this with shaders?
Title: Re: Easy way to have shader create red outline around sprite?
Post by: unikronsoftware on October 26, 2013, 12:22:36 am
If you place multiple copies of the sprite behind the main one, with a shader that draws a solid colour but uses the alpha channel, you should get an outline. You don't want to do this on big sprites though, as there will be a fair bit of increased overdraw there.
Title: Re: Easy way to have shader create red outline around sprite?
Post by: ItsMeAlan on October 26, 2013, 09:02:20 pm
Yeah, I do have some pretty big sprites with several lengthy different animation clips, and this is a mobile game so I'm striving to keep everything optimized. Do you think it's possible to do with just a custom shader?
Title: Re: Easy way to have shader create red outline around sprite?
Post by: unikronsoftware on October 26, 2013, 09:46:03 pm
Not just with a shader. You could do it as I suggested above, shader + multiple copies of the sprite. I don't know how bad the impact will be on perf.