Instanced mesh with alpha = 1.0 is still semi transparent


I have a scenario where I want to have instanced meshes. The instanced mesh should either be semi-transparent or solid. However the mesh that has alpha = 1.0 is still semi transparent. I.e. it is possible to see through from one mesh to the other for both meshes.

Please see the PG:

Thanks a lot.

Pinging @Evgeni_Popov

As the transparency mode is “alpha blend” the meshes are considered to be transparent. That means they are not rendered to the zbuffer. Regular transparent meshes are sorted from back to front before rendering (based on the center of their bounding sphere), but because in your PG the meshes are instances they are always rendered in their order of creation (so orange first and blue second) whatever the camera position.

As it seems to be a recurring problem, I tried a PR:

If accepted, you will need to set Mesh.INSTANCEDMESH_SORT_TRANSPARENT = true when merged to enable the sorting.


I like it a lot!


Thanks a lot for the fix and sorry for the late reply. I had some problem with upgrading from babylon 4.2.0. I can confirm that fix is working in my project.

Updated PG with the fix: