• Unity
  • Organizion to reduce Material-swaps with multiple .pngs ?

Hey Harald and everyone :grinteeth:

I'm working on a new character that is MASSIVE. His images span 3 .png files.

Right now in Unity, there are 30+ Material-swaps to render the character. I'm trying to figure out how to go about organizing my atlas images to reduce this number - realistically it should only require each Material being used once, if I am able to group the images in a "back to front" way.

I searched the forum but couldn't find anything specifically talking about this (but if this has been discussed already please just shoot me a link to it).

What I'm imagining I would have to do is somehow use 3 completely separate Atlases (AKA 3 Atlases each with their own .png), and I would manually pack their images based on the back-to-front layering. Is it possible to use multiple Atlases like that? I see that on the SkeletonData.asset file the location for the Atlases is a list, so I could technically add more Atlases to that list?

So my thoughts were that I could organize my attachment-images into 3 folders, and then pack each of those separately, but I don't see how that would work since the Spine project itself is expecting the path to the images to all start with the main folder "images/", but with my 3 separately-packed Atlases, the path would start with the 3 SUBFOLDERS of that "images/" folder.

Has anyone done this before, and am I on the right track or maybe is there another way to do it?

Thanks for any help!

Related Discussions
...

There is an atlas per subfolder feature in Spine Texture packing - Spine User Guide: Folder structure may help if you went that route.

Another thought is that your characters textures a larger than the resolution it will be displayed on, you might consider reducing your texture export scale setting which will scale all images before packing by the amount specified. This may also reduce the amount of pages you need (ideally all fitting in one atlas.)

Thanks @jhofer21 for answering!

@Jamez0r please note that you can also pack by folder structure from the Spine Export menu during data export, in case you didn't know that already:
Texture packing - Spine User Guide: Packing during data export

Jamez0r a écrit

[..] but I don't see how that would work since the Spine project itself is expecting the path to the images to all start with the main folder "images/", but with my 3 separately-packed Atlases, the path would start with the 3 SUBFOLDERS of that "images/" folder.

One solution to end up with the desired folder/imagename paths would be to use a batch script to first copy your images to a pre-setup folder and then pack the atlas via the command line, hierarchy as described here:
Mix and match outfits + Addressables loading issue

Thanks a lot for the info/suggestions guys! Yeah looks like I can use a main pack.json file with CombineSubdirectories = true, and then in each of my individual subfolders (which I manually place the images I want into) I can add a pack.json with CombineSubdirectories = false.

Looking good :yes:

Glad to hear, thanks for sharing! 🙂