3D Sprite mask color??

Blitz3D Forums/Blitz3D Beginners Area/3D Sprite mask color??

Kiyoshi(Posted 2010) [#1]
Hey y'all, I was wondering if there's a way to make a certain color in a 3D sprite "masked", or transparent. Is it possible to make it so that color 255,0,255 is completely transparent, and the rest of the colors completely opaque? I vaguely remember reading a similar topic before, but I lost it. -_-


dawlane(Posted 2010) [#2]
Have a look at MaskImage in the manual
http://www.blitzbasic.com/b3ddocs/command.php?name=MaskImage&ref=2d_cat

And http://blitzbasic.com/Community/posts.php?topic=74180 may be of some help


Aussie(Posted 2010) [#3]
The other way to do it is to use a format that supports an alpha channel (Tga, Png) & make the areas you want transperent in an image manipulation program (Gimp, Photoshop). Then use "Loadsprite,sprite,2" 2 is the alpha texture flag.


Ross C(Posted 2010) [#4]
I have a function in my code archive entries for this. Blitz, upon loading a sprite/texture, unless specifically told to, by a certain texture format, seems to turn any RGB(0,0,0) pixels/texels, into the masking colour for 3d sprites. You need to manually read off what colour you want to mask, and write the alpha information to the texture/sprite. In fact, if your loading a sprite, your best to load texture, create sprite, then apply the texture to the sprite, that way you can alter the texture.

Mask/alpha information in textures is NOT based on colour. Each pixel in a texture can have it's own alpha value, so it's completely indepedant of colour.

MaskImage does not affect 3d textures/sprites

http://www.blitzbasic.com/codearcs/codearcs.php?code=1013

Read the description, as you'll need to clear all alpha information from the texture before you set a mask colour.


Kiyoshi(Posted 2010) [#5]
Thaaank you!! :D