Ooops
September 16, 2021, 22:02:54

Author Topic: texture buffer masked image issue  (Read 224 times)

Offline grindalf

  • Full Member
  • ***
  • Posts: 191
texture buffer masked image issue
« on: August 18, 2021, 11:55:11 »
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.

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1282
Re: texture buffer masked image issue
« Reply #1 on: August 19, 2021, 09:38:48 »
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.
« Last Edit: August 19, 2021, 09:40:24 by RemiD »
DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline grindalf

  • Full Member
  • ***
  • Posts: 191
Re: texture buffer masked image issue
« Reply #2 on: September 14, 2021, 22:38:07 »
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

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal