Transparency issue: chaotic z-ordering?

Hello there!

It has been a while I did not come on the forum; I had a lot of things to deal with recently :smiley: happy things.
Anyway, I am still working on a game as a contractor using BabylonJS and I am facing quite an unexpected issue: when I use transparent textures, it seems that the rendering is glitchy.

An image is worht one thousand words, hence here it goes:
transparency-issue

I highlighted in red some of the problematic areas. For instance, you can see that the wood poles and ropes are rendered behing the bridge floor’s wooden beams; which is not how it should be. Also, on the top right. you can see that the rock edge of the floating island (yes these are floating islands :P) is rendered on top of the island floor… which is not how it should be.

Is there any setting that I should change in my texture to avoid these glitches?
Thank you very much for you help :smiley:

is this issue related to this : Transparency and How Meshes Are Rendered - Babylon.js Documentation ?

In this case, this could help : Use Facet Data - Babylon.js Documentation

Can you make sure that your material has no alpha and no opacityTexture? If there is an alpha source then your meshes will be forced in the transparent pipeline (as state by documentation linked by @jerome)

I am not sure I understand… my material does need some kind of alpha/opacity information because our graphist relies on transparency to create the wood beams, grass stalks, etc. in the 3D tiles.

Our graphist contacted me recently to tell me he found a solution. Ping @Num_T :slight_smile:
(hopefully, I am pinging the right Num_T)

lol ok:) alpha can be used for blending (like mixing colors) or for testing (like eliminating some pixels based on alpha values) and I guess you needed the latter

Just to put this to bed - the solution was to edit the babylon file manually (with a text editor) and set the hasAlpha value to true for the baseTexture and the transparencyMode to 1 as we needed the equivalent of a cutout material without alpha blending but I couldn’t work out how to get the 3ds Max Exporter to set these values either automatically (from the use of a png with transparency) or manually (if that’s even possible?).

1 Like