What gives a better 3D Performance, grid map or blender level import?

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

Hi Everyone,

I’ve been trying out Godot and I’m interested in making a project in 3D, but I have some doubts about the 3D performance delivered and so I would need to know if this is hardware, engine or config related.

Let me explain. A few days ago I’ve tried the TPS Demo (GitHub - godotengine/tps-demo: Godot Third Person Shooter with high quality assets and lighting) but the performance was really poor, around 50Fps when not moving and facing the wall, and around 17-20 FPS when trying to play the game. Then I switched to GLES2 and the performance went up, but not by much, 50 went to 60 and 17-20 went to 20-30 (so still really slow).

Then I tried another demo, the “FPS Grenade Demo” (from here Godot FPS demo has buggy behavior of "Sticky Grenade" in 3.1 beta6 while beta4 works well · Issue #26226 · godotengine/godot · GitHub). The result was better but not by much.

So I’ve decided to try another one, this time a more “technical” one, the “3D GridMap and non GridMap Navmesh Demos” (from here GitHub - Victoralm/AGridMap_Pathfollow: 3D GridMap and non GridMap Navmesh Demos for Godot 3.1), and the result told me a very different story. When I run the GridMap version the performance was always 60Fps, but when I run the Non GridMap I would have sometimes bumps in performance decreasing up to 25 Fps.

Now, I know my hardware is not the best, but it’s still not the worst:

  • MacBook Pro 15’ (2016)
  • 16Gb of Ram (2133Mhz LPDDR3)
  • Radeon Pro 450 2GB

Of course all of the tests were run not only in Run mode directly from the editor (with the map not visible) but also in the compiled form (aftert simple exporting).

This GPU is not the best in the Market, and it’s certainly not made for gaming, but I thought that at least some basic ones it should be able to play, and when we see what demos and full games I can run in this machine that are way more beautiful than the demos presented I start to doubt the origin of the issue.

Now, my question here is not to present flaws, but to ask for help to understand why this happens, and how I can try to solve this (either by opening a tracking issue on git or by optimizing) so I can make my 3D adventure game (think it something at the Crash Bandicoot or Spyro levels) without having to redo every level design at an advanced stage.

Tl;dr: In terms of performance what is better and why?

  • GridMap for everything
  • Designing everything from the Godot Editor
  • Importing the level made with Blender (.dae format)
  • Other?
:bust_in_silhouette: Reply From: Zylann

It depends ™.

If your level is made of a lot of very unique pieces of geometry or fairly not-grid-like patterns, then not only GridMap might deliver poor performance, but it would be impractical for you to design your level.
In this case, a Blender mesh is better, but it should still preferably be sliced modularly to take advantage of frustrum culling. Indeed, if everything is a bigass mesh, the renderer will render everything everytime regardless of where you look.

On the other hand, GridMap is best used in scenarios where you often re-use the same pieces on a grid-like pattern because that’s the workflow GridMap offers you. Also, behind the scenes GridMap can optimize them so that they don’t get drawn individually (which would be tedious for the renderer) but rather in chunks, precisely because those pieces are the same over and over so GPU hardware instancing can be used.

But GridMap isn’t necessarily the only factor in performance.
When you switched from GLES3 to GLES2, some post-processing effects actually got turned off because they are not supported in the latter. For instance, global illumination (GIProbe) is turned off and instead baked lightmaps are used (if present, I dunno how your project got setup). Some expensive effects of WorldEnvironment might also be disabled. So really, materials and post-processing also play a big role.

Finally, Godot 3 in general does not have any fancy culling system beyond frustrum culling. That is, if you look a a wall, what’s behind that wall is STILL rendered. So in the TPS demo, if you look from one corner of the level towards the other end, Godot will attempt to draw the whole map. That demo was thought for high-end so powerful computers might not see the difference. Also, it is known that the current 3D engine isn’t perfect in terms of performance. Some areas have a lot of room for optimization, and it’s been acknowledged by devs. The renderer is being rewritten into Vulkan for 3.2 and more rewrites and features are coming for 4.0, so it’s likely performance will improve in the future.

All this, modulo driver support inconsistencies :stuck_out_tongue:

Hi Zylann, thank you for your great feedback, just some questions:

  • When you say “Blender mesh is better, but it should still preferably be sliced modularly to take advantage of frustrum culling” you mean design the full level on blender and slice it directly on blender or have a .dae file for each part and then assemble it individually on godot without using a grid map?

  • Is it a good idea to mix a grid map and manually placed meshes in godot? For example, I could make all the scenario using a grid (since they are tiles) but everything else (castles, cars, big rocks, mountains) would be mesh that I would place manually.

  • So you’re also telling me that, with Vulkan and a better culling system, the TPS Demo may give better performances on the same machine?

aliasbody | 2019-07-05 09:27

In the case a mesh is better, you can design the full level in Blender but keep in mind frustrum culling is done PER MESH (read again my answer about consequences of that). Depending on your scene that might be OK since objects like a wall, rock, chair table or car are naturally distinct. Huge meshes might also be fine if there isn’t a lot of polygons.
The workflow of designing individual pieces and assembling in Godot can also work depending on your preference.
Note that you unless you use the OBJ format, Godot can import your 3D level as a scene containing multiple meshes, exactly as they were in Blender. Although, it does not mean it will sub-slice meshes magically, it still depends on how you made the scene in Blender (One rock remains one rock).
Note: terrains often raise this kind of problem because they are 1 thing that usually cover the entire level and is very big, which is why chunking it or using a LOD system can be useful to cull the ground behind the camera and polygons too far away.

Mixing GridMap and manually placed meshes is totally fine, again it depends on your workflow preferences.

And yes, Vulkan may give better performance on the same machine, if it has a recent enough graphics card to support it.

Zylann | 2019-07-05 18:05