Texture Atlas creation

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

Hello. I’m new to Godot, and have question about texture atlases for merging sprites. In other engine, that I use, I generate atlases via texture packer (cocos2d-x, libGDX, PixiJS), in Unity using packing tag for it, but in Godot I have no idea how to merge sprites to one atlas. I know that earlier sprites can be grouped, but in 3 version I can’t do that. How to merge sprites to one atlas (is it any tutorial exist, I google a lot but find nothing)? Can I merge bitmap fonts and UI elements to one atlas (cause UI with a lot of text-fields generate more draw-calls than game)?

:bust_in_silhouette: Reply From: svero

I don’t know the details of what’s going on under the hood, but this explains the basic built in process…

I’ve played around with it a little, and it seems that if you modify the original png that things were reimported from then it gets reimported and the atlas also updates. It’s a little unclear what happens on export. I have to assume it just exports the atlas and not both the images and atlas file.

I also use texturepacker though. I just export from texturepacker to XML format and wrote my own XML reader and custom draw the textures using my own XMLSprite class which is similar to the built in animated sprite, but uses xml file inputs to initialize and draw. This doesn’t allow me to see what’s going on in the editor though, just from code, so it depends a bit on your needs. I believe it would be possible to make my class gui friendly but I haven’t tried.

Lastly Texturepacker has a plugin you can use if you export from texturepacker in their godot format. I have tried this but didn’t like the workflow, which is why I wrote my xml class, but it can work that way as well.