Distance Field
The Proximity Map. Calculates how far every cell is from the nearest "filled" cell in an input mask. This creates a gradient that radiates away from your shapes.
Ports
| Port | Type | Description |
|---|---|---|
| Input | Bool Mask | The "source" shapes to measure distance from. |
| Output | Float | A normalised gradient (0.0 at the source, increasing outwards). |
Details
This node uses a fast two-pass sweep algorithm to calculate distances across the entire map. The output is normalised (0 to 1) based on the maximum possible distance in the map.
Potential Use Cases
- Coastal Gradients: Generate a distance field from a "Land Mask" to create shallow water/sand gradients around islands.
- Erosion & Dilation:
- Expand: Distance Field -> Threshold (low value) -> New Mask.
- Shrink: Invert Mask -> Distance Field -> Threshold (low value) -> Invert.
- Safe Zones: Create a "Spawn Zone" mask by finding all areas within X distance of the starting point.
Technical Tip
To get a "hard" distance in meters (Unity units), you may need to use a Remap node to scale the 0-1 normalised value back to your world size.
Bool Mask
Float