Procedural Bookshelf

Building a system to optimally pack box-like objects onto procedurally generated bookshelves. The main idea behind it is to compute a bounding rectangle for each asset to be packed and then using UV layout algorithms for optimal rectangle packing over provided UV islands (the procedurally generated bookshelf area). Once the 2D rectangles are optimally distributed we can swap them out with the original asset like a book or a box.

This method can sometimes produce physically non realistic packing since we are not taking any forces like gravity into account. We can overcome this problem by adjusting the freedom of rotation and playing around with the generative random seed until we find a configuration that looks physically plausible.

As always, project files can be downloaded on Patreon.