Creating multimeshes with huge instance count during runtime

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

Hello,

I am currently discovering Godot, developing a voxel engine, and I’m facing an issue creating multi-meshes during runtime. My engine is coded in a C++ native module.

I’m storing voxels in chunks but with a bigger cube count that classic engines ( i want to draw smalls colored cubes instead of one bigger textured cube ). So my chunks are 256 cubes wide, drawn with a multiMesh each.

The problem I have is that when I move in the rendering world, display is lagging when a new chunk is generating, because the multimesh instructions ( set_instance_transform, set_visible_instance_count, set_instance_count … ), are processed in the visual server, even if i run each chunk generation in a thread.

So the question is how can I effectively create multimeshes during runtime for a huge amount of instances ? ( maybe I am not doing it the right way )