Hello Guest

Author Topic: Shifting the Hue of animated sprites  (Read 5664 times)

Cybertiger

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 7
    • View Profile
Shifting the Hue of animated sprites
« on: December 18, 2013, 07:43:37 pm »
I thought this might be a common thing to do but apparently not as i looked around.
Could anyone please point me in the right direction how to shift the Hue of a animated sprite. I don't want to do the tint thing in the  sprite as it also changes my whites.
I have heard that a shader solution might be the best way to go but i have no clue how to achieve this or where to find such shader

Many thanks in advance

Cybertiger

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Shifting the Hue of animated sprites
« Reply #1 on: December 18, 2013, 07:56:39 pm »
Damnit ....i was looking for a solution the whole day but as soon as i posted i found this which seems to work for anyone else trying to do this:
http://forum.unity3d.com/threads/89041-Problem-with-getting-hue-shift-shader-right

A option for a hue shift would be a great addition to the standard tk2d Shaders. ;)

Sorry for the spam guys.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Shifting the Hue of animated sprites
« Reply #2 on: December 18, 2013, 11:56:18 pm »
That shader really isn't a good idea if you're doing anything mobile, unless you're using it on really tiny sprites. Performance will be abysmal, especially on older phones using it at any appreciable size. Generally hue shifts are not a good idea, its often much more efficient to simulate palettes and hue shift that way.

Cybertiger

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Shifting the Hue of animated sprites
« Reply #3 on: December 19, 2013, 08:13:49 am »
Thanks for your advice. 
I have noticed that tk2d doesn't let me change my shader. My shader is on my sprite and everything seems to work but once i play a animation it jumps to the the default tk2d Shader for 1 frame or so and then jumps back to my custom shader.
Could you please explain how i would go about palettes? Do you mean i should create custom sprites for each color?

Thanks

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Shifting the Hue of animated sprites
« Reply #4 on: December 19, 2013, 11:48:47 pm »
You should change the atlas material, and probably use vertex colours / alpha to key the colour shift. This will also help keep draw calls down.