Back to Node List

Region Distance

region_distance

Creates a grayscale distance map from RegionMap boundaries or ids

Reviewed
Guide available
The node name and summary are available in English. Port, parameter, and article details are currently shown in Japanese.

Input Ports

NameTypeDescription
領域
regions
RegionMap
Required
距離を測る RegionMap です

Output Ports

NameTypeDescription
距離
distance
Image
白黒の距離マップです
マスク
mask
Image
最大距離内のピクセルを白にしたマスクです
プレビュー
preview
Image
上に入力領域、下に距離結果を並べた確認用プレビューです
ラベル
labels
Map
Inspector に重ねるIDラベル位置です

Parameters

NameTypeDefaultRangeDescription / Options
起点
source
Enum
Boundary

距離の起点にするピクセルです

  • 領域境界Boundary
    異なるID同士の境界から距離を測ります
  • 外側Outside
    OUTSIDE ピクセルから距離を測ります
  • ID指定RegionId
    指定IDの領域から距離を測ります
  • ID範囲IdRange
    指定ID範囲の領域から距離を測ります
領域ID
region_id
Int
00–2147483647

領域ID

最小ID
min_id
Int
00–2147483647

最小ID

最大ID
max_id
Int
2550–2147483647

最大ID

距離方式
metric
Enum
Manhattan

距離の測り方です

  • マンハッタンManhattan
    上下左右だけで数える距離です
  • チェビシェフChebyshev
    斜めも1歩として数える距離です
  • 通常距離Euclidean
    斜めを約1.414歩として数える距離です
最大距離
max_distance
Float
160–512 / step 1

白として扱う最大距離です

減衰
falloff
Enum
Linear

距離値の変化の仕方です

  • 線形Linear
    直線的に変化します
  • なめらかSmooth
    なめらかに変化します
  • 段階Step
    白黒で分けます
反転
invert
Bool
false

出力の明暗を反転します

領域内のみ
inside_only
Bool
true

OUTSIDE ピクセルを透明のままにします

プレビューシード
seed
Int
10–99999

プレビュー色だけを変更し、距離画像とマスクの結果には影響しません

ID表示
show_ids
Bool
false

Inspector のプレビュー上に領域IDラベルを表示します

Overview

Turns the number of pixels from a RegionMap boundary or specified region into a grayscale image. It creates helper maps for distance-based effects from a boundary, such as a bright shoreline edge, shadows along rock outlines, or an inward gradient.

Usage tips

  • The go-to edge effect uses source=Boundary, stepped falloff, and max_distance=1–3 to make a mask covering a band N pixels from the boundary. Pass it to downstream color adjustment or compositing for effects such as a bright strip along a shoreline.
  • For gradual shading, use linear or smooth falloff with a larger max_distance. Multiplying by the distance image directly creates shading that darkens toward the boundary.
  • Enable inside_only when the effect should remain inside the material, preventing it from leaking beyond the silhouette.
  • Pass distance or mask downstream. Do not use preview, which is a combined image for inspection.

Related nodes

  • region_border — produce the line itself instead of distance
  • region_fill — combine with the base fill
  • region_mask — turn a particular region into a mask
  • blend — composite shading using the distance map

Outputs the distance from RegionMap boundaries, the outside, or specified IDs as a grayscale image. It is suited to helper maps for shorelines, rock edges, shading near boundaries, and inward gradients.

Key parameters

ID Description
source Distance origin: region boundary, outside, specified ID, or ID range
region_id / min_id / max_id Target for a specified ID or ID range
metric Distance metric: Manhattan, Chebyshev, or standard distance
max_distance Maximum distance used for the grayscale conversion
falloff Linear, smooth, or stepped
invert Invert light and dark
inside_only Keep OUTSIDE pixels transparent
show_ids Show ID labels in the Inspector preview

Enabling inside_only prevents the distance image from leaking outside the silhouette, making it convenient for processing edges inside an asset.

The distance output is not a numeric value; it is an Image that visualizes distance in grayscale. Hovering over the pin shows only metadata such as image size. To inspect the actual distances, connect distance to a Preview node or view this node's input/output port display.

This node's own preview combines two images vertically for inspection. The top half color-codes the input RegionMap, and the bottom half is the same distance image as distance. Downstream nodes should use distance or mask, not the combined preview.

Preview Seed changes only the region colors in the top half. It does not affect distance, mask, or the calculated distances.

How to use

To add a uniform shadow or edge color near boundaries, set source = Boundary, falloff = Step, and max_distance = 1–3, then pass mask or distance to a downstream composition or color-adjustment node. Use linear or smooth falloff when the effect should weaken with distance from the boundary.

Use source = ID or ID Range to calculate how many pixels lie from particular regions. This produces helper maps for effects such as shorelines, rock edges, or darkening only around a particular material.

Back to Node List
Region Distance — PixPipeline Node Reference