Alpha transparency order bug in BGE

Hi,

As you can see from the attached blend, there is an issue when adding an object with two alpha transparency faces that will cause them to draw the wrong way around every second time you see it.

To use, push ‘spacebar’ to add the object and ‘enter’ to remove it. What you’ll quickly notice is it toggles between which face it shows in front. This is no trickery with python… and it didn’t used to do this in Blender2.45. It also always does it correctly the first time you run the simulation.

About a year and a half ago I posted this while trying to upgrade to 2.50~ and at the time someone suggested breaking apart the two faces, but this just isn’t practical in every situation where you want more than one alpha texture on an object. Even when using two objects it doesn’t work unless the center points are moved appart (what if I wanted to see it from the other side?). Surely this toggling behavior isn’t intentional, and like I said above: it used to work fine!

What is the best way to go about fixing this problem? I’d settle for a solution involving setting on the object, or material, etc as long as at the end of the day I can use multiple textures on an object and not have them toggle order.

Thank you kindly for any help!

The best thing you can probably do is either make sure you have the blending set to ‘alpha sort’ or use ;alpha clip’ whenever possible.

It is likely that this issue has been in the BGE since it was created during Blender’s commercial days and the current devs. noted that fixing it isn’t entirely straightforward, as for one thing it was noted that the BGE handles alpha differently depending on whether the face is a quad or a triangle.

Thanks for the reply, Ace.

I’ve tried ‘alpha clip’ and had no luck. What is the ‘alpha sort’ you mentioned?

Possible, but then why did it used to work in Blender2.45? If it was entirely uncontrollable then it seems weird that it would always show properly the first time, then consistently toggle the face it shows on top.

For triangles, I understood that BGE converts all faces to triangles anyway? Is this right? I’ll try out cutting up the faces into triangles and see if that helps. Will post later with results!

I tried with 2.63 and I do not see a problem

what version are you using?

2.59. It was the only one I could get runtimes to work properly with Intel HD 3000 cards.

I use 2.63 and have the same problem with GLSL and texture face mode too, whenever texture with alpha are involved.

Picture:

With the mist enabled you can see that the farther tree was drawn over the nearer ones. It looks really strange when I want to set up a forest. Does the same since 2.57, the viewport renders it good but once I start the game it gets all messed up.