Alpha map in 2D
Blitz3D Forums/Blitz3D Beginners Area/Alpha map in 2D
| ||
Hi again, Is there any way to get alpha map results using the 'Image' functions provided from Blitz3D. To be more specific i want to create 2D buttons for user input. As far as i know you can set only one transparent color using MaskImage function but in my case this is not acceptable. Thanks! |
| ||
The 2D commands built into Blitz3D do not support alpha transparency. You want a 2D-in-3D system, or a UI/sprites/HUD system. |
| ||
To achieve alpha in 2D, you'd have to manually compute the blending of background colors with your graphics that need to alpha overlay. The problem that can arise in this situation is that per-pixel shading in blitz3D is not good for real-time usage. The readpixelfast and writepixelfast commands (used with the lockbuffer/unlockbuffer commands) are just not fast enough. If you pre-computed the transparency blend for all situations, then you could *simulate* alpha-blending. It's a shame Mark Sibley doesn't create an alpha-shaded 2D image function in blitz3D for those wanting to use B3D for 2d programming. Apparently, it's been added to BlitzMax (I don't have BMax, so I'm guessing). You'd almost have to do a hack, as per jhocking, in which you use 2D-in-3D, ie. use your images basically as all sprites. |
| ||
You can fake 50% transparency, by applying a checkered mask to your image. Checker the image in your choosen image mask colour, and when draw at a decent res, 800x600 or above, it looks decent and is super fast. |
| ||
well guys, thanks for your guidelines. I understand that there are many ways but they demand programming effort and time. In my case (i need quickly results) it would be preferable to get a "ready to use" solution. Meanwhile i searched in google for "sprites in blitz3d" and i saw a very impressive demo of the Sprite Candy library. It cost about 30€ and i believe its worth the money. But i don't know if there is still support and how easy it is. |
| ||
Try looking for N-sprite 2. |
| ||
Look in the code archives under graphics for tbm images...it worked for me! |
| ||
Thanks i will look... |
| ||
http://www.blitzbasic.com/codearcs/codearcs.php?code=773 http://www.blitzbasic.com/codearcs/codearcs.php?code=1173 |