I have searched the forums for the answer to this question, but have not found anything like it. I was wondering would it be possible to use alpha transparency to change the color of a bitmap/material. In other words instead of rendering transparent pixels as either transparent or black is there some way that transparent pixels could be made to represent another color like blue or red? I have attached an image of my project. What I want is for the transparent pixels of the texture to be rendered as another color, which would allow for the color of the car to be changed without loading a different texture. Is this at all possible in Away3d?
Thanks in advance.
Using alpha transparency to change color?Software: Away3D 4.x |
||
abpyles, Newbie
Posted: 31 October 2013 01:44 AM Total Posts: 4
|
||
theMightyAtom, Sr. Member
Posted: 31 October 2013 08:11 AM Total Posts: 669 [ # 1 ] You can do this quite easily by manipulating the bitmapData used in the texture material. When creating the bitmapData you can assign a color that will be used for transparent textures. To get even more control, for example if you wanted to add different numbers on the sides of each car, etc. you could make a Sprite with all your configurations and then use myBitmapData.draw(mySprite) to assign it to the material. After assigning, just remember to run yourTexture.invalidateContent() to force the textureMaterial to update. Good Luck!! |
||
GoroMatsumoto, Sr. Member
Posted: 01 November 2013 01:52 AM Total Posts: 166 [ # 2 ] How about ColorMatrixMethod or ColorTransformMethod? Doc about ColorTransformMethod: init:
ct = new ColorTransform(4,0,0,255,-255,-255); update:
ct.redMultiplier = newRMul; I’ve not used this class, and I’ve not tested this code. Good luck. Edit:
|
||
|