1

Algorithm suggestions for 2d and 3d volumetric combination of voxels?

I built an image to voxel converter for exporting to the game Avorion over the weekend. I am using a naive approach and treating each pixel as a box shape. I need to learn how to write an algorithm for combining voxels with the same color into rectangular cuboids. This will reduce the imported shapes. As is the game has issues with 64x64x1 images on import. It would be good to reduce the object count by creating cuboids with the pixels that can be combined. I would like to learn to write the algorithm for both 2d and 3d.

Comments
  • 0
    Also, the algorithm may not be that hard. I have been thinking it through in my mind. But once I have the objects I then need to figure out a parenting scheme as well. Each block has to have a parent that is a touching block. The cuboid part is not that bad, at least in my mind it is not. The hard part is a method for proper parenting.
  • 0
    Do the volumes NEED to be rectangular, or cubic, or can they be any freeform shape?

    2D algo is very easy in most of those cases. 3D is the same thing with an additional axis.
  • 0
    Rectangular and cubic is difficult. Requires packing them together based on finding the largest possible cube or rectangle. Polygon is easy, just do a paint fill algo to select similar colored voxels and combine them
  • 0
    @AlgoRythm Must be rectangular as that is the shape of all their primitives.
Add Comment