Need some help with procedural clean up

I have a problem i can’t quite seem to solve. I’m trying procedurally clean up some meshes that are backgrounds for a candy crush/ match type game. The meshes are a bit of a mess. They have overlapping faces, and weirdly connected regions. The end goal is to have a loop of polygons that are a stroke for the borders of these background.
This is pretty simple to do by hand but there are 200 of these levels now with possibly more in the future so I’m trying to come up with a procedural way or a macro for doing this.

I have made some good progress, but i still have a couple issues. The big one is welding or removing overlapping faces.

The procedure i have so far is:

  • Switch to Edit Mode
  • Select all
  • Tris to Quads
  • Delete only Faces
  • Select all
  • Rescale Y (to bring verts closer together)
  • Merge by Distance .0002
  • Tiny CAD Vertex at Intersection (With TinyCAD Addon enabled)
  • Select all
  • Merge by Distance .0002
  • Fill Holes 6

This works for the second and forth meshes but fails for 1, 3, 5 and 6.
I get verts that don’t weld because edges didn’t intersect, holes that get filled in that shouldn’t, overlaping faces.

I’m at a bit of a loss for a procedural way to clean these. I think being able to weld overlapping faces could solve many of the issues. What i really need is a clean boundry edge to expand to a ring of polygons.


MatchGame_Level_Cleanup.blend (3.1 MB)

I would model them new, less work than clean up. Take a grid and delete the undisered faces.

Why do you have so much faces, imported from other 3d-software?
Also you can go with just a plane and put a texture with alpha-channel on it, thats the way i would go here.
If you need geometry as coordinates in the game engine use a simple grid.

Yes they were imported from Unity. They were created through code to be modular semi transparent background pieces, so they already exist and work in the game. But there are 200 of the, and maybe more in the future.
I was looking for a sequence of steps to clean them procedurally so we could clean all of them and any future levels.
What we really want is a boundary boarder. To get that what i’d normally do is select all, and do a quick inset or outset or extract the boundary and do a fill. The problem is that it’s not one plane, and a merge by distance does not weld everything before destroying the holes i still need.
My latest atempt is trying to subdivide the mesh to get verts closer to weld, but i’m still left with overlapping faces.
I’m still trying to hopefully get it to work but it might be fastest to clean them by hand.

Tried face selection?
Go to edit mode. Upper left corner. It would help at opening holes. To fill holes select verts surrounding where you need to fill and press F.
For the second image you need to go to edge selection (same place you found face selection) then choose edges that you want to be glued together, right click and hit merge edges.