texture buffer masked image issue

Started by GrindalfGames, August 18, 2021, 11:55:11

Previous topic - Next topic

GrindalfGames

Ok so I have a masked texture for my enemy and was going to do the oldschool FF way of deleting them with circles.

setbuffer texturebuffer(enemy)
color 0,0,0
x=rand(100)
y=rand(100)
size=rand(25)
oval x,y,size,size,true
setbuffer backbuffer()



now this works partially as expected, black filled circles appear all over the enemy except they are drawn black unlike the rest of the black pixels on the original image which are masked.

RemiD

#1
with Blitz3d, the black (0,0,0) pixels of an image are not drawn (using drawimage), but the black (0,0,0) texels of a texture are drawn depending on their alpha values.

so when you draw your black texels on the texture, you also need to set their alpha values to 0

see : https://www.syntaxbomb.com/graphics-40/bb-writeread-color-alpha-of-each-texel-of-a-texture-with-different-commands-by-r/msg347047229/#msg347047229


a faster alternative would be to use 2 textures for each mesh, and blend them in a way that the black / white colors of one layer make the colors of the diffuse layer, transparent / opaque.

GrindalfGames

Thanks RemiD. I went with a different effect in the end but this is still useful knowledge that may help me with something else in the future