Mesh instances disappear when source mesh is culled under specific circumstances

Hello!
I’ve been using mesh instances in my game to make a repeating background, and wanted to use a depth renderer for some of my shaders. However, as soon as I enable the depth renderer, some mesh instances disappear if the source mesh is offscreen.
I was able to reproduce the bug in the playground. It seems to happen only when the source mesh has vertex colors, the meshes are using a custom ShaderMaterial, a depth renderer is enabled, and the instances have negative scale.
Does anyone know why this is happening?

Thanks for the repro, here’s the fix:

3 Likes

You are the king @Evgeni_Popov

1 Like