• Editor
  • Export animation to PNG and ensure packing in single atlas

Hi everyone,

I just bought Spine Essential and as a first exercise I'm trying to export an animation into a single atlas to import it in a game engine. The problem I'm having is that I can't seem to make sure that the size of each sprite is as big as possible while also making sure that there are not multiple atlasses for this one animation.

I believe I tried every 'pack setting' available to me and I messed with the size -> scale and size -> fit under 'export PNG' settings. Unlike for JSON export, there is no 'Single atlas' button, so either I end up with multiple atlasses or this one animation, or the sprites on the atlas are not making use of all the available space on the atlas.

Any help is welcome!
Thank you for your time.

    Related Discussions
    ...

    Thrindil Welcome to Spine!

    You may be confusing the texture packer settings with the PNG export settings. The texture atlas that are exported for the game engine are configured in the Texture Packer Settings. It can be opened by pressing the Pack Settings button on the JSON or Binary export. Please refer to the following page of the Spine User Guide for more information:
    http://esotericsoftware.com/spine-texture-packer#Packing

    In the Texture Packer Settings window, you can change the Max width/height and Scale so that the images for your skeleton can be packed into a single texture atlas page.

    The "single atlas" for data export means one atlas for multiple skeletons. The atlas may still have multiple pages if the images don't fit on one page. Each PNG that goes with the atlas data file is a "page".

    There is no setting for reducing the scale until the images can be packed into a single atlas page. Most games would not want their export quality sacrificed like that. You'd need to pack multiple times, reducing the scale each time, until you find the largest scale that packs into a single page.

    If you are packing a PNG export, the atlas having multiple pages usually makes little difference compared to fitting it in a single page. Mainly it takes up more memory but there isn't an issue with draw calls that rendering skeleton data can have when there are multiple pages.

    Thank you both for the quick reply!

    I'm a bit sad to read that there is no setting to make sure the packing algorithm maximizes the available space while keeping everything in one texture atlas for animations. It looks like that option is available for JSON export but not for PNG export, but JSON automatically exports the skeleton while I need the animation to be exported.

    If I'm reading this correctly the best way to achieve what I want is by trial and error, exporting every time with a new scale until I am happy with the end result? Production speed is essential for me, and this would be a bottleneck I believe.

      Happy to report that I figured it out!
      Key settings were size: fit with padding on and for the texture packer 'strip whitespace' turned off. The default settings were not optimized for my use case, but I'm glad I can save these export settings and load them up whenever I need them. I'm including my settings for anyone this might be helpful to in the future. Thanks again for the help!


      Thrindil If I'm reading this correctly the best way to achieve what I want is by trial and error, exporting every time with a new scale until I am happy with the end result? Production speed is essential for me, and this would be a bottleneck I believe.

      You could utilize the Spine Command Line Interface (CLI) to automate your exports. Then you could use a bash script to export with decreasing scale settings and exit when there is only one atlas page generated.

      It is anyway recommended to automate your exports for the sake of being able to re-export all your skeletons in one go in case you ever decide to upgrade the Spine version from e.g. 4.1 to 4.2.

        Thrindil It looks like that option is available for JSON export but not for PNG export

        Actually there is no such option for either export. Reducing the scale affects image quality, so it's not typically a setting you want adjusted automatically. Probably your images fit in the data export atlas because you are packing only your skeleton images. When doing PNG export, you are exporting many full frame images, so the images are much larger and less likely to fit on a single atlas page.

        I'm glad you got it to pack like you want!