Technically this isn’t an OpenGL question, but I figured that it is one that commonly occurs while writing a lightmapper (a seemingly hot topic here) so…
I’m writing a lightmapper and plan to store my lightmaps onto a single texture. However, I would like to be able to use lightmaps or arbitrary dimension. My rationale for this is that I would like to have a polygon that is, say, 50x50 meters use a larger lightmap (i.e. one that contains more detail) than a polygon of 50mm x 50mm. Additionally, I would like to use rectangular lightmaps as well as square lightmaps to make more efficient use of the detail in the lightmap.
What I need then, is an algorithm to take these arbitrarily sized lightmaps and pack them together onto a texture map in as efficient a manner as possible.
I have heard of this problem described as the box packing problem, but have found little accessible literature on this topic. If anyone has good literature, sample code, or other useful info on this matter, I would be much obliged.
Thanks in advance,