So I have this problem with doing a “Kind of” marching square for some objects I place on the floor of my game. The map is based on a 1 by 1 grid on x and z axis. As the first picture shows ( poorly made on paint ), there is a grid.

The blue squares are squares that aren’t used by any object, hence they are not a key in the dictionary of the mapping ( due to the fact that the map is virtually infinite ). Due to this, they can’t get referenced and have to be created with a Vector2 key. The black squares are the objects I’m talking about. The thing is that I want to connect them in a seemless way that seems fine like with the marching square. But since the player can add or remove any object at any time, I don’t want to go throught the 3D meshing of the official marching square everytime the player clicks on the ground ( which would require too much calculations for nothing ).

Instead, I’m using 2D textures on planes to represent them right now. It’s easy to do and check the 4 neighbours on the cross to have a good visual, but the problem comes on the 4 diagonals. As the sencond picture shows ( at the end of the text ), some visual may go out of the boundary of an object just to correctly show it. Also, it would require adding objects with visual over the blue inactive squares. Last thing is that with 8 neighbours, there are 256 possiblities of neighbouring every tile. What do I do? I’ve been searching for a week now.

Well, if you conceptually subdivide each square into 4 smaller squares, then the problem gets much easier. Each subsquare will have a line at its top or right edge, or one of the two diagonals (or have no line at all). I think you can code a bit of logic to figure out which case applies.

On the other hand, marching squares is pretty quick, and drawing lines is easy & efficient with something like Vectrosity. So, you could just do it that way.

look at those pages, they have quite a bit of code. from the 2d one it looks exactly like what you have. The point of marching cubes is to approximate shape, not use voxel representation to be that shape. So yes, marching cubes will span sections of other empty spaces.

You don’t need four planes; you need four squares, which could be implemented in lots of different ways — sprites, quads, a single mesh for the whole lot of them, etc.

So, yeah, you can definitely do it this way I think.