krutovig

I use single atlas per file with a few skeletons. As I have 2048 size as maximum, spine creates 2 atlases on export. Sprites belong to one of skeletons appears to be placed on both atlases: a part of them on the first, a part on the second. And then the problem appears. In Mesh Renderer I see 3 materils instead of 2, the third material duplicates 1st somehow. http://joxi.ru/nAyzzJ9ugPaVRr

And the problem appears in the game. A part of the first atlas renders in the first material and a part in its duplicate somehow. When I zoom in the game materials 1 and 3 switches for the moment and I see a blinking of a shadow sprite. You can see it on this video:
https://drive.google.com/file/d/1zTGsfqbtDRzdfqt_nIUtJSGG76sVYNoO/view?usp=sharing
krutovig
  • Posts: 21

Harald

krutovig wrote:Sprites belong to one of skeletons appears to be placed on both atlases: a part of them on the first, a part on the second.
Do you mean a single attachment was placed as a duplicate on two atlas page textures? Can you please show images showing your problem?
krutovig wrote:And then the problem appears. In Mesh Renderer I see 3 materils instead of 2, the third material duplicates 1st somehow. http://joxi.ru/nAyzzJ9ugPaVRr
This is expected behaviour when your draw order requires to switch between these two textures.
See this forum posting for an explanation:
Multiple VS Single PNG export
User avatar
Harald

Harri
  • Posts: 2091

krutovig

Harald wrote:This is expected behaviour when your draw order requires to switch between these two textures.
See this forum posting for an explanation:
So what is quick solution to avoid that blinking you can see on the video but to save single atlas setting? I don't get your comment about ordering. I can't change the order. It needs to be exactly the current because it sets what hides behind what visually.

---

Also I don't get why I see the shadow sprite changing its visual order: it lays behind the booth, then it goes under it
krutovig
  • Posts: 21

Harald

If you are using lightweight/universal render pipeline (LWRP / URP), there is a bug in Unity of too agressive batching. For this we have added a parameter Fix Draw Order in the Advanced section of the SkeletonRenderer inspector.

If this does not help, you could also add a SortingGroup Component to the GameObject to prevent any wrong grouping / reordering.

If none of the above options resolves your issue, then please send us a minimal Unity project that still shows the problem as a zip package to contact@esotericsoftware.com, then we can have a look at it.
krutovig wrote: I don't get your comment about ordering. I can't change the order.
The referenced posting was trying to explain that if the attachments are on two different atlas pages and your order is as is (alternating atlas pages A B A), then material A will be listed twice. You can of course not change the order. What you can perhaps change (depending on your attachment sizes), is to re-arrange attachments so that when order is 1, 2, 3 that they are grouped by order to atlas page texture A = 1,2 and texture B = 3 (drawing AA B) instead of A = 1,3 and B = 2 (drawing A B A), then you can save one draw call and see only two materials where you now see three.
User avatar
Harald

Harri
  • Posts: 2091

krutovig

thanks, that helped!
krutovig
  • Posts: 21


Return to Unity