2D Toolkit Forum

2D Toolkit => Support => Topic started by: marcosramos on September 19, 2013, 09:53:36 pm

Title: Change a sprite color, but instead of tinting the pixels, solid paint them.
Post by: marcosramos on September 19, 2013, 09:53:36 pm
I'm not quite sure if it's a TK2D question, or more of a general question, sorry if it's general.

I want my sprite to be painted red to display a character taking damage, but i don't want his forms to be visible like when it happens when I simply change the color through tk2dsprite and he gets tinted red. I want his form to become all Red.

I can do something like that changing the shader in runtime, but the color won't change If there is a tk2dSprite script in it, even if I change the tk2dsprite color or directly via material.renderer.color.

Even so, i'd rather have another solution other than changing the shader because i know zero about shaders, but if it can't be done, then I will go that way, no worries.

Thanks!



Title: Re: Change a sprite color, but instead of tinting the pixels, solid paint them.
Post by: unikronsoftware on September 19, 2013, 11:54:13 pm
This shader is additive instead of multiplicative. It won't COMPLETELY replace the color, but should be a better result than what you get now.
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,391.msg1708.html#msg1708
Title: Re: Change a sprite color, but instead of tinting the pixels, solid paint them.
Post by: marcosramos on September 20, 2013, 12:03:17 am
Yes, I decided to go for the shader solution.

The GUI/Text Shader from unity default shaders does exactly what I was trying to do. It even allows alpha, so it's perfect, but thanks for the fast Answer!

 :D
Title: Re: Change a sprite color, but instead of tinting the pixels, solid paint them.
Post by: tarcisiotm on February 28, 2014, 06:25:09 pm
This GUI/Text Shader tip is gold! Exactly what I needed too!

Thanks for the tip, marcosramos!