Personally i had to create different atlas files for each of my 3 resolutions using TexturePacker for my cocos solution. So in summary i have the master json file in my master folder, and a copy of the atlas and png scaled appropriately in each of the SD,HD,HDR folders.
Textures and resolutions
Nice, so the TexturePacker atlas data file is compatible with the Spine runtime?
Sorry for the confusion, msm. Currently the Spine texture packer doesn't pack multiple resolutions. I'd like to add this feature, but haven't got to it yet. You'll need 3 copies of all your images (eg 100%, 50%, 25%) and then run the packer 3 times to get 3 atlases. Use the appropriate atlas and JSON loader scale at runtime. You can use a script (ImageMagick, Photoshop, Java, python, etc) to scale your 100% images down to the other sizes.
An alternative is to use Texture Packer Pro which does have the automatic multi atlas feature, though this is a paid application. Choose the "libgdx" export option for Texture Packer Pro.
I'm also having problems here. I animated in Spine with the hd version of my character. Then exported that. To make the non hd I reduced all images to 50% in photoshop and opened the same spine file. It had all the animations but the images where too small. So I needed to scale those images to 200% inside Spine before export.
I dont think you can just scale the images and be done with it. Your animations would still be made for a higher size images.
Nate :Sorry for the confusion, msm. Currently the Spine texture packer doesn't pack multiple resolutions. I'd like to add this feature, but haven't got to it yet. You'll need 3 copies of all your images (eg 100%, 50%, 25%) and then run the packer 3 times to get 3 atlases. Use the appropriate atlas and JSON loader scale at runtime. You can use a script (ImageMagick, Photoshop, Java, python, etc) to scale your 100% images down to the other sizes.
An alternative is to use Texture Packer Pro which does have the automatic multi atlas feature, though this is a paid application. Choose the "libgdx" export option for Texture Packer Pro.
No worries Nate, thanks for clearing this up for me.
Erebar :I'm also having problems here. I animated in Spine with the hd version of my character. Then exported that. To make the non hd I reduced all images to 50% in photoshop and opened the same spine file. It had all the animations but the images where too small. So I needed to scale those images to 200% inside Spine before export.
I dont think you can just scale the images and be done with it. Your animations would still be made for a higher size images.
Nate can probably correct me, but Erebar, in your case I think this where you want to use the runtime json scale
http://esotericsoftware.com/spine-using ... s/#scaling
msm is correct.
msm :Nate can probably correct me, but Erebar, in your case I think this where you want to use the runtime json scale
http://esotericsoftware.com/spine-using ... s/#scaling
Yes, thanks msm, that will make things easier.
Nate, would you consider always adding the original dimensions of the page used to compute the "xy" and "size" of each region in the atlas? With this, normalized texture coordinates could be computed and the texture dimensions wouldn't matter.
tex_matrix.identity();
tex_matrix.scale(1.0 / page.w, 1.0 / page.h); // region in page pixel units
tex_matrix.translate(region.x, region.y); // from atlas.region.xy
tex_matrix.scale(region.w, region.h); // from atlas.region.size
What would be the purpose of storing the page size? Currently the page image size doesn't change. If you have a smaller atlas, you have a different atlas file and different page images. The images might be packed differently and the pixel size of the regions could be slightly smaller or large depending on how they were scaled.
If I had the dimensions of the image used to compute the regions, I could swap out the atlas image (example.png - 1024x1024) with a low-res version (example-low.png - 256x256) at runtime and use the same atlas (example.atlas) by scaling the "xy" and "size" fields by 256/1024 (normalized texture coordinates) without needing to load example.png to see what the dimensions were.
var atlas_png = atlas.page.name;
if (low_res)
{
atlas_png = basename(atlas_png) + "-low.png"
}
I think you might have off by one pixel issues doing that, depending on how the downscaled images are rasterized. If the packer could create multiple atlas sizes I don't think it is much of an issue to swap both the atlas file and images.
Yeah, that makes sense. For this to work, the higher res images would need larger gaps between the regions. Not exactly ideal. Thanks for hearing me out.