Masking an Entity with another Image
Blitz3D Forums/Blitz3D Beginners Area/Masking an Entity with another Image
| ||
Hey guys. I'm just curious on how you'd go about masking a sprite entity with a seperate black and white mask image. For instance, if I had a rounded box sprite and I needed smooth edges around it rather it looking pixelated. Thanks in advance. |
| ||
You can't really smooth a mask like that. You can increase the resolution of the mask texture though, bringing in more detail. Other wise, use alpha instead of a mask. |
| ||
thank you for your response ross c the problem is, i can't figure out how to make an alpha channel for a texture. Is there an easy method of combining 2 textures to make say a heads up display with an outline that is 0% opacity but the rest is say 75% by using a black and white image that is used for an opacity map? |
| ||
The best thing you can do is to save your sprite out as a .png with alpha. It will load in fine as long as you put in the alpha flag when you load in. Then you can change the overall alpha of the entire sprite to get it semi-transparent. |
| ||
thank you for your reply boomboom The PNG thing works but i can't see any black. it seems to treat the transparent data as black, and then turns black into the transparent colour... ;; set up environment Graphics3D 1280,1024,32,1 SetBuffer BackBuffer() Global camera=CreateCamera() MoveEntity camera,0,0,-5 ;; load the image Global image1=LoadSprite("back.png") Global image3=LoadSprite("alpha.png",2) PositionEntity image3,0,0,1 While Not KeyDown(1) Cls RenderWorld() Flip Wend End here's the image with an alpha (just a quick example) and this is just a background to show its effect Right click and save image as for the images. |