Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm working on a 3D real time tactics wargame and a primary feature is military customisation. As part of the customisation, I would like to have the player be able to change some of the colors of the unit's texture, similar to how Dawn of War has their color changer. How did they do this?

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

You can either:

  • Use the player chosen color when drawing specific polygons on the units. Simple as it sounds, there are certain polygons in the unit model that aren't textured and instead are colored entirely with the color the player chooses. This could be a little flag they're carrying or arm bands or whatever you like.

  • Use a base color under the texture for the units that will change the overall hue of the texture to that of the chosen color. When drawing a surface you can set its color and put a texture on top of that, with the proper settings for whatever you're using (OpenGL or DirectX), you can have the texture blend with the base color. For the white or transparent portions of your texture, the base color will take over completely.

  • Use a combination of the above.

share|improve this answer
add comment

Many games use the alpha channel of the texture for that. That's a simple composition, first the player color and than the texture on top of it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.