Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Packing algorithm node

Open Keavon opened this issue 8 months ago • 5 comments

Packing algorithms are tricky! But we should find or build one that's high quality and efficient based on whatever the state of the art is in this field of research that supports nonconvex shapes.

The motivating use case is creating a sign like this out of icons:

Image

Keavon avatar Apr 17 '25 08:04 Keavon

Another great use case would be layout optimizations for printing, basically packing as many designs as possible on one sheet of paper which can then be cut out using scissors

TrueDoctor avatar Apr 17 '25 08:04 TrueDoctor

Yeah, although paper is cheap— the more common use case along the same lines in industry is for expensive materials. Blade/laser/plasma/waterjet cutting materials like vinyl, wood, acrylic, and metal. In those cases, material costs really matter (especially at scale), so there are commercial off-the-shelf packing algorithm software packages that do exactly that as optimally as possible to save on material costs. We should aim to eventually have a competitive algorithm in terms of both quality of output and performance.

Keavon avatar Apr 17 '25 09:04 Keavon

We actually do this every year for printing tshirts. Currently we manually layout the objects to use as little tshirt printing material as possible. That was also the main use case I was thinking of

TrueDoctor avatar Apr 17 '25 22:04 TrueDoctor

We could use one of these exsting implementations: https://github.com/JeroenGar/jagua-rs https://github.com/JeroenGar/sparrow And also allow users to select other algorithms (e.g. regular texture atlas packing) etc. via a dropdown

TrueDoctor avatar Apr 23 '25 11:04 TrueDoctor

This is basically identical use case as packing unwrapped UV meshes in 3D graphics. There is a lot of existing tooling for this use case: https://projects.blender.org/blender/blender/issues/105680 https://projects.blender.org/blender/blender/pulls/105821 This tool is doing much more than just packing the UV islands (vector shapes) so the packing algo would need to be extracted: https://github.com/jpcy/xatlas

j-jasz avatar May 04 '25 10:05 j-jasz