Hello Guest

Author Topic: overlay texture/masking  (Read 6519 times)

Jefemcownage

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 15
    • View Profile
overlay texture/masking
« on: June 06, 2012, 05:03:11 pm »
I'm currently tinting a sprite red as it takes more damage in a prototype i'm doing but I would like to overlay a sprite, perhaps even having a small texture that just repeats, on only the non-transparent pixels. Is this possible with 2d toolkit?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: overlay texture/masking
« Reply #1 on: June 06, 2012, 05:22:18 pm »
This isn't possible out of the box.
The most efficient way to do this is probably with a shader, but it will mean a unique draw call for the object.

Jefemcownage

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: overlay texture/masking
« Reply #2 on: June 12, 2012, 03:58:12 am »
Ok thanks any good places to start looking for a good shader?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: overlay texture/masking
« Reply #3 on: June 12, 2012, 09:55:38 am »
You can take the Blend2TexVertexColor shader, and base yours off that. Ideally, you should modify the sprite class to output a second UV channel, so you'll be able to use this shader directly. You can do this by creating a copy of the tk2dSprite class and modifying it to do that.