SpriteUV: create atlas with triangles coordinates to optimize atlas size

Hello,

Do you know SpriteUV?

It’s a tool to pack images to an atlas! The difference with TexturePacker is simple. Instead of packing by square, it packs by triangles and generates a description files (with all triangles coordinates). So you can pack more images in the same atlas or you can have a smaller atlas with the same amount of images.

I think the openfl community could benefit of this tool. We just need to:

  • parse the description files (json, xml, OBJ, fbx,…). I think the json should be enough.
  • create a renderer that parse all triangles from an image to draw it on screen using drawTriangles()

Any thoughts?

2 Likes

Looks useful. I tried it but it looks like for every single image export it’s own json file or I miss something in settings.

That’s a feature I’ve asked to the developer :slight_smile:
He already implements it :+1:

In Mesh Export Group > exportGroup, you can choose export as single file.

1 Like

Nice, I believe this is hardest part…

Or maybe instead of drawTriangles we should use OpenGL command direcly? I don’t know the best approach.

drawTriangles would be suitable if we implemented the hardware shape.graphics improvements I think we should

Yeah, cool! But… how does it work when importing Spine packs? Ok, it repacks Spine images, but does it generate compatible JSONs? This would mean that Spine is unable to generate optimized images, even if it uses the same export format.
Will it support Spriter too? In the (I hope) near future I will have to test and choose between animation tools, and I’d like to know if I will have to go with Spine, Spriter or other tools.

I must admit that I don’t know what exactly SpriteUV does with Spine:
Is it just packing? => so I guess the same thing can be done for Spriter (you don’t really need a “Spriter support” for that)
Can we use this pack when opening a project on Spine? => there is no mesh deformation on Spriter v1 so I think we can’t have that for now. But this feature is planned for Spriter v2.

As for Spriter engine for openfl, I will add support for SpriteUV.

Great! Thank you loudo!

I’ve made a parser and I have a basic renderer working for now (on legacy! didn’t try on last openfl…). I’ll post on github as soon as possible. I plan to make a complete renderer.

1 Like

You can find the parser here on github:AtlasTriangle. I’ve added a parser for TexturePacker (the same feature exists, you have to choose XML (generic) exporter + polygon algorithm).
I’ll made a renderer later.