An advanced tool for automatically generating WFC adjacency rules using a connector-based system, inspired by Marian42's WFC implementation.
Instead of manually reviewing every tile pair (O(N²) comparisons), this tool uses a connector-based approach where:
- Each tile face has a connector group ID
- Connectors with matching IDs can potentially connect
- Symmetry/rotation rules ensure proper geometric alignment
- Adjacencies are automatically generated from connector data
- Navigate to
/connector-builder.html - Click "Pick Directory" (recommended) or "Upload GLB Files"
- Tiles will be auto-arranged in a grid
- Select tiles and edit their connectors
- Click "Auto-Generate Adjacencies"
- Export GLB files with embedded connector and adjacency data
Each tile has 6 connectors (one per face):
- up (vertical)
- down (vertical)
- north (horizontal)
- south (horizontal)
- east (horizontal)
- west (horizontal)
- String identifier for the connector type
- Default:
"0","1","2", etc. - Example:
"wall_side","floor_top","air"
Rotation Index:
0,1,2,3- Specific 90° rotation angles"invariant"- Matches any rotation
Symmetry:
"flipped"- Flipped orientation"not-flipped"- Standard orientation"symmetric"- Matches any orientation
Two connectors can connect if:
- Group IDs match:
connectorA.groupId === connectorB.groupId - Symmetry/rotation compatible:
- Vertical: Either is
"invariant"OR rotation indices match - Horizontal: Either is
"symmetric"OR one is"flipped"and other is"not-flipped"
- Vertical: Either is
- No exclusion rule blocks the connection
- Auto-arrange: Tiles arranged in XZ grid on load
- Box selection: Hold Shift + Drag to select multiple tiles (2D screen-space)
- Multi-select: Hold Shift + Click individual tiles
- Transform mode: Press
Gto move tiles (like Blender)
- Select one or more tiles
- Click "Edit Connectors"
- Choose face (up/down/north/south/east/west)
- Set group ID (or create new group)
- Set rotation (vertical) or symmetry (horizontal)
- Apply to all selected tiles
- Each group has a visibility checkbox in the groups list
- Hidden tiles cannot be selected or interacted with
- Useful for focusing on specific connector groups
- Visibility is independent per face direction
- Hidden tiles are automatically deselected if currently selected
Sometimes connectors match but the result doesn't look good. Use exclusions to block specific pairings:
- Check "Enable Exclusion Mode"
- Click source tile (turns red)
- Select direction (↑↓→←↗↙)
- Click target tile
- Exclusion created: "source cannot be [direction] of target"
Example: Block a tunnel piece from being north of a wall, even if connectors match.
- Left-click + Drag: Rotate camera (orbit)
- Right-click + Drag: Pan camera
- Scroll Wheel: Zoom in/out
- Selection preserved: Camera controls don't affect selection
Once connectors are configured:
- Click "✨ Auto-Generate Adjacencies"
- Algorithm checks all tile pairs in all directions
- Applies connector matching rules
- Respects exclusion rules
- Populates adjacency data automatically
Export JSON (Reference):
- Human-readable JSON with connectors, exclusions, and computed adjacencies
- Useful for debugging and review
Save GLB Files:
- Embeds connector data in
userData.connectors - Embeds exclusion rules in
userData.exclusions - Embeds computed adjacencies in
userData.adjacency - Saves to original directory (if picked) or downloads individually
| Key | Action |
|---|---|
1 |
Top view (camera) |
2 |
Front view (camera) |
3 |
Right side view (camera) |
4 |
Left side view (camera) |
G |
Toggle transform/move mode |
ESC |
Deselect all / Close modal |
Shift + Click |
Multi-select tiles |
Shift + Drag |
Box select tiles |
-
Load tiles:
floor.glb,wall.glb -
Configure floor:
- Up:
group_id="air", rotation=invariant - Down:
group_id="solid", rotation=invariant - North/South/East/West:
group_id="floor_side", symmetry=symmetric
- Up:
-
Configure wall:
- Up:
group_id="wall_top", rotation=invariant - Down:
group_id="solid", rotation=invariant - North/South/East/West:
group_id="wall_side", symmetry=symmetric
- Up:
-
Auto-generate: Floor and wall connect vertically (shared
"solid"connector) -
Export: Both tiles now have correct adjacencies
- Descriptive names:
"wall_side">"0" - Semantic groups:
"air","solid","water" - Material-based:
"brick","wood","glass" - Feature-based:
"door_frame","window_edge"
| Manual Builder | Connector Builder |
|---|---|
| O(N²) pair comparisons | O(N) connector assignments |
| 30,300 decisions for 100 tiles | 600 connector settings (6 per tile) |
| No reusability | Connectors reused across tiles |
| Hard to maintain consistency | Geometric rules ensure consistency |
| No spatial awareness | Visual grid layout |
interface ConnectorData {
groupId: string;
symmetry?: "flipped" | "not-flipped" | "symmetric"; // horizontal
rotation?: 0 | 1 | 2 | 3 | "invariant"; // vertical
}
interface ConnectorTile {
id: string;
connectors: {
up: ConnectorData;
down: ConnectorData;
north: ConnectorData;
south: ConnectorData;
east: ConnectorData;
west: ConnectorData;
};
exclusions: Array<{
targetTileId: string;
direction: "up" | "down" | "north" | "south" | "east" | "west";
}>;
adjacency: {
up: Set<string>;
down: Set<string>;
// ... computed from connectors
};
}{
"tileId": "floor_01",
"weight": 1,
"connectors": {
"up": { "groupId": "air", "rotation": "invariant" },
"down": { "groupId": "solid", "rotation": "invariant" },
"north": { "groupId": "floor_side", "symmetry": "symmetric" },
"south": { "groupId": "floor_side", "symmetry": "symmetric" },
"east": { "groupId": "floor_side", "symmetry": "symmetric" },
"west": { "groupId": "floor_side", "symmetry": "symmetric" }
},
"exclusions": [],
"adjacency": {
"up": ["wall_01", "wall_02"],
"down": ["foundation_01"]
}
}- Works with GLB files from Blender, Unity, or any 3D tool
- Preserves existing connector data (re-edit anytime)
- Compatible with Three.js WFC implementation
- Exports work with original AdjacencyBuilderUI for verification
Q: Tiles not connecting?
- Check group IDs match exactly (case-sensitive)
- Verify rotation/symmetry settings
- Look for exclusion rules blocking connection
Q: Too many connections?
- Use more specific group IDs
- Add exclusion rules for unwanted pairs
- Check if symmetry should be more restrictive
Q: Transform controls not appearing?
- Press
Gto enable transform mode - Only works with single tile selected
- ESC to exit mode
Q: Can't save to directory?
- Use "Upload Files" mode (will download individually)
- Browser may need File System Access API permission
- Check browser console for errors
- Marian42's WFC Blog - Original connector system inspiration
- Wave Function Collapse Algorithm
- Three.js TransformControls