Rendering thin instances with node material: depth order issue

Hey I am using thin instances for the trees with custom nodeMaterial (the material
aand I;m getting very weird result:
The depth is inverted. It looks instances that are futher are rendered after the ones closer the camera.
The depth test is correct terrain vs thin-instances-mesh but the elements of the big intances mesh (as I understand they are one mesh) are rendered weirdly ( a screenie provided).

EDIT: I’m using babylon.js 5.X


Can you share a repro PG?
Is the depth written in the depth buffer? you can check that with

The trees are considered transparent because you plugged something into the FragmentOutput.a input. Just remove the connection to this input, and it should work as expected.

1 Like