Change player color

Started by
2 comments, last by oenda 10 years, 10 months ago

Hi.I am developing a 2D strategy game like AoE 2.I need to change player color on sprites.How can i do that?

Thanks.

Advertisement

What have you tried?

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

Use 8-bit alpha maks which define the color changing regions. In the default version of the sprite, color the changing areas as white. In the pixel shader, modulate the sprite texel with the desired unit color and then lerp between the original sprite color and the modulated sprite color according to the alpha map.

Cheers!

Sorry for late post.I will try it.Thanks :)

This topic is closed to new replies.

Advertisement