Studio Yotsuba
Back to Node List

Region Boundary Trace

region_boundary_trace

Extracts region borders as pixel-line data for further line processing. If you just want a picture of the borders, Region Border is the easier choice

Reviewed
Guide available

Input Ports

NameTypeDescription
Regions
regions
RegionMap
Required
RegionMap whose borders are traced

Output Ports

NameTypeDescription
Pixel Line
pixel_line
PixelLine
Traced border pixels grouped into connected lines
Preview
preview
Image
Preview image of traced boundary pixels
Summary
summary
Map
Trace counts and wrap flags

Parameters

NameTypeDefaultRangeDescription / Options
Target
target
Enum
All—

Which region borders are traced

  • AllAll
    Trace all region borders
  • RegionIdRegionId
    Trace borders touching one region id
  • IdRangeIdRange
    Trace borders touching ids in a range
  • PairPair
    Trace borders between two exact region ids
Region ID
region_id
Int
00–2147483647

Region id used by RegionId target

Min ID
min_id
Int
00–2147483647

Minimum id used by IdRange target

Max ID
max_id
Int
2550–2147483647

Maximum id used by IdRange target

ID Range Match
id_range_match
Enum
BothInside—

How IdRange target matches a border pair

  • BothInsideBothInside
    Trace borders where both region ids are inside the range
  • TouchingTouching
    Trace borders where either region id is inside the range
  • CrossingCrossing
    Trace borders crossing between inside and outside of the range
Pair A
pair_a
Int
00–2147483647

First region id for Pair target

Pair B
pair_b
Int
10–2147483647

Second region id for Pair target

Connectivity
connectivity
Enum
Four—

Neighbor rule used to detect borders

  • FourFour
    Trace orthogonal borders
  • EightEight
    Also include diagonal contacts
Placement
placement
Enum
ForwardSide—

Which side of a boundary becomes PixelLine pixels

  • BothSidesBothSides
    Trace pixels on both sides
  • ForwardSideForwardSide
    Trace one scanned side
  • LowerIdSideLowerIdSide
    Trace lower-id side only
  • HigherIdSideHigherIdSide
    Trace higher-id side only
Min Length
min_length
Int
11–4294967295

Discard traced components shorter than this

Cleanup Corners
cleanup_corners
Bool
false—

Clean short boundary noise without thinning thick lines

Cleanup Mode
cleanup_mode
Enum
Safe—

How corner cleanup is applied when enabled

  • SafeSafe
    Remove only short spurs attached to thicker boundary pixels
  • StrongStrong
    Remove longer short spurs while preserving filled blocks and junctions
  • HorizontalHorizontal
    Use path-stroke cleanup that removes horizontal-side corners
  • VerticalVertical
    Use path-stroke cleanup that removes vertical-side corners
Spur Length
spur_length
Int
11–8

Maximum short protrusion length removed by Strong cleanup

Color
color
Color
[1,1,1,1]—

Preview color

Overview

An advanced boundary node that extracts RegionMap boundaries as line data (PixelLine). Unlike region_border, which produces a quick line image, this node can precisely select which IDs define a boundary and clean protrusions to improve the quality of the resulting pixel lines.

  • Category: Generate / Region / Render
  • Uses: processing boundaries downstream, extracting only a specific region pair's boundary, and cleaning boundaries as pixel lines

Usage tips

  • Use region_border to quickly overlay lines. Use this node when you need only the boundary between particular regions or plan to process the lines downstream.
  • Pair selection is its unique strength. It can isolate the water/sand boundary, for example, to create a white wave line.
  • Corner cleanup with Safe or Strong produces cleaner one-pixel lines for pixel art.

Related nodes

  • region_border — convenient image version
  • region_fill — base image beneath the lines
  • region_remap — stabilizes ID selection beforehand

Target

Value Description
All Extract all region boundaries
RegionId Extract only boundaries touching the specified ID
IdRange Extract only boundaries touching the specified ID range
Pair Extract only the boundary between the specified two regions

ID range condition

Value Description
BothInside Extract only boundaries where both region IDs are in range
Touching Extract boundaries where either region ID is in range
Crossing Extract only boundaries between an in-range and out-of-range region

Placement

Value Description
BothSides Extract both sides of the boundary
ForwardSide Extract only one side, based on the right/down direction
LowerIdSide Extract only the side belonging to the lower region ID
HigherIdSide Extract only the side belonging to the higher region ID

Corner cleanup modes

Value Description
Safe Protects 2x2-or-larger blocks and branches, conservatively removing only short protrusions attached to thick boundaries
Strong Uses Protrusion Length to remove somewhat longer short protrusions; protects blocks, branches, and centers connected in all four directions
Horizontal Follows the behavior of RemoveHorizontal in Path Stroke
Vertical Follows the behavior of RemoveVertical in Path Stroke

How to use

Connect Region Cells.regions -> Region Boundary Trace.regions.

Use Region Border when you need an image immediately. Use this node when you want line data for further processing or need to isolate a specific region pair.

When the input RegionMap has horizontal or vertical wrapping, contacts across the left/right or top/bottom edges are also extracted as boundaries. Boundaries at the seams of a tile asset remain part of the same PixelLine data.

cleanup_corners does not force blocks two or more pixels wide into thin lines. It is an aid for removing short protrusions and isolated-looking noise that stand out in pixel art. Turn it off to preserve thick boundaries, use Safe to remove only fine whiskers, and use Strong for more aggressive cleanup.

Back to Node List