January 22, 2019, 01:12:01 AM

Author Topic: Alpha textures and the ZBuffer?  (Read 632 times)

Offline Kippykip

  • Jr. Member
  • **
  • Posts: 74
    • Kippykip Forums!
Alpha textures and the ZBuffer?
« on: November 15, 2017, 06:12:51 PM »
I noticed a while back in MiniB3D and OpenB3D, that textures with the alpha flag end up looking really weird in front of other polygons.

Does anyone happen to know of any workarounds?

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 314
Re: Alpha textures and the ZBuffer?
« Reply #1 on: November 15, 2017, 08:37:16 PM »
One thing it might be is when meshes are at the same coordinates the z/depth buffer can't calculate which is to be drawn first thus affecting alpha textures, a small offset is supposed to fix it maybe as little as 0.0001 units.

Offline Kippykip

  • Jr. Member
  • **
  • Posts: 74
    • Kippykip Forums!
Re: Alpha textures and the ZBuffer?
« Reply #2 on: November 15, 2017, 09:35:29 PM »
One thing it might be is when meshes are at the same coordinates the z/depth buffer can't calculate which is to be drawn first thus affecting alpha textures, a small offset is supposed to fix it maybe as little as 0.0001 units.
Yeah it's something to do with OpenGL itself not changing the order the meshes are drawn with alpha textures. They're treated the same, some thread said by using EntityAlpha 0.99 shows the full effect.

But come to think of it, I haven't tried completely separating the polygon with the alpha texture, as the vertices are connected to the meshes around it.

Offline Kippykip

  • Jr. Member
  • **
  • Posts: 74
    • Kippykip Forums!
Re: Alpha textures and the ZBuffer?
« Reply #3 on: November 15, 2017, 09:53:23 PM »

Wow that actually worked! :o
Thanks once again mark! You're always extremely helpful on these forums

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 314
Re: Alpha textures and the ZBuffer?
« Reply #4 on: November 16, 2017, 03:52:17 AM »
Hi Kip,

glad to help, I got that tip from Edzup on the Minib3d Monkey threads so credit to him, it seems to be a great little 3d engine for mobile, I still haven't even looked at it yet so I'll have to do that soon.