• Editor
  • Question about polygonal texture packing

Related Discussions
...

Am I mistaken that being able to take advantage of polygonal packing is dependent on using meshes in my animation in the first place? Our animations have hundreds of pieces, and it would be quite a task to go through our game adding meshes to take advantage of the potential texture memory savings. Can this be automated? Would it tank performance at runtime?

Yes, you would need to add meshes. You can use the automatic mesh tracing in 3.8:
Blog: Spine 3.8 released: Mesh tracing

Yes, meshes can negatively affect performance, mostly CPU due to a higher number of vertex transforms (a region has 4, meshes usually have more than 4):
Metrics - Spine User Guide: Performance
Whether the impact is significant depends on your application's specifics, as described there.

Meshes can also affect performance positively: all pixels drawn count against the fill rate, even if they are transparent. Meshes reduce the pixels drawn, which reduces your fill rate.

I like the idea of improving GPU fill rate, especially for this animated crowd I have. I think I discovered an editor bug in the process of adding these meshes after the fact. If the region attachment has a negative x scale, the resulting mesh is flipped on the Y axis and moved up in space to the original top border of the attachment's bounds.

I can work around this, but it's an extra couple of steps for however many of these I need to edit.


If I have an estimated 3 billion region attachments all sharing the same image in the atlas, will Spine just pack against the first mesh it finds for each? How do I copy mesh data to identical attachments?


Ah, yes the export works while stripping out like-for-like images. I got it to a point where I gave up on an export after 30 minutes, but prior to that it did work.

I do notice that meshes break when typing in scale numbers below 1.0f, and the mesh cannot be scaled back to 1.0 or above. You have to undo the action. They can be scaled with the mouse, however, but that also alters x/y transforms as a group.

FCSW_Ben a écrit

If the region attachment has a negative x scale, the resulting mesh is flipped on the Y axis and moved up in space to the original top border of the attachment's bounds.

Unfortunately this is not easily fixed due to how the math works out. 🙁

FCSW_Ben a écrit

If I have an estimated 3 billion region attachments all sharing the same image in the atlas, will Spine just pack against the first mesh it finds for each?

Spine's texture packer packs the images files and uses the mesh information to know what pixels are safe to remove from meshes. If multiple meshes use the same image, it is only packed once and the maximal region of the image is preserved.

FCSW_Ben a écrit

I got it to a point where I gave up on an export after 30 minutes

The polygonal texture packer can sometimes takes an unreasonably long amount of time. We will improve it soon!

FCSW_Ben a écrit

I do notice that meshes break when typing in scale numbers below 1.0f, and the mesh cannot be scaled back to 1.0

Hmm. This happens because when you start typing eg 0.1, once you press 0 the mesh is scaled to zero, which places the vertices in a straight line. After that any other scale cannot move the vertices because the original shape was lost. We'll improve this, probably by not applying a scale of 0 unless the text field is unfocused.