Sprite Packer being efficient with some sprites, very inefficient with others

For our game, we have a few massive textures 4096x4096 that have a lot of alpha space. This has actually worked out nicely since Unity has been packing our smaller sprites into the transparent space that would’ve otherwise been wasted.

However, I know it could be more efficient and I’m not sure why it’s not. The area highlighted with a red glow is also wasted alpha space, but it is not being recycled in the same way that the area in the green outline is.

If I assign the inefficient sprites to their own atlas (e.g. WorldUnitsHD2), they will be packed efficiently, with edges butted up against one another.

My hypothesis is that the packer is only doing one pass of optimization, instead of 2 or 3 that would be needed to optimize this case where small sprites are packed into medium sprites which are packed into large sprites. I’m really really hoping there’s a way to bypass this setting since it will really hurt our memory footprint.

We’re using a custom IPackerPolicy but it’s based on the TightPackerPolicy with a few changes to force certain settings (like 4K max size). I dont think this is the cause of the inefficiency though, especially since we use it to force tight packing on every sprite.

(Please forgive the image obfuscation)

It looks like Unity 4 has a pretty naive sprite packer. In Unity 5, the packer is a lot more efficient and this issue is solved when using the Unity 5 packer.

See below for an example of how the sprites should be packed. Notice that the isometric rectangles no longer have wasted spaces around them.