2D Toolkit Forum

2D Toolkit => Support => Topic started by: Flashist on June 30, 2013, 11:44:19 am

Title: Glow for single sprite
Post by: Flashist on June 30, 2013, 11:44:19 am
Hi!

Please, could anyone help me with adding glow effect for single object in 2dToolkit? Maybe someone may share example scene?
Title: Re: Glow for single sprite
Post by: unikronsoftware on June 30, 2013, 01:48:58 pm
There isn't a way to do this out of the box. The solution to recommend would depend on what platform you want to do this on, how big the sprites are, or if you have room in the atlas for glow sprites, etc. There isn't one slution that will work on all situations.
Title: Re: Glow for single sprite
Post by: Flashist on June 30, 2013, 07:47:56 pm
> The solution to recommend would depend on what platform you want to do this on,

It will be great to reach as many platforms as I can Now I want to bring my app on PC, Mac, iOS, Android and maybe PS3 (I understand, that I may have problems to bring my app to all platforms, but it will be great to get 1 app for all these platforms).


> how big the sprites are

I have square with size 30x30 pixels. And want to create glow around it.


> or if you have room in the atlas for glow sprites

I'm new in Unity3d (came here from Flash development) and I don't know much about atlases and rooms =( Please, could you tell more about this solution?

Also, I can create pre-rendered image with glow effect (in Flash) and use it. But when I tried to do that I see next thing (please check attached screenshots).

P.S.: sorry for my bad bad english.
Title: Re: Glow for single sprite
Post by: unikronsoftware on June 30, 2013, 08:58:58 pm
I'm not sure what the problem is with your glow object? Is the glow outline in the alpha channel?
Title: Re: Glow for single sprite
Post by: Flashist on July 01, 2013, 10:05:57 am
Yes, pre-rendered image has alpha channel (please check image attached to message).

I found some solution for me: I use another shader for Sprite Collection with glow image (before: tk2d/SolidVertexColor, now: tk2d/AdditiveVertexColor).

Now image looks better than before, but glow doesn't seem equal to glow on pre-rendered image =(
Title: Re: Glow for single sprite
Post by: unikronsoftware on July 01, 2013, 10:35:52 am
What is it supposed to look like with the glow? I think I"m missing some details here. Can you post a pic of hwat its supposed to look like, then what it looks like with whatever setup you've got right now?
Title: Re: Glow for single sprite
Post by: Flashist on July 02, 2013, 10:49:32 am
Sorry for delay.

Here 2 images:
1) glow_current.png - how it looks now in Unity (screenshot).
2) glow_how-need-to-be.png - combination of background and pre rendered glow image (I made combination in Photoshop). It will be great to reach full (or almost full) similarity of Unity and Photoshop images.
Title: Re: Glow for single sprite
Post by: unikronsoftware on July 02, 2013, 12:17:57 pm
You will need a combination for this. The glow bit needs to be additive, and the solid bit, well, needs to be solid.
Split it up into two sprites, one solid one for the center bit, and then another glowy bit. The glow needs to be additive, the center bit, just normal blend vertex color will do. In your scene, place the glowy one BEHIND the the solid one. Should be a close enough effect now, and if its not bright enough, stack up 2 glowy ones...
Title: Re: Glow for single sprite
Post by: Flashist on July 03, 2013, 06:35:53 pm
Thanks for answer.