joeplayer

Thanks for any help :tear:
joeplayer
  • Сообщения: 13

Harald

Could you please describe in more detail what you want to achieve, what your current setup is and where you are encountering problems?
Аватара пользователя
Harald

Harri
  • Сообщения: 4088

joeplayer

Harald писал(а):Could you please describe in more detail what you want to achieve, what your current setup is and where you are encountering problems?
Combining Skins try as code:
repackedSkin.Clear();
repackedSkin.AddAttachments(customSkin);
repackedSkin = repackedSkin.GetRepackedSkin("repackedSkin", sourceMaterial, out runtimeMaterial, out runtimeAtlas);
skeleton.SetSkin(repackedSkin);
skeleton.SetToSetupPose();
skeletonGraphic.Update(0);
skeletonGraphic.OverrideTexture = runtimeAtlas;

A skeleton have a independent texture that cause a drawcall. So many Combining Skins make that performance degradation.
.
joeplayer
  • Сообщения: 13

Harald

Do you mean that you are facing problems that the GetRepackedSkin calls are expensive? Or do you mean that you still have too many batches when each of your skeletons has a repacked single atlas texture?
Аватара пользователя
Harald

Harri
  • Сообщения: 4088

joeplayer

Harald писал(а):Do you mean that you are facing problems that the GetRepackedSkin calls are expensive? Or do you mean that you still have too many batches when each of your skeletons has a repacked single atlas texture?
i mean secend point: too many drawcalls when each of your skeletons has a repacked single atlas texture

---

Harald писал(а):Do you mean that you are facing problems that the GetRepackedSkin calls are expensive? Or do you mean that you still have too many batches when each of your skeletons has a repacked single atlas texture?
i mean secend point: too many drawcalls when each of your skeletons has a repacked single atlas texture

---

Harald писал(а):Do you mean that you are facing problems that the GetRepackedSkin calls are expensive? Or do you mean that you still have too many batches when each of your skeletons has a repacked single atlas texture?
Thank you for any help :tear:
joeplayer
  • Сообщения: 13

Misaki

Sorry for the delay in getting back to you, Harald is currently on vacation and will get back to you when he returns.
Аватара пользователя
Misaki

Misaki
  • Сообщения: 755

Harald

Sorry for the late reply.

It is hard to recommend a general optimal grouping of attachments to atlas textures without additional info. Repacking may be beneficial in some cases, but if you have e.g. 100 characters that use the same two atlas textures, then repacking may end up requiring more draw calls (with 100 different textures) than having those 100 characters use the same two atlas textures.

Could you please describe your scenario or share some screenshots? Please describe approximately how many skeletons are visible at once, how many share the same atlas, how many equiment or customization items are available, how many are equipped at once, etc.

Also please note that when you get many draw calls at a single skeleton when using two atlas textures (before repacking), you may reduce the number of draw calls by grouping attachments to atlas textures differently, as described here:
spine-unity Runtime Documentation: Material Switching and Draw Calls
Аватара пользователя
Harald

Harri
  • Сообщения: 4088

joeplayer

Harald писал(а):Sorry for the late reply.

It is hard to recommend a general optimal grouping of attachments to atlas textures without additional info. Repacking may be beneficial in some cases, but if you have e.g. 100 characters that use the same two atlas textures, then repacking may end up requiring more draw calls (with 100 different textures) than having those 100 characters use the same two atlas textures.

Could you please describe your scenario or share some screenshots? Please describe approximately how many skeletons are visible at once, how many share the same atlas, how many equiment or customization items are available, how many are equipped at once, etc.

Also please note that when you get many draw calls at a single skeleton when using two atlas textures (before repacking), you may reduce the number of draw calls by grouping attachments to atlas textures differently, as described here:
spine-unity Runtime Documentation: Material Switching and Draw Calls
Different characters use the same two atlas textures is a good proposals.
How to execute?One charater create one skin. My code is as:

Skin repackedSkin = new Skin("repackedSkin");
repackedSkin.Clear();
repackedSkin.AddAttachments(skeleton.Data.DefaultSkin);
repackedSkin.AddAttachments(customSkin);
repackedSkin = repackedSkin.GetRepackedSkin("repackedSkin", sourceMaterial, out runtimeMaterial, out
skeleton.SetSkin(repackedSkin);
joeplayer
  • Сообщения: 13

Harald

The easiest way is to pack your atlas textures separately from skeleton export. Spine allows you to use the Texture Packer separately to pack pre-arranged folders to atlases, as described in the following postings:
Is there any way to reduce drawcalls?
how Export 1 atlas as jpg and 1 as png?
Аватара пользователя
Harald

Harri
  • Сообщения: 4088

joeplayer

Harald писал(а):The easiest way is to pack your atlas textures separately from skeleton export. Spine allows you to use the Texture Packer separately to pack pre-arranged folders to atlases, as described in the following postings:
Is there any way to reduce drawcalls?
how Export 1 atlas as jpg and 1 as png?
The forum post is how to pack a texture from a fold. But combining skin is repack a new texture. The old pack texture is useless......
joeplayer
  • Сообщения: 13

Mario

No, it's not useless. The skeletons of your characters are made up of different images. You want them all to share the same texture atlas with the least amount of texture atlas pages. Instead of recombining the images of a single character at runtime, you combine all images of all characters into a single texture atlas offline. You end up with a single texture atlas shared across all your characters, which is exactly what Harri has proposed and which is likely to minimize your draw calls.
Аватара пользователя
Mario

Mario
  • Сообщения: 3079

joeplayer

Mario писал(а):No, it's not useless. The skeletons of your characters are made up of different images. You want them all to share the same texture atlas with the least amount of texture atlas pages. Instead of recombining the images of a single character at runtime, you combine all images of all characters into a single texture atlas offline. You end up with a single texture atlas shared across all your characters, which is exactly what Harri has proposed and which is likely to minimize your draw calls.
The reason I combine skins is one attachment show one more picture.
I don't know any other way to perform this requirement.
joeplayer
  • Сообщения: 13

Mario

Please illustrate what you want to do with images. I'm afraid I don't understand your last reply.
Аватара пользователя
Mario

Mario
  • Сообщения: 3079

joeplayer

Mario писал(а):Please illustrate what you want to do with images. I'm afraid I don't understand your last reply.
the Spine Examples-Mix and Match Skins
joeplayer
  • Сообщения: 13

Harald

Please note that the number of different skeletons, number of atlas pages per skeleton and the number of equipment items matters here. I doubt that you have exactly the same use case scenario like the Spine Examples/Other Examples/Mix and Match Skins example scene and have the same number of skeletons (a single one) and equimpent items.

In order to be able to help, we need to know your use case better. So I repeat the question:
Harald писал(а):Could you please describe your scenario or share some screenshots? Please describe approximately how many skeletons are visible at once, how many share the same atlas, how many equiment or customization items are available, how many are equipped at once, etc.
In general there are two ways to approach combining skins:
A) Not perform any runtime-repacking of skins, instead pre-packing atlas pages smartly (e.g. one shared atlas containing all common equipment items if possible, another shared atlas with most common character appearance skin images, and so on) so that few pages are active at once and shared across many skeletons. As described in my posting above which you incorrectly described as "useless".
B) Perform runtime repacking. If you have 100 skeletons visible at once where each will have a repacked skin, this will not be a good option.
Аватара пользователя
Harald

Harri
  • Сообщения: 4088

joeplayer

Harald писал(а):Please note that the number of different skeletons, number of atlas pages per skeleton and the number of equipment items matters here. I doubt that you have exactly the same use case scenario like the Spine Examples/Other Examples/Mix and Match Skins example scene and have the same number of skeletons (a single one) and equimpent items.

In order to be able to help, we need to know your use case better. So I repeat the question:
Harald писал(а):Could you please describe your scenario or share some screenshots? Please describe approximately how many skeletons are visible at once, how many share the same atlas, how many equiment or customization items are available, how many are equipped at once, etc.
In general there are two ways to approach combining skins:
A) Not perform any runtime-repacking of skins, instead pre-packing atlas pages smartly (e.g. one shared atlas containing all common equipment items if possible, another shared atlas with most common character appearance skin images, and so on) so that few pages are active at once and shared across many skeletons. As described in my posting above which you incorrectly described as "useless".
B) Perform runtime repacking. If you have 100 skeletons visible at once where each will have a repacked skin, this will not be a good option.
Perform runtime repacking make the workload of artwork is easier. So other way is "useless".
joeplayer
  • Сообщения: 13

Mario

You can either have performance through shared atlases or "an easier artwork workload". This are hard technical limitations that we can not fix. You'll have to choose which option you want.
Аватара пользователя
Mario

Mario
  • Сообщения: 3079

joeplayer

Mario писал(а):You can either have performance through shared atlases or "an easier artwork workload". This are hard technical limitations that we can not fix. You'll have to choose which option you want.
Thank you for your help :(
joeplayer
  • Сообщения: 13


Вернуться в Unity