• Editor
  • Manually organize atlas file?

Hi, is there any native or 3rd party way to organize the atlas file (Specifically setting the part coords/bounds)?

I have a complex character with possibly hundreds of exchangeable parts. We originally used many atlases that could be swapped out, which led to 20+ draw calls per character.

I have just found I can use clever shader design to have 1 "atlas", but swap out textures/parts within the shader to keep the skeleton at 1 draw call! However, having a well organized atlas (parts grouped in the same sections) would be very important for this.

Is there any way to achieve manual atlasing? For example, all heads are on the left column, body is in the middle column, then legs, then hands, etc.

Related Discussions
...

Yes, you can manually organize your atlas file by using the Spine Texture Packer and its folder structure feature. By placing your images into specific subfolders, you can control how they are packed into the atlas. Each subfolder can be packed into a specific section of the atlas, allowing you to group parts like heads, bodies, legs, and hands in designated areas.

Here are the steps to achieve this:

  1. Organize Images into Folders: Place your images into subfolders based on how you want them grouped in the atlas. For example:

       images/heads
       images/bodies
       images/legs
       images/hands
  2. Use the Spine Texture Packer: Run the Spine Texture Packer and select the root folder containing your organized subfolders. This will pack the images into the atlas while maintaining the folder structure.

  3. Packing via Command Line: You can automate this process using the command line interface (CLI) to pack the images. This is useful if you have a large number of images or need to repeat the process frequently. You can find more information on using the CLI in the Spine User Guide.

  4. Customizing the Atlas: If you need more precise control over the placement of images within the atlas, you might need to use a custom script or tool to manually set the coordinates and bounds of each part. This can be done by modifying the atlas file directly or using a third-party tool that supports such customization.

By organizing your images into folders and using the Spine Texture Packer, you can achieve a well-organized atlas that groups parts in specific sections, which can then be utilized effectively within your shader design to maintain a single draw call.

Are there any 3rd party tools available that support such customization?

Edit: I guess spinebot only responds to the first Post.
Also Question #2. Is there a place somewhere on the website we can just chat with Spinebot? It seems to have all the answers. Or would you prefer everything be documented in forums?

Yep, Spinebot only responds to the first post so it doesn't fill the forum with its ramblings. Sometimes its responses aren't great so we delete them, though lately it's been quite good. It's mostly to 1) get you an answer quickly, and 2) answer simple questions to save us effort. We considered allowing general chat with Spinebot, but it's hard to prevent abuse. It costs us a small amount of money for each response it generates.

Spinebot gets its answers from the forum and documentation on our website, plus the general ChatGPT knowledge. You can get pretty good answers by talking to ChatGPT, especially the latest (currently ChatGPT 4o), which has a small monthly cost.

I don't know of 3rd party tools to pack textures manually. You could use Photoshop, but it's tedious. The general idea is to have the computer find good packing. Bin packing is NP-hard, best to let computers do it!

You could pack the heads/etc together, then pack the resulting atlas images together into a larger atlas. However I'm not sure this is a great solution. How exactly does your draw call reduction work? I'm skeptical. If you have to upload texture data to "swap" parts, that has a significant cost and you'd be better off with draw calls.

The easiest thing is to pack everything into one large texture, probably 4096x4096. If you are using atlas pages smaller than that, consider bumping to 4096x4096. That is usually 64MiB of VRAM and can hold a whole lot of images. Also make sure you are packing polygons, and use meshes when needed to reduce the pixel area your images take up.

The next easiest thing is to organize your images to reduce draw calls from needing images in an interleaved fashion. Eg to draw the face if the head is on the 1st atlas page, the eye on the 2nd, the other eye on the 1st, etc you will have many draw calls. If you group the images eg so all the head pieces are on one page and all the body pieces are on another, you can draw it all in 2 draw calls. On desktop some 50-100 draw calls is unlikely to be an issue. On mobile it may be less, but it can certainly be more than 1 without performance issues. With a careful pack ordering, you can get very far with a multi page atlas.

A slightly less easy option is to ship individual image files with your app, determine which images are needed for a level, given what a character has equipped, etc then pack at runtime only those images into a single atlas page. This option is often used when the number of images is astronomical or unbounded and it's not feasible to do the easier options above. What runtime are you using? spine-unity provides utilities for this runtime packing.

There are other options that work at a lower level and likely depend on the game toolkit you are using. With OpenGL you can use texture arrays to draw from multiple textures in a single draw call. For example, here is an implementation for libgdx. You can see me commenting there about how it affected Spine rendering. That is a GL20 version, there is also this GL30 version, though I'm not sure what advantages the higher OpenGL version requirement gives.