Ooops
January 20, 2021, 01:38:10 PM

Author Topic: Blitz3D and PNG's  (Read 2318 times)

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 2918
  • elgol 2021
Blitz3D and PNG's
« on: March 09, 2018, 05:46:20 PM »
Just ran Blitz3D and loaded a png.  The alpha isn't showing, so I get a white block around the sprite.  A blend mode needs to be set? 
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, BBC B, C64, ZX Spectrum

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1128
Re: Blitz3D and PNG's
« Reply #1 on: March 09, 2018, 06:40:16 PM »
i use the flag 2 or flag 1+2 (and of course your image must be "clean" (=no progressive outlines))

if you want to be sure, you can use one or several mask colors, and identify each mask color in Blitz3d, and rewrite the alpha value that you want.

See my code examples here :
https://www.syntaxbomb.com/index.php/topic,1962.msg2951.html#msg2951
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 Steve Elliott

  • Hero Member
  • *****
  • Posts: 2918
  • elgol 2021
Re: Blitz3D and PNG's
« Reply #2 on: March 09, 2018, 06:43:38 PM »
Quote
i use the flag 2 or flag 1+2

And the command to do this is?  I'm not a Blitz3D user.
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, BBC B, C64, ZX Spectrum

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1128
Re: Blitz3D and PNG's
« Reply #3 on: March 09, 2018, 06:46:27 PM »
Texture = LoadTexture("filename.png",flags) (1 = color | 1+2 = color+alpha | 1+4 = color+mask (hide black texels) )

add flag 256 if you want to write alpha on a texture, it prevents bugs on some computers...
so LoadTexture("filename.png",1+2+256) or CreateTexture(Width,Height,1+2+256)
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 Steve Elliott

  • Hero Member
  • *****
  • Posts: 2918
  • elgol 2021
Re: Blitz3D and PNG's
« Reply #4 on: March 09, 2018, 06:49:17 PM »
LoadTexture??  That sounds like a 3D command, not a 2D one.
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, BBC B, C64, ZX Spectrum

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1128
Re: Blitz3D and PNG's
« Reply #5 on: March 09, 2018, 06:50:04 PM »
Oh, there is no alpha on images in Blitz3d, only masking of black pixels... You have to use a texture if you want a variable transparency...
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 Steve Elliott

  • Hero Member
  • *****
  • Posts: 2918
  • elgol 2021
Re: Blitz3D and PNG's
« Reply #6 on: March 09, 2018, 06:54:24 PM »
Oh, so Blitz3D doesn't really support 2D PNG then?  Just old skool hard edge (pick a colour to be transparent)?
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, BBC B, C64, ZX Spectrum

Offline RemiD

  • Hero Member
  • *****
  • Posts: 1128
Re: Blitz3D and PNG's
« Reply #7 on: March 09, 2018, 07:14:10 PM »
For images (2D), the pixels with a black color (000,000,000) will be masked (fully transparent)

For textures loaded with the alpha flag, the texels with an alpha value less than 255 will have the defined transparency
For textures loaded with the mask flag, the texels with a black color (000,000,000), will be masked (fully transparent)

Note that you can produce pixel perfect "images" using quads and textures if you disable bilinear filtering... So you can have alpha on "images" (but they would be quads + textures)
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 Steve Elliott

  • Hero Member
  • *****
  • Posts: 2918
  • elgol 2021
Re: Blitz3D and PNG's
« Reply #8 on: March 09, 2018, 07:17:11 PM »
ok, thanks.
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, BBC B, C64, ZX Spectrum

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal