Yotsuba Games
Back to Node List

Path Mask

path_mask

Convert closed bezier paths into a white alpha mask

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
ใƒ‘ใ‚น
path
Path
Required
ใƒžใ‚นใ‚ฏๅŒ–ใ™ใ‚‹ใƒ™ใ‚ธใ‚งใƒ‘ใ‚น

Output Ports

NameTypeDescription
็”ปๅƒ
output
Image
ใƒ‘ใ‚นใ‹ใ‚‰็”Ÿๆˆใ•ใ‚ŒใŸ็™ฝ+ใ‚ขใƒซใƒ•ใ‚กใฎใƒžใ‚นใ‚ฏ็”ปๅƒ

Parameters

NameTypeDefaultRangeDescription / Options
ๅน…
width
Int
641โ€“1024

ใ‚ญใƒฃใƒณใƒใ‚นใฎๅน…๏ผˆใƒ”ใ‚ฏใ‚ปใƒซ๏ผ‰

้ซ˜ใ•
height
Int
641โ€“1024

ใ‚ญใƒฃใƒณใƒใ‚นใฎ้ซ˜ใ•๏ผˆใƒ”ใ‚ฏใ‚ปใƒซ๏ผ‰

้‡ใชใ‚Šๆ–น
fill_rule
Enum
Unionโ€”

้‡ใชใฃใŸ้–‰ใ˜ใƒ‘ใ‚นใ‚’ใฉใ†้ขใจใ—ใฆๆ‰ฑใ†ใ‹

  • ๅ…จ้ƒจๅก—ใ‚‹Union
    ใฉใ‚Œใ‹1ใคใฎ้–‰ใ˜ใŸใƒ‘ใ‚นใฎไธญใซใ‚ใ‚Œใฐๅก—ใ‚Šใพใ™ใ€‚ๆ™ฎ้€šใซๅ›ณๅฝขใ‚’้‡ใญใŸใ„ใจใใฏใ“ใ‚Œใงใ™
  • ไธญใ‚’็ฉดใซใ™ใ‚‹EvenOdd
    ้‡ใชใ‚‹ใŸใณใซๅก—ใ‚‹/ๆŠœใใŒๅˆ‡ใ‚Šๆ›ฟใ‚ใ‚Šใพใ™ใ€‚ใƒ‰ใƒผใƒŠใƒ„ใ‚„ๆž ใ‚’ไฝœใ‚ŠใŸใ„ใจใใซไฝฟใ„ใพใ™
  • ๅ‘ใใง็ฉดใ‚’ๆฑบใ‚ใ‚‹NonZero
    ใƒ‘ใ‚นใ‚’ๆใ„ใŸๅ‘ใใงๅก—ใ‚Šใ‹็ฉดใ‹ใ‚’ๆฑบใ‚ใพใ™ใ€‚ๅค–ๅ‘จใจ็ฉดใ‚’่‡ชๅˆ†ใงๆใๅˆ†ใ‘ใŸใ„ไธŠ็ดš่€…ๅ‘ใ‘ใงใ™
ใƒ”ใ‚ฏใ‚ปใƒซใƒ‘ใƒผใƒ•ใ‚งใ‚ฏใƒˆ
pixel_perfect
Bool
falseโ€”

ใƒ”ใ‚ฏใ‚ปใƒซใƒ‘ใƒผใƒ•ใ‚งใ‚ฏใƒˆ่ฃœๆญฃๅพŒใฎ่ผช้ƒญใ‚’ๅŸบๆบ–ใซใƒžใ‚นใ‚ฏใ‚’ไฝœๆˆ

PP ใƒขใƒผใƒ‰
pp_mode
Enum
RemoveCornerโ€”

ใƒ”ใ‚ฏใ‚ปใƒซใƒ‘ใƒผใƒ•ใ‚งใ‚ฏใƒˆ่ฃœๆญฃใงใฉใกใ‚‰ใฎๅ†—้•ทใƒ”ใ‚ฏใ‚ปใƒซใ‚’ๅ‰Š้™คใ™ใ‚‹ใ‹

  • ๅฏพ่ง’ๅ„ชๅ…ˆDiagonal
    ๆฐดๅนณใ‚นใƒ†ใƒƒใƒ—ใ‚’ๅ‰Š้™คใ—ใฆใ‚ˆใ‚Šๅฏพ่ง’็š„ใชใƒฉใ‚คใƒณใซ
  • ็›ด็ทšๅ„ชๅ…ˆCardinal
    ๅž‚็›ดใ‚นใƒ†ใƒƒใƒ—ใ‚’ๅ‰Š้™คใ—ใฆใ‚ˆใ‚Šๆฐดๅนณ/ๅž‚็›ด็š„ใชใƒฉใ‚คใƒณใซ
  • ่ง’ๅ‰Š้™คRemoveCorner
    Lๅญ—ใฎ่ง’ใƒ”ใ‚ฏใ‚ปใƒซใ‚’ๅ„ชๅ…ˆใ—ใฆๅ‰Š้™ค
  • ่ง’ไฟๆŒKeepCorner
    Lๅญ—ใฎ่ง’ใƒ”ใ‚ฏใ‚ปใƒซใ‚’ๅ„ชๅ…ˆใ—ใฆไฟๆŒ
้–‰ใƒ‘ใ‚นๅค–็ฉใƒขใƒผใƒ‰
pp_closed_cross
Bool
falseโ€”

้–‰ใ˜ใŸใ‚ตใƒ–ใƒ‘ใ‚นใซๅค–็ฉใƒ™ใƒผใ‚นใฎๅ†…/ๅค–ใ‚จใƒƒใ‚ธๅ‰Š้™คใ‚’้ฉ็”จ

้–‰ใƒ‘ใ‚นๅ‰Š้™คๅด
pp_closed_side
Enum
Outerโ€”

้–‰ใƒ‘ใ‚นใฎใฉใกใ‚‰ๅดใฎใ‚จใƒƒใ‚ธใ‚’ๅ‰Š้™คใ™ใ‚‹ใ‹

  • ๅ†…ๅดInner
    ๅ†…ๅดใฎใ‚จใƒƒใ‚ธใ‚’ๅ‰Š้™ค
  • ๅค–ๅดOuter
    ๅค–ๅดใฎใ‚จใƒƒใ‚ธใ‚’ๅ‰Š้™ค

Overview

Converts closed paths into a white + alpha mask image. It turns a free-form shape drawn in a path editor into something usable for a cutout (mask) or a scatter area (mask_scatter). It bridges "draw the shape as a path" and "determine its use as a mask."

Usage tips

  • The go-to flow is multi_path_editor โ†’ path_mask โ†’ mask (clip an image), or โ†’ mask_scatter (scatter within the area).
  • For a shape with a hole, use fill_rule = EvenOdd: draw an outer and inner boundary to create a doughnut or frame mask.
  • Enable pixel_perfect when the line from path_stroke and the silhouette must match exactly.
  • Standard PP cleanup uses pp_mode. For a closed path with pp_closed_cross enabled, pp_closed_side is used instead.
  • Use path_fill when you need a colored fill image instead of white.

Related nodes

  • mask / mask_boolean โ€” use or further combine the mask
  • mask_scatter โ€” use it as an area
  • path_fill โ€” when you need a colored fill
  • path_reverse โ€” control holes under NonZero

Fill rules

Mode Description
Union / Fill all Fills a point if it is inside any closed path. This is the basic mode for simply overlapping shapes.
EvenOdd / Cut out the inside Alternates fill and cutout on every overlap. Suited to hollow centers such as doughnuts or frames.
NonZero / Determine holes by direction Uses path direction to determine whether an area is filled or cut out. An advanced mode for drawing outer boundaries and holes explicitly.

Pixel perfect

  • Off: builds the mask from the normal outline.
  • On: builds the mask from the same PP-corrected outline as Path Stroke.

Enable it when the appearance of Path Stroke must match the filled silhouette.

Algorithm

  1. For closed subpaths only, obtain the outline pixel sequence with rasterize_subpath.
  2. Treat all subpaths as one face and test the center of every pixel with fill_rule to determine inside/outside.
  3. Draw white (1,1,1,1) in the fill area and outline, leaving everything else transparent.

Examples

Create a mask from a path

[Multi Path] โ†’ path โ†’ [Path Mask(fill_rule:Union)] โ†’ [Preview]

Clip an image to a path shape

[Pixel Canvas] โ†’ source โ†’ [Mask] โ†’ [Preview]
                         โ†‘
               [Path Mask] โ†’ mask

Define an area for surface scattering

[Multi Path] โ†’ [Path Mask] โ†’ [Mask Scatter]

Notes

  • Open subpaths are ignored.
  • If there is no closed subpath, or no Path is connected, the result is transparent.
  • Unlike PathFill, this treats multiple subpaths together as one face.
  • The output is a white + alpha image intended for use with the Mask node.
  • Use Union / Fill all when overlapping areas should remain filled.
Back to Node List
Path Mask โ€” PixPipeline Node Reference