Add Z3 powered packer as an alternative to BinPacker #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was trying to pack some 3x 2048x2048 and it unfortunately always produced an atlas that was 4096x8192. I kinda got angry about that, debugged it, and discovered one of the UVs were going slightly beyond the bounds to make one of the textures calculated as 2048x2063 or something. It was still possible to pack it, it's just that the BinPacker heuristic would get unlucky with the ordering and would result in a suboptimal atlas size. So I decided I would improve the way packing works, and I recently learned about Z3, so I used it here to develop a better packing algorithm. I've tried it out and it works great and no longer generates unnecessarily large atlases for me. I think it shines most in "Quadratic" (and "Automatic" which is the same) mode. Here's a PR for it, try it out and let me know what you think.
This change makes the Z3 powered packer the default, with a checkbox you can uncheck to use the old BinPacker.
This change also fixes some minor annoyances to me, like the weirdly large numerical input boxes, and missing
del
s inunregister
(although I've never written a Blender plugin before so I have no idea what I'm doing).