Hello Guest

Author Topic: overlay a color completely?  (Read 10561 times)

drGsus

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
overlay a color completely?
« 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

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: overlay a color completely?
« Reply #1 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!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: overlay a color completely?
« Reply #2 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.

drGsus

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: overlay a color completely?
« Reply #3 on: March 01, 2012, 01:40:59 pm »
Thats amazing unikron,

thank you very much :)

monkey_balls

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: overlay a color completely?
« Reply #4 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!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: overlay a color completely?
« Reply #5 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

monkey_balls

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: overlay a color completely?
« Reply #6 on: April 03, 2014, 02:13:24 am »
Thank you so much, this helped a lot!  :)

cloudcamaleoniv

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: overlay a color completely?
« Reply #7 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.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: overlay a color completely?
« Reply #8 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