Multimesh weird behavior GLES3

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MEDBVLL

I have the following scene:

enter image description here

With the following script attached to the Multimesh instance:

public class GridController : MultiMeshInstance
    {
        public override void _Ready()
        {
            int width = World.GetInstance().Width;
            int depth = World.GetInstance().Depth;
            Multimesh.InstanceCount = width * depth;
            GD.Print($"{Multimesh.InstanceCount}, {width} {depth}");
            for (int x = 0; x < width; x++)
            {
                for (int z = 0; z < depth; z++)
                {
                    Multimesh.SetInstanceTransform((z * depth) + x, new Transform(Basis.Identity, new Vector3(x * 2, 0, z * 2)));
                }
            }
        }
    }

When i load into the scene, I get different behaviors randomly.
This is the correct behavior:

enter image description here

This isn’t:

enter image description here

Or this:

enter image description here

With a plethora of other possibilities, sometimes nothing shows on screen, sometimes some of the meshes appear, and some others are glitched.

I have tried: updating drivers; updating godot to 3.5.1;
none of them worked

I have no idea why this could be happening, what should I look for?
Any help is much appreciated.

update: not only occurs in GLES3 but also GLES2
also when having more meshes the problem is less frequent; depending on the mesh complexity it does vary in results (the more tris the mesh has, the less frequent the problem is)

MEDBVLL | 2022-10-05 19:38

I had this issue with my hex grid, I had to slow instances creation by adding delay between some steps. My setup was different, so just few yields fixed this, but You may have to try yield for micro time inbetween every instance iterated

Inces | 2022-10-05 20:06