I need to pack triangles into a box as tightly as reasonable, as part of a 3D optimization (I'm stuffing alpha-using segments of different textures into a single different texture, for use with depth-sorting, so textures don't switch with every new tri)
Is there an algorithm for doing this? The triangles themselves can be made to be plyable (transformable to be right angles, effectively making this a box-stuffing algorithm instead), but I would like to avoid this if possible, as it would distort the underlying texture art.
box
in this context 3-dimensional (cuboid) or 2-dimensional (square/rectangle)? I'm used to seeing heuristics for this in 2D to pack triangles or quads into a texture coordinate UV space, but not one that operates in 3 dimensions.