- Edited
Multiple atlas sizes with different attachment sets
Hello there.
I have a worflow related question, if this is not the appropriate category please apologize.
Here's my use case: We're doing a game that requires extensive character customization, involving both clothes and facial features. We currently build the assets and export them from spine at a resolution of 0.4, this makes it look clear in the game due to how the character model shows up on the screen.
When we added the option to change the facial features of the character we also added a scene that puts a zoom in the character's face, and the resolution of 0.4 looks blurry and awful, after some testing we decided that 0.7 looks sharp enough in that scene.
Now here's the issue, we need a 0.4 model and a 0.7 model in the game, however, the 0.7 model does NOT need all the pieces available in the 0.4 model, since it is only used in one specific scene (it only needs one basic set of clothes instead of all the cloth items in the game), we could export the 0.4 model, then remove all "useless" attachments and export the 0.7 model, but that does not seem to be a good workflow as this seems error prone and tiresome. Is there a better way to achieve the desired results?
tl;dr: Is there a way to export a model with all attachments in a size, and a model with stripped down attachments in another size, that doesn't involve removing the attachments manually every time we need to update the models?
Isn't this a runtime question? what game toolkit are you using?
Skeleton data is separate from the images used. If you want to show your skeleton larger, you can scale the skeleton data at runtime when you load it, see SkeletonJson scale
. This way you can use the same skeleton data with different sized images/atlas.
However, if you don't actually want to show your skeleton larger, you just want to use higher resolution textures so an animation which scales up the skeleton doesn't look bad, then you don't need to use SkeletonJson scale
just load the same skeleton with the larger atlas. The skeleton will render at the same size, but the images it uses will be higher resolution so they won't look bad zoomed in.
You can write your own AttachmentLoader which doesn't fail if a region cannot be found in the atlas. This way you can have a higher resolution atlas which only has the assets needed for the one scene. The unnecessary attachments will still be loaded, just not configured with an atlas region, which is unlikely to be a problem.
An AttachmentLoader can return null for an attachment, avoiding creating the attachment completely, but I think this may cause some types of animation timelines to fail to load. Eg, a DeformTimeline expects to be able to find its mesh attachment.
@Nate, playing with both atlases in the runtime (Unity, in this case) isn't the issue, though.
The thing is, I don't need all attachments from the skeleton to be available in the hi-res version. Here's why: The first time the player meets the character he can customize the facial attributes, this is the scene where we need a hi-res version. In that scene the character has a default set of clothes, so all we need in this atlas would be all the facial variations (noses, lips, hairs, eyes, etc) and the 3 pieces of clothing the character has on that scene. Having all pieces of clothing in this hi-res atlas increases the size by a lot and is totally not necessary.
That's why I added this question to the editor sub-forum, because I want a way to export the hi-res atlas with only a subset of all the attachments, without having to manually remove all attachments from the model prior to exporting.
I still think my post above addresses your issue: Use the same skeleton data. Use a low resolution atlas with all the images. Use a high resolution atlas with a subset of images.
You don't need to remove attachments or adjust your Spine project at all in order to pack an atlas with a subset of images. Just put your higher resolution images in the a folder and run the texture packer on them.
Texture Packing - Spine User Guide: Using the Spine Texture Packer separately
Creating an atlas when you export skeleton data is just a convenience.
Which subforum isn't too important, we'll see the posts either way. This is kind of an editor thread (about running the texture packer), and kind of a runtime thread (about using the same skeleton data with different atlases), so we might as well just leave it in the runtime subforum.
Ah, I see. So I can create an atlas with just the needed pieces out from the usual export pipeline. That helps a lot, thanks!