Open boruok opened 3 weeks ago
This happens because TileSetAtlasSource.use_texture_padding
is enabled for both sources, by default.
Thus both sources generate new runtime texture with additional padding around tiles. Turning it off makes both sources use the original atlas (and draw with a single draw call because of no texture changes).
I'd say this is not a bug, but it could possibly be improved by detecting such situations and generating a shared padded texture for different sources. :thinking:
godot 4
separate textures, 16x16 rect, 2 tile-types, same atlas texture = 34 drawcalls
You've drawn 17x17 cells, just saying. And each draw call is per ~half row of tiles, as then there's a texture change.
Tested versions
reproduced
System information
Ubuntu 22.04.4 LTS, GTX1060 6GB, NVIDIA 535.183.01, Compatibility mode
Issue description
noticed that Godot 4
TileMapLayer
tiles aren't batched if tiles not in same texture, even if textures in same atlas. However in Godot 3 tiles are batching (if textures in same atlas)godot 4
separate textures, 16x16 rect, 2 tile-types, same atlas texture = 34 drawcalls same texture, 16x16 rect, 2 tiles, same atlas = 1 drawcall
godot 3
separate textures, 16x16 rect, 2 tile-types, same atlas texture = 2 drawcalls
Steps to reproduce
Minimal reproduction project (MRP)
for_godot3.zip for_godot4.zip