NodeMaterial incorrect renderingorder of transparent meshes

Hello! Hope you are doing great!

It might be that I’ve overlooked something, but I simply cannot get the rendering order of transparent meshes to work with NodeMaterials.

PG:

The “Sun” is a lot further behind the close objects in this screenshot

Hope you can help!

cc @Evgeni_Popov @sebavan

@Evgeni_Popov looks like INSTANCEDMESH_SORT_TRANSPARENT might have an issue ???

INSTANCEDMESH_SORT_TRANSPARENT is only local to the mesh: it correctly sorts the instances of a given mesh (the sorting is done when the source mesh is drawn), but it cannot sort instances between several meshes.

So, if mesh A has 10 instances and mesh B 5 instances, the 10 instances of A will be correctly sorted, as will the 5 instances of B. But if some instances of A are further apart than some instances of B, and others are closer, then you’ll get rendering artifacts.

In the case of the PG, we can set the alphaIndex to 0 for the sun so that it is rendered before the spheres:

3 Likes

Thanks for the explanation! That makes sense.

Currently, I’m creating a bigger scene where I will have multiple meshes, each with numerous instances. What would be the best approach to sort the rendering order dynamically where all of them needs to support transparency?

If you really need all instances from all meshes to be correctly sorted, then you won’t be able to use instances at all… You will need to use regular meshes.

2 Likes

Good to know, thanks for the explanations!

Wish you all a great day =)