How does AtlasTexture resource works?

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

I know what Spritesheets are and why they are used.

I wanted to ask more specific question, on how AtlasTexture resource works in Godot and what it’s doing behind the scenes.
From the docs description of AtlasTexture we can read:

“Packs multiple small textures in a single, bigger one. Helps to optimize video memory costs and render calls.”

But I don’t think it’s what this resource does, since I dont see any API that could really create an actual atlas (pack small images into one bigger one). Unless its done on project export time? But even if, then still I don’t see any way to define which png files should be packed into one common spritesheet…

But there is also second option: all the above (and docs) are wrong and AtlasTexture is not packing anything at all. In such case user needs to prepare his own atlas (in graphic program), and put the atlas as png project in file. Then AtlasTexture could be used to define concrete region of that spritesheet. But if this scenario is true, then I don’t understand why not just use regular texture with texture region. Maybe there is performance reason? → Maybe all the sprites that are using distinct AtlasTexture resources will be batched during the rendering in the way that if possible only one draw call will be used?

Would be cool if someone could clarify things for me, thanks!

Other somewhat related question: https://forum.godotengine.org/24726/texture-atlas-creation?show=24726#q24726

kubecz3k | 2018-06-02 14:36

Some light on what happened with automatic atlas creation ‘on export’ time in 3.0: Re-add atlas packing option · Issue #13940 · godotengine/godot · GitHub

kubecz3k | 2018-06-02 14:40