Mesh instances with opacityTexture wrong render order

Hi all,

I’ve tried to find solving on internet, I’ve read a lot of topics about it but can’t find solving.
I have a road and a lot of balls along this road, all balls has opacityTexture, because they have transparency. But sometimes the balls which farther rendered before closest balls.
How I can render it all in properly order? All balls it is mesh instances of one mesh.

On the screenshot blue balls should be rendered after red balls, but we can see opposite situation.




Perhaps can help swap some instance to clone (if yo know how instance need correct transparency at this moment) and swap this back to instance, if he leave that zone.
(once it works for me)

1 Like

@adam @Blax
So if I turn all instances to clones it should to work properly?
Or maybe there exist some solving if I use sprites and not instances?

yes (adding this because “post must be at least 5 characters” LOL)


Not all, but only needed instances. Sprite’s or billboard… who knows, perhaps - it depend on task.

Not all instances, but only the transparency necessary for normal display, because the instances are much faster and rendered by the video system, and for clones the transparency works adequately, because these are full-fledged node of Babylon). And to use sprites or billboards - quite to yourself it will probably turn out, judging by the picture. Well, on the playground there is an example with clouds - there shaders are used. There will also be quick and complete transparency control, which one you want. Perhaps this method will do.

1 Like