Alpha blending issue (with video)

Got a problem with alpha blended objects. I managed to isolate it to some degree now.

In the video, the red blocks are the bounding boxes of geometry, and the blue boxes are bounding boxes of impostors. Notice how the branches flicker.

They are not using some weird face culling or depth testing or something. The only render state (in all materials) is Blend Alpha.

Boxes and trees are in the transparent queue.

The issue is still around without impostors available btw. Basically, these are just a few batches of alpha blended objects (batched using batch factory), surrounded by alpha blended semi transparent boxes. Nothing else is going on.

About the boxes btw. They just show what’s going on when transitioning. If a red box surrounds something, only the geometry node is attached. If red + blue box surround something, there’s a transition between geometry and impostor so both geom and impostor nodes are attached, and if only the blue box show, there’s only the impostor node attached.

As you can see the transitioning is not causing this, since the flickering happens regardles of what boxes are surrounding the trees (red or blue or both), and isn’t just happening when the boxes are added/removed etc.

I’m starting to suspect this has something to do with transparent objects being inside other transparent objects. Just not sure what’s causing it.

Looks like a Z-sorting issue to me. If the red box is really the same as the bounding box for the trees then you will see this since one will seemingly randomly sort in front of the other. For transparent objects, it’s very important that they get drawn back to front (or similar order) for the transparency to render properly.

You could solve this a few ways:

  1. add your own geometry comparator to the transparent bucket to always sort your box geometry to be last.
  2. add the boxes to the translucent bucket instead.


I looked at the comparator, and I get how it works. Thank you. This is indeed the problem.