#Gridmap does not optimize the mesh rendering

1 messages · Page 1 of 1 (latest)

magic idol
#

Hi, I have a Godot 4.3 project where I try to generate 3D voxel grid world using Gridmap 3D. The map is generated proceduraly in init of the Gridmap using GDScript. But I noticed terrible performance on large maps (gpu usage), I tried to look at the debug modes and realized that no culling or face merging occures and there is lot of overdraw. I expected some basic optimization from Gridmap from what I read. I tried changing the octan size but it changed nothing. I am using grid mesh library that I created from gridmap 3D set I found online (I can add it to the info if relevant). I attach debug views with wireframes. I am using Forward+

Project files: https://drive.google.com/file/d/1hMQurO4Hl9MPx3-r0g_zSQxfTwsqnNGe/view?usp=sharing

I think it is probably some basic mistake, but I have not found anything online. Thank you for reading and hopefully replying

#

I forgot to send the setup of my 3D scene

sterile minnow
#

If it tried to do anything like face merging or culling, it would actually be giving up on some of what makes it reasonably fast already.

left ginkgo
magic idol
magic idol
sterile minnow
# magic idol Thank yuou sounds interesting. From the documentation I was not really sure what...

Are you already familiar with MultiMeshInstance3D? It's a way to draw the same mesh many times with only one draw call, rather than one draw call for each instance of the mesh. (In godot, simple MeshInstance3Ds also have some automatic instancing too, but using a MultiMeshInstance3D guarantees instancing and I think is a bit faster than the automatic instancing of simple MeshInstances)

#

GridMap will automatically create several MultiMeshInstances, one for each unique mesh in an octant. So you pay the rendering cost of the number of unique meshes, not instances, per octant in your gridmap

#

Think of it as something optimized for rendering a lot of medium-complexity meshes at once. It doesn't have any built-in face merging because face merging is a voxel-specific optimization that doesnt make sense to do in the general case, and if it was added then GridMap would not be able to use MultiMeshes. It doesn't have any culling because MultiMesh doesn't do culling.

#

I think if you want to see the current level of optimization of GridMap, you should compare it to either:

  • the same number of MeshInstance3Ds, (this will be very slow, due to Node overhead)
  • the same number of mesh instances, created directly on the RenderingServer. There is a basic snippet for setting that up in the proposal issue I linked. I haven't benchmarked this personally, but manually setting up individual mesh instances is likely slower than using multimeshes / gridmaps
#

I hope that some of that is helpful for understanding what gridmap is good for. All that said using the voxel plugin is the right call here