2D Toolkit Forum

2D Toolkit => Support => Topic started by: drGsus on February 27, 2012, 04:07:08 pm

Title: overlay a color completely?
Post by: drGsus on February 27, 2012, 04:07:08 pm
Hi unikron,

I would like to cause a "blinking" effect, in which a hit enemy starts to blink white. My problem is, that the color value on a sprite, cant really overlay a color over the sprite. White shows me the exact original color values, and every other color modification just change the tint towards the specified color, except black of course.

Is it somehow possible to "overlay" a color over the sprite?

Thanks
Title: Re: overlay a color completely?
Post by: unikronsoftware on February 28, 2012, 02:53:02 pm
I will need to investigate this further. It is actually possible to do this without breaking batching using one material as other objects, but I will need to work out the best way to achieve this without breaking everything!
Title: Re: overlay a color completely?
Post by: unikronsoftware on February 29, 2012, 01:38:13 pm
Hi,

This isn't possible using the current shaders, premultiplied or otherwise. Here are some steps to get the effect using a custom shader -

1. Turn off premultiplied alpha on your sprite collection and click commit.
2. Add this shader to your project
3. Manually switch the shader in the material attached to the sprite collection to this shader (BlendAddColor)

.rgb colors will be additive (black = original image, white = fully white), whereas .a is multiplied. So you can still do flashing objects which are fading away simultaneously.

Hope this helps.
Title: Re: overlay a color completely?
Post by: drGsus on March 01, 2012, 01:40:59 pm
Thats amazing unikron,

thank you very much :)
Title: Re: overlay a color completely?
Post by: monkey_balls on April 01, 2014, 09:00:46 pm
Hi Unikron,
I know this is old, but I'm having the same problem trying to make a white overlay, and I don't know how to get that shader you've made.
Can you get that for me? I'm quite a noob here, but I think I"ve understood the problem.
Thanks!
Title: Re: overlay a color completely?
Post by: unikronsoftware on April 01, 2014, 11:16:01 pm
You will need to register your copy to get download access.
http://2dtoolkit.com/forum/index.php/topic,34.0.html
Title: Re: overlay a color completely?
Post by: monkey_balls on April 03, 2014, 02:13:24 am
Thank you so much, this helped a lot!  :)
Title: Re: overlay a color completely?
Post by: cloudcamaleoniv on June 21, 2014, 07:01:53 am
So, I can't see the download link.

I'm already a registered member. It says:
"Current Membergroups   
Registered Members
Every member of the forum is a member of this group."

And still I can't see the download link. In fact, I think I've never seen any download links here, but I never needed to.

How may I download this shader? Thanks.
Title: Re: overlay a color completely?
Post by: unikronsoftware on June 21, 2014, 08:09:14 pm
You will need to register your copy of 2D Toolkit
http://2dtoolkit.com/forum/index.php?index.php/topic,34.0.html