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 =)

I have a similar issue but with two normal meshes. I’m not using instances. One mesh is a house’s wall and the other mesh is 80 individual studs of the wall’s interior. Their geometries don’t intersect or overlap, the studs are fully inside the bounds of the wall. But when their materials are set at 0.7 transparency there are certain camera positions where it insists on rendering the studs on top of the walls, despite the walls always being closer to the camera.

Is there a solution to this?

I’m using MATERIAL_ALPHABLEND but I’m seeing that perhaps this is just a limitation. If there are only 4 groups, and the center point of the entire mesh is what is used to layer them, then I guess this is just how it it. Might try out PBR.

These might help you.I’m using OIT, but it’s too expensive.

1 Like