Hello Guest

Author Topic: Multiple material and shader for 1 sprite collection  (Read 4014 times)

subzaku

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Multiple material and shader for 1 sprite collection
« on: March 16, 2017, 04:58:09 am »
Hi, i have a sprite collection containing my inventory sprite and the sprite is colored, i want to make cooldown effect so when it is on cooldown i'm masking the desaturated sprite over the grayscale, and when it's off cooldown, i show the colored sprite

What i did is:
1. I make 3 material, 1 for colored, 1 for desaturated, 1 for grayscale
2. Change the respective sprite material shader and apply it to each object

so far it's ok, but when i run the game all the material reverted back to the 1st material which is the colored one.

is there any way i can change the sprite color to grayscale using only 1 sprite collection and just multiple material?
thanks

Update:
I tried commenting the update material function on tk2dsprite, it works, but i wonder is it gonna cause any problem?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Multiple material and shader for 1 sprite collection
« Reply #1 on: March 20, 2017, 05:10:30 pm »
It will only cause problems if you use multi atlas spanning in tk2d. If you don't use the feature then you're fine in doing this.