Greetings! I am working on a building system that groups certain voxels together (finds a box/rectangle shape to combine blocks together to make them one block rather than multiple) if they are right next to each other. So far, I have the building system complete and a flood fill search system that will search though all parts and return parts that are near another, and then it will recursively search the near parts for parts near those parts, if that makes sense.
The issue I’m having right now is I can’t seem to figure out how to do such a grouping algorithm and I’d appreciate it if someone could point me in the right direction, or let me know if there’s some video on it or something. I’ve looked around a bit but I haven’t found much on what I’m trying to do. I was thinking about converting them into 2D tables to more easily find and group blocks around it but I don’t feel like that’s the best solution…
Here is an example of what I’m trying to do (I’ve grouped them by color in this picture)
I’m not trying to group them in this exact way or anything but just in a way that attempts to find the largest possible “chunk area” it can group.
For example, it could have also grouped like this
If you need me to clear anything up, don’t hesitate to ask! Thank you!