PayasoPrince

Hello All,

I wanted to inquire about exporting different resolutions from Spine.

To briefly go over my workflow:
I have the original Vector art created in Illustrator. >
I then export different resolutions as .PNG files directly from the original vector art. That way, the original vector art is only rasterized once. >
I then create a .PSD file from the .PNG and import the .PSD into Spine to work with.

So, my question is, if I import a 1024 x 1024 character .PSD file into Spine, and then export it, can I then import my 512 x 512 .PSD and export it?

I understand that Spine has the option to export at 50%, but I do not want to scale my already rasterized 1024 x 1024 image.

Thanks for taking the time to read this! :)
User avatar
PayasoPrince
  • Posts: 38

Nate

I assume by export you are talking about packing a texture atlas? You don't need to bring images into Spine to pack them. You can run the texture packer on any folder of images.
User avatar
Nate

Nate
  • Posts: 12213

PayasoPrince

Nate wrote:I assume by export you are talking about packing a texture atlas? You don't need to bring images into Spine to pack them. You can run the texture packer on any folder of images.
Hey, thanks for the response, Nate!
Oh, that seems really simple and great. Though, I should clarify to make sure I understand.

I'm actually working with an animator, they're the one who uses Spine.
So, all I need to do is provide my animator with folders of my characters body parts at different resolutions?
Then, it's as simple as them running this texture packer tool on each folder? :think:

Thanks again!
User avatar
PayasoPrince
  • Posts: 38

Misaki

Yes, texture packer can pack a texture atlas page per folder. Please see the user guide for more information:
Texture packing - Spine User Guide: Running the texture packer separately
Texture packing - Spine User Guide: Folder structure
User avatar
Misaki

Misaki
  • Posts: 1164

Nate

Yep! I'm not sure I'd trust an animator though. ;) Exports (both data and texture packing) can be automated with a shell script using the CLI. That can be part of a build process so you can never forget a step.
User avatar
Nate

Nate
  • Posts: 12213

PayasoPrince

Hi!

I am just following up on this. My animator used the texture packer on my folders containing different resolutions, and the body parts are in different locations...Is this an issue? I imagine it would break the animation :think:

Here is an example:
User avatar
PayasoPrince
  • Posts: 38

Nate

Why would it break the animations? The atlas is a mapping of region name to the location on the atlas image(s). The atlases don't have to have the images in the same locations.

---

From this other thread:
export same atlas with 4 resolutions ?!!

It appears the idea is you want to swap atlases on the fly for camera LOD? The usual way of doing that is to generate mipmaps. I would suggest doing that rather than packing multiple atlases.
User avatar
Nate

Nate
  • Posts: 12213

ahmed ali

hey guys animator in the unity area here :hi:

a solution from a friend:

export 1024 and make copy of atlas in unity and resize to smaller version

I work in 3d this and mipmapping support this
ahmed ali
  • Posts: 38

PayasoPrince

Nate wrote:Why would it break the animations? The atlas is a mapping of region name to the location on the atlas image(s). The atlases don't have to have the images in the same locations.

---

From this other thread:
export same atlas with 4 resolutions ?!!

It appears the idea is you want to swap atlases on the fly for camera LOD? The usual way of doing that is to generate mipmaps. I would suggest doing that rather than packing multiple atlases.
Hey Nate!

I will clarify everything for you as simple as possible.

- I want to use my own mipmaps manually.
- The source artwork I use is high quality vector art.
- I export the vector art directly from the illustration software as a PNG and it is only rasterized once.
- Once an image is rasterized, if you scale it again, the quality will not be perfect.
- So when I export a 512 x 512 PNG directly from the illustration software, it is only rasterized once.
- Therefore, the 512 x 512 PNG I exported myself is a higher quality than Spine resizing my 1024 x 1024 image at .5 scale.

Let me know if that is not clear enough for you.

So, all I want are 4 different atlas resolutions that I can use for the same character.
That way I can use them as my own Mipmaps manually.
User avatar
PayasoPrince
  • Posts: 38

ahmed ali

PayasoPrince wrote:
Nate wrote:Why would it break the animations? The atlas is a mapping of region name to the location on the atlas image(s). The atlases don't have to have the images in the same locations.

---

From this other thread:
export same atlas with 4 resolutions ?!!

It appears the idea is you want to swap atlases on the fly for camera LOD? The usual way of doing that is to generate mipmaps. I would suggest doing that rather than packing multiple atlases.
Hey Nate!

I will clarify everything for you as simple as possible.

- I want to use my own mipmaps manually.
- The source artwork I use is high quality vector art.
- I export the vector art directly from the illustration software as a PNG and it is only rasterized once.
- Once an image is rasterized, if you scale it again, the quality will not be perfect.
- So when I export a 512 x 512 PNG directly from the illustration software, it is only rasterized once.
- Therefore, the 512 x 512 PNG I exported myself is a higher quality than Spine resizing my 1024 x 1024 image at .5 scale.

Let me know if that is not clear enough for you.

So, all I want are 4 different atlas resolutions that I can use for the same character.
That way I can use them as my own Mipmaps manually.
that can be easily done from each psd you provided, but the thing is that atlases won't be exact identical, if that's not an issue with let me know :think:
ahmed ali
  • Posts: 38

Nate

Thanks for the clarification.

I don't think you can rely on Spine's texture packer (or any texture packer) to pack scaled down images the exact same way. When scaled down (or rasterized to a smaller size) the pixels are different and the images are unlikely to pack into the same positions on the atlas page that the larger images did.

You can easily pack 4 atlases, but the regions won't be in the same places, so you can't just swap textures. You could reconfigure your attachments to use a different atlas based on LOD, though this feels a bit heavy handed.

I suppose you could pack the 1024 sized atlas, then write a software tool that creates mipmap images by blitting your downscaled images into the same positions on the smaller image. We don't provide such a solution though, sorry!
User avatar
Nate

Nate
  • Posts: 12213

PayasoPrince

Nate wrote:Thanks for the clarification.

I don't think you can rely on Spine's texture packer (or any texture packer) to pack scaled down images the exact same way. When scaled down (or rasterized to a smaller size) the pixels are different and the images are unlikely to pack into the same positions on the atlas page that the larger images did.

You can easily pack 4 atlases, but the regions won't be in the same places, so you can't just swap textures. You could reconfigure your attachments to use a different atlas based on LOD, though this feels a bit heavy handed.

I suppose you could pack the 1024 sized atlas, then write a software tool that creates mipmap images by blitting your downscaled images into the same positions on the smaller image. We don't provide such a solution though, sorry!
Thanks for getting back to me on the weekend, dude. I really appreciate it. :)

I know what I'm looking to accomplish is more meticulous than what most clients will do . :grinfake
But, being able to assign your own downscaled resolutions rather than having Spine doing it automatically is something I'd really love to see added.

I can avoid doing it this way for the time being, but is there any chance something like this can be added later down the line? :think:
User avatar
PayasoPrince
  • Posts: 38

Nate

Maybe, though we've not had a request for this before.

FWIW, in the past I worked on a game with our Spine colleague, Mario, where we rasterized SVG and packed it into an atlas at runtime. This was neat because it rasterized at a resolution reasonable for the user's screen size, and also SVG files are much smaller than images. However, the difference on a small mobile device screen is relatively small and the complexity of rendering SVG is very high.

In most projects, I bundle multiple atlases (automatically scaled down) with the game, then choose the most appropriate size based on the user's screen size. That works best for UI and most 2D games. If you really need LOD, using mipmaps is easy and the quality is good, even if not as good as rasterizing at a smaller size. Finishing a project is usually more important than a tiny quality improvement. ;) If you really want to rasterize your own mipmaps, writing a tool to assemble them shouldn't take long. I would use libgdx to do it.
User avatar
Nate

Nate
  • Posts: 12213

PayasoPrince

Nate wrote:Maybe, though we've not had a request for this before.

FWIW, in the past I worked on a game with our Spine colleague, Mario, where we rasterized SVG and packed it into an atlas at runtime.
Are you saying there is some sort of SVG Support in Spine? :think:
If there isn't, that could also solve this pretty easily. Animators could just work with the imported vector graphics and then it could only be rasterized once when exporting at different scales.
Nate wrote:If you really need LOD, using mipmaps is easy and the quality is good, even if not as good as rasterizing at a smaller size. Finishing a project is usually more important than a tiny quality improvement. ;)
This is definitely a case by case situation. You might not notice much of a difference in some situations, but when you use 1024x1024 textures for extreme closeups, and 256x256 in the overworld, the difference is more noticeable. It's even worse if you use Unity's auto-generated Mipmaps. With all due respect, its completely subjective and not really your place to tell me how important the quality improvement is :upsidedown:.

At any rate, I appreciate you at least letting me know it's not possible and I really hope it's something that you all can incorporate at some point. :)
User avatar
PayasoPrince
  • Posts: 38

Nate

Right, note the "in most projects", winking emoji, and the answer given if the uncommon solution is needed.
User avatar
Nate

Nate
  • Posts: 12213


Return to Unity