- 已编辑
Separated atlas for each skin
Hello
I have question about skins and atlases for them. When I am doing a lot of skins with another textures, after export I got several huge atlases with mixed textures from all skins. I would like to have one atlas with textures for each skin.
I got one way to make it using texture packer, but that is complicated as hell and time consuming :V
Did I miss something about exporting ? :/
You can run the texture packer separately from exporting JSON/binary, once for each atlas. You can use the command line to pack multiple atlases from one command, if you have so many it would be tedious using the UI.
I like using Metaphore's GDX Texture Packer GUI: https://github.com/crashinvaders/gdx-texture-packer-gui
You would still have to set up what images/folders to inspect, but once it's set you can generate multiple atlasses at the same time. Drag and drop enabled. Project settings can be saved/loaded.
That GUI looks very nice and the libgdx texture packer is the exact same that Spine uses (I wrote it :$ ). I have never felt that texture packing needs a GUI though, after all, the output is images!
It's funny because Spine is partly a GUI to TexturePacker.
I like GUI's for everything that I do. That's why I wrote Skin Composer. Maybe I should have been a Unity programmer lol.
Sorry, Nate but I dont get it. I cant pack atlas using texture packer and make from it atlases with textures for each skin.
I would like to have atlas 1 only with textures for skin 1, then atlas 2 only with textures for skin 2 etc.
When I export JSON with atlas from my project I got one or two atlases with mixed textures from all skins and thats huge.
When I am trying to use texture packer, as I understanded from your tip, cant choose any atlas to pack or so :V
Raeleus :It's funny because Spine is partly a GUI to TexturePacker.
Yes, it pained me greatly to do that! :p
Wedrownik, did you see the docs?
Texture Packing - Spine User Guide
You can run the texture packer on a folder for each skin which contains only the images for that skin. You only need separate atlases if you want to avoid loading all the atlas images at once at runtime. Otherwise, still create folders for each skin, then run the packer once on the parent folder. This will result in a single atlas where each skin is on a separate atlas page image.
Got it! Thank you for help, now works as I wanted
Could you explain step by step how to export one single atlas for each skin using only the images used in that skin from spine? Thanks
Hey Daniel! here it is:
Step 1: Press Ctrl+E
or in the dropdown menu select Export...
(you can also select Texture Packer)
Step 2: Select Png, Then PRess on the Atlas Setting as in the image below:
Step 3: Create the atlas settings as you wish, then press the Save
button in the corner down left.
Step 4: You will be asked to save a json file. Save the json file inside one of the folder of your skins, call the json file pack.json
It should look like this:
Step 5: In my example, I have two folders:
I'll copy and paste the json in the other folder as well.
Step 6: Now we can run Texture Packer. Let's go to the menu (or press Ctrl+P
)
Step 7: It's important to choose an export folder that is not inside the folder of images that Spine uses. We can then press Pack
And this is the result! Two separate pngs!
Thank you Erikari!!!
Is there a way to custom name the exported skins? Rather than just 2,3,4?
Thanks Nate! Yeah, we'll just edit it manually, was just curious if there was a setting inside before exporting i didn't know about. Thank you for the quick response!
Has anyone encountered this error while using the texture packer code? I have about 16 animals to export each with about 5 skins. I've done quite a few, but all of a sudden each time i export the texture packer (same as i've been doing all day) i get this error. Seems like a glitch in the pack.json file?
it says...
An error occurred while packing the images: dragon
Error: Error packing images: /Users/amy.herrera/Desktop/Dragon-fixed/skins
Error: Error reading images: /Users/amy.herrera/Desktop/Dragon-fixed/skins/red/pack.json
Error: Field not found: project (com.esotericsoftware.spine.editor.packer.SpinePackerSettings)
Serialization trace:
{}.project
Can you post your pack.json
file? It seems to have a project
field in it, but there is no such field for the texture packer settings. There is a field called currentProject
though. Maybe it was renamed at some point.
Hey Nate - sorry for the kinda change in topic - still skin texture related though. I have set up my animals now with skins and followed the step by step above to create one skeleton, one atlas, and various skin pngs for each color. My devs are now asking if there is a way i can get export a separate atlas, skeleton and skin png for each skin in the file? Is that possible with skins set up?
@aimajin You can run the texture packer to create as many atlases as you like:
Texture Packing - Spine User Guide
If you have many, you can run the texture packer from the CLI or script:
Export - Spine User Guide: Command line
Note though that if you plan to load all the atlases at the same time then you may as well just pack them all into the same atlas.
Awesome, thanks for this info. Let me pass it on!
When i run texture packer, it gives me the separate pngs for each skin, but still only one atlas - is there a setting i'm missing?
Here are my settings.
Each time you run the texture packer it creates one atlas. You'd need to run it multiple times to create multiple atlases. Again though, note that if you are loading all the atlas images at the same time, you don't need multiple atlases.