Tinting imageMaps?
by Brian Carter · in Torque Game Builder · 03/10/2008 (9:29 am) · 3 replies
Is it possible to "tint" an image with a color?
For example, I have an animated sprite that consists of 10 image frames consisting of a characters rendered hair - which would be overlayed on top of the head/body/legs sprites. Now, instead of rendering out 4 hair color animations (black, red, blond, and brown) I want to just render out a generic hair model and then apply the color in the game; therefore, instead of rendering out 4 image strips (1 for each color) I could just render out 1.
Now, given that I want to implement 3 separate hairstyles (long, bob and ponytail), in 4 colors, walking in 8 directions, then the number of image / sprite strips starts to get unmanagable doing it individually .. 4*3*8 = 96 strips of 10 frames each means 960 cells to be rendered - and thats just for the hair. However. if I could colorize the hair then I would just need 1 render for each style with 8 directions of movement, which would be 3 styles * 8 movements = 24 strips (240 cells) .. a considerable difference in both memory usage and render time / number of files.
Would blending work? Or is there any other method of "colorizing" the hair at run time based on a set imageMap? If that makes any sense?
For example, I have an animated sprite that consists of 10 image frames consisting of a characters rendered hair - which would be overlayed on top of the head/body/legs sprites. Now, instead of rendering out 4 hair color animations (black, red, blond, and brown) I want to just render out a generic hair model and then apply the color in the game; therefore, instead of rendering out 4 image strips (1 for each color) I could just render out 1.
Now, given that I want to implement 3 separate hairstyles (long, bob and ponytail), in 4 colors, walking in 8 directions, then the number of image / sprite strips starts to get unmanagable doing it individually .. 4*3*8 = 96 strips of 10 frames each means 960 cells to be rendered - and thats just for the hair. However. if I could colorize the hair then I would just need 1 render for each style with 8 directions of movement, which would be 3 styles * 8 movements = 24 strips (240 cells) .. a considerable difference in both memory usage and render time / number of files.
Would blending work? Or is there any other method of "colorizing" the hair at run time based on a set imageMap? If that makes any sense?
#2
Naturally, the blendcolor setting above is just an example but should be easy enough for you to figure out from there.
03/12/2008 (3:38 pm)
Blending should work, or at least provide a good shot at what you want. It is also easy to test out to see if it has the effect you desire. If you aren't familiar, it goes like this:yourIMG.setBlendColor("0 1 1 1");Naturally, the blendcolor setting above is just an example but should be easy enough for you to figure out from there.
#3
03/12/2008 (4:55 pm)
It's on my list of things to play with, kinda just fielded the problem out there to see if anybody had any other solutions that were common place on which I could draw from.
Torque Owner Brian Carter