Filter Cells - Join All Regions
Join disjoint regions into one connected component by adding the shortest L-shaped (dogleg) corridors between them.
What it does
Detects connected components and repeatedly connects non-main regions to the largest region using a shortest dogleg corridor of configurable width, until the entire set is connected.
Inputs
| Field | Description |
|---|---|
| Cells | Input open cells as Vector2Int positions. |
| Corridor Width | Width (tiles) of added corridors. |
| Use 8 Neighbors | Connectivity model for region detection (8-way vs 4-way). |
Outputs
| Field | Description |
|---|---|
| Connected Cells | Original cells plus added corridor cells. Supports input == output safely. |
| Added Corridor Cells (optional) | Only the cells that were added to connect regions. |
How it works
- Finds components (by size, largest first).
- For each non-main component, finds the closest pair of cells (Manhattan distance) across the component boundary and builds a dogleg between them.
- Repeats until a single component remains.
Tips
- Use after Keep Largest Regions to connect a few remaining pockets.
- For more organic joins, you can post-process the added corridors with Dilate/Erode filters.