Ooops
July 04, 2020, 08:01:59 PM

Author Topic: Texture alpha not working right.  (Read 733 times)

Offline JBR

  • Full Member
  • ***
  • Posts: 102
Texture alpha not working right.
« on: January 11, 2020, 01:05:18 AM »
Looked at the code for the radar (by Krischan a long time ago!)

It is working perfectly with minib3d but I cannot get rid of the solid rectangle in openb3d.

Does openb3d have alpha issues?

Thanks, Jim.

Offline angros47

  • Jr. Member
  • **
  • Posts: 43
Re: Texture alpha not working right.
« Reply #1 on: January 11, 2020, 05:33:12 PM »
Which format have you used for the radar picture?

Offline JBR

  • Full Member
  • ***
  • Posts: 102
Re: Texture alpha not working right.
« Reply #2 on: January 11, 2020, 08:01:56 PM »
CreatePixmap( texture_size%,  texture_size%, PF_RGBA8888)

and later I use pixmaptotexture. (Which forces the image to above setting)

Jim.

Offline angros47

  • Jr. Member
  • **
  • Posts: 43
Re: Texture alpha not working right.
« Reply #3 on: January 12, 2020, 03:49:43 PM »
Have you specified, in CreateTexture, to use alpha mask? (flag 4)

Offline JBR

  • Full Member
  • ***
  • Posts: 102
Re: Texture alpha not working right.
« Reply #4 on: January 12, 2020, 10:18:04 PM »
Hi, flag 4 is 'Masked'.

Tried it and it works. Not alpha though, so the edges are a bit 'sharper' than they should be.

Thanks for the help. Jim.

Offline Kippykip

  • Full Member
  • ***
  • Posts: 118
    • Kippykip Forums!
Re: Texture alpha not working right.
« Reply #5 on: January 15, 2020, 01:56:33 PM »
I used some funny workarounds, I have this in a DEFS.bmx to make things easier:

Code: [Select]
Const TextureFlags_Color:Int = 1 '1:Color (Default)
Const TextureFlags_Alpha:Int = 2 '2:Alpha
Const TextureFlags_Masked:Int = 4 '4: Masked
Const TextureFlags_Mipmapped:Int = 8 '8: Mipmapped
Const TextureFlags_ClampU:Int = 16 '16: Clamp U
Const TextureFlags_ClampV:Int = 32 '32: Clamp V
Const TextureFlags_Sphere:Int = 64 '64: Spherical environment map
Const TextureFlags_Cubic:Int = 128 '128: Cubic environment map
Const TextureFlags_VRam:Int = 256 '256: Store texture in vram
Const TextureFlags_HighColor:Int = 512 '512: Force the use of high color textures

Then load texture like so here:
https://kippykip.com/b3ddocs/commands/3d_commands/LoadTexture.htm

I find if you use alpha textures and don't specify any flags, there's a chance it'll use whatever texture filter the last thing drawn to the screen was before.
For actual meshed with predefined textures, my workaround was to add this to the top of my project:
TextureFilter("M#", 1 + 4)
TextureFilter("m#", 1 + 4)
TextureFilter("A#", 1 + 2)
TextureFilter("a#", 1 + 2)

Then when I load meshes and it loads a texture from the model, if the beginning of the filename has "m#" it'll be masked, otherwise if it begins with "a#" it uses alpha.

Hopefully these tips don't require a huge rewrite ;)

Offline JBR

  • Full Member
  • ***
  • Posts: 102
Re: Texture alpha not working right.
« Reply #6 on: January 15, 2020, 10:27:30 PM »
Thanks Kippykip,

I'm not actually loading in textures, just creating them.

Might use your online documents. :-)

Thanks, Jim.

Offline JBR

  • Full Member
  • ***
  • Posts: 102
Re: Texture alpha not working right.
« Reply #7 on: January 16, 2020, 02:04:09 AM »
Kippykip, your online manual is much better than the one built into B3D. I thank you for it!

Fixed the alpha not working, you have to do EntityFX <entity>, 32. This FORCES alpha.

Having fun, Jim.

Offline Kippykip

  • Full Member
  • ***
  • Posts: 118
    • Kippykip Forums!
Re: Texture alpha not working right.
« Reply #8 on: February 01, 2020, 02:28:20 PM »
Kippykip, your online manual is much better than the one built into B3D. I thank you for it!
I'm late to respond but yeah back when Blitz3D was still up for download, there was an updated helpdocs .exe.
This is just a mirror of the updated b3ddocs help html pages but 95% also applies to OpenB3D :)

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal