2d, draw calls, batching, optimization

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

I’m using Godot 3.1 alpha 2 (tried 3.0 stable as well).
Actually I have several issues:

  1. Draw calls counter in the Monitors sections seems to be completely broken. It shows 0 on all occassions.
  2. I put all my sprites into a spritesheet and use them wisely (I only use .tres files for my sprites). Theoretically the engine MUST optimize the draw calls count (this is the whole point of packing). However, seems it doesn’t. 2500 of packed sprites on the screen easily put CPU to 100%. This sucks. I can’t prove the point though (see p. 1).

OK, switching to OpenGL ES2 renderer improves performance significantly.
Batching not implemented in ES3 renderer?

hedin_hiervard | 2018-12-25 23:42

2500 of packed sprites on the screen easily put CPU to 100%

Are you sure this isn’t just the node cost, if you are using .tres files, you probably use a node for every sprite.
In Godot, even a empty node has a high overhead.

To test this, just make a new scene and place 2500 of the icon image provided with Godot. If you still get low performance with the icons it is the nodes.

However, if the single icon rendered 2500 times, runs smoothly then you know it is the draw calls; because rendering the same sprite should have very few draw calls.

MysteryGM | 2018-12-26 01:00

Ok, it could be node cost. How can I optimize this? As I said I use the packed spritesheet. What if I need to render a huge grid from it (say, 50x50) to fully utilize the sprite atlas batching? I cannot use TileMap because of its limitations (each node has it’s all custom sub-elements, tweaks etc).

hedin_hiervard | 2018-12-26 09:26