Back to Node List

Mask Scatter

mask_scatter

Places one or more weighted stamps on eligible mask pixels, with spacing, anchor, draw-order, wrap, and appearance controls

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
マスク
mask
Image
Required
スタンプの中心位置を選ぶマスクです。スタンプ本体は範囲外へはみ出す場合があります
スタンプ
stamp
Image
各点に配置する画像(未接続時は1pxドット)
スタンプ候補
stamps
List<Image>
配置ごとに選ぶ画像のリストです。接続すると単一の「スタンプ」入力より優先されます
候補の出やすさ
weights
List<Float>
各スタンプ候補の出やすさです。0でその候補を除外し、未接続なら全候補を同じ確率で使います

Output Ports

NameTypeDescription
画像
output
Image
生成された分散画像

Parameters

NameTypeDefaultRangeDescription / Options
count
Int
161–4096

配置するオブジェクト数

シード
seed
Int
00–99999

配置を再現するための乱数シード

配置
placement
Enum
Random

密集も起こるランダム配置か、中心間隔を保証する配置かを選びます

  • ランダムRandom
    従来どおり完全ランダムに置きます。近い位置へ固まる場合があります
  • 間隔を空けるKeepApart
    近すぎる中心を除外します。草・星・石・木の節を均等すぎず自然に散らす時に向きます
中心の最小間隔
min_distance
Float
41–512 / step 0.5

中心同士を何px以上離すかです。重なりを減らすならスタンプ幅前後から始め、個数が置けない時は下げます

左右をつなぐ
wrap_x
Bool
false

はみ出したスタンプ画素を反対側へ回します。「間隔を空ける」では左右端越しの中心間隔にも適用されます。シームレスタイル向けです

上下をつなぐ
wrap_y
Bool
false

はみ出したスタンプ画素を反対側へ回します。「間隔を空ける」では上下端越しの中心間隔にも適用されます。シームレスタイル向けです

しきい値
threshold
Float
0.50–1 / step 0.01

配置対象として扱う最小マスク値

重なり順
draw_order
Enum
GenerationOrder

スタンプが重なった部分で、どちらを手前に描くかを決めます

  • 生成順GenerationOrder
    シードから決まる生成順で重ねます。既存プロジェクトと同じ結果を保つ時はこちらです
  • 上から下BackToFrontY
    基準点が上の物から描き、下の物ほど手前に見せます。草・木・キャラクターの重なりに向きます
配置の基準点
anchor
Enum
Center

スタンプ内のどの点を、選ばれたマスク画素へ合わせるかを決めます

  • 中央Center
    画像の中央を配置点に合わせます。既存プロジェクトと同じ動作です
  • 下中央BottomCenter
    画像の下中央を配置点に合わせます。足元・幹・草の根元・小物を地面に揃える時に使います
  • 指定位置Custom
    画像左上から数えた画素位置を配置点に合わせます
基準点X
anchor_x
Int
00–4096

スタンプ左上から数えた横方向の画素位置です。0が最初の画素で、画像外の値は端へ丸められます

基準点Y
anchor_y
Int
00–4096

スタンプ左上から数えた縦方向の画素位置です。0が最初の画素で、画像外の値は端へ丸められます

Alphaを使う
alpha_enabled
Bool
true

マスクの明るさではなくアルファを使って判定

反転
invert
Bool
false

マスクの反対側の領域に分散配置

color
Color
[1,1,1,1]

スタンプ未接続時のドット色

ランダム反転
random_flip
Bool
false

スタンプごとにランダムで左右・上下反転します

ランダム回転
random_rotate
Bool
false

スタンプごとに90°単位でランダム回転します

大きさのばらつき
scale_jitter
Float
00–1 / step 0.05

スタンプごとの大きさのばらつきです(0で全部同じ大きさ)

明るさのばらつき
brightness_jitter
Float
00–1 / step 0.05

スタンプごとの明るさのばらつきです(0で全部同じ明るさ)

Overview

Places stamps on pixels that pass a mask threshold. It can repeat one image or mix several candidates at ratios such as grass A 70 / grass B 20 / flower 10. Center spacing, ground anchors, Y draw order, and tile-edge wrapping are handled together.

Usage tips

  • Start with placement=Random when occasional clusters are desirable. Switch to KeepApart only when grass, stars, or stones bunch up too heavily. Existing projects remain on Random and keep their previous result.
  • min_distance measures center-to-center pixels. Around 3px lightly reduces clusters; around the stamp width greatly reduces overlap. If the node warns that Count did not fit, lower the gap or enlarge the mask area.
  • Connect List Create(Image) to Stamp Candidates and an equally sized List Create(Float) to Candidate Weights. Leave weights disconnected for equal chances, or use 0 to exclude one candidate.
  • For grass, trees, or characters, combine anchor=BottomCenter with draw_order=BackToFrontY. Roots and feet land on the mask point while lower objects naturally cover higher ones.
  • For seamless tiles, enable wrap_x / wrap_y. Overflow pixels continue on the opposite edge, and Keep Apart also measures center gaps across that seam.
  • Variation parameters are the key to a natural result. random_flip with scale_jitter around 0.3 and brightness_jitter around 0.2 removes the copied look. Random Flip includes vertical flips, so leave it off for grass or characters whose base must remain upright.
  • The range mask determines the effect. Use path_mask to place grass on the shape of the ground, or threshold a coordinates Y gradient to limit placement to an upper or lower region.
  • Mask values are not density weights. Every candidate that passes the threshold has the same selection probability. Set alpha_enabled=false to use RGB brightness.
  • Drive seed with seed_range to compare different scattering patterns.
  • With no stamp connected, the node uses a 1px dot. That is often enough for stars or gravel.
  • Changing only the weights does not change positions, flips, rotations, or sizes, so material ratios can be compared on the same composition.

Related nodes

  • path_mask — the go-to way to define the scatter area
  • seed_range / variant_select — generate different scatter patterns
  • blend — composite the scattered result over a background
  • path_array — regular placement along a path instead of random scattering

How to use

  • Basic use

    • Connect the Path Mask output to mask.
    • Set the amount with count.
    • Change seed to change the distribution.
  • Avoid clusters

    • Change placement to KeepApart.
    • Try min_distance=3–5 for small stars or gravel, or roughly the stamp width for grass and wood knots.
    • On tiles, wrap_x / wrap_y makes centers across opposite edges count as neighbors and continues overflow stamp pixels on the opposite side.
  • Mix several appearances

    • Connect an image list to stamps and a list of the same length to weights.
    • [7, 2, 1] means roughly 70% / 20% / 10%; the values do not need to sum to 100.
    • Length mismatch, negative values, and all-zero weights are errors. Zero is useful for temporarily excluding one candidate.
  • Threshold

    • 0.5 places stamps where the mask value is at least half.
    • A white + alpha mask such as Path Mask works as-is.
    • Values above the threshold do not receive a higher selection probability.
  • Invert

    • When enabled, stamps are placed on the unfilled side.

Examples

Combine with Path Mask

[Multi Path] → [Path Mask] → mask → [Mask Scatter] → [Preview]

Scatter dots without a connected stamp

[Path Mask] → [Mask Scatter(count:32, color:white)] → [Preview]

Use any mask image

[Pixel Canvas] → mask → [Mask Scatter]

Create a natural cluster with variation

When batch-producing grass, stones, stars, or similar assets from one stamp:

[grass stamp] → stamp → [Mask Scatter(random_flip:on, scale_jitter:0.4, brightness_jitter:0.3)]

The same seed always produces the same result (deterministic).

Scatter two grass variants and a flower from their bases

[grass A] ─┐
[grass B] ─┼→ [List Create(Image)] → stamps ┐
[flower]  ─┘                                ├→ [Mask Scatter(anchor:BottomCenter,
[7,2,1] → [List Create(Float)] → weights ───┘               draw_order:BackToFrontY)]

Notes

  • Two stamps are never assigned the same center pixel.
  • The stamp images themselves can overlap.
  • KeepApart guarantees center spacing, not footprint separation. Large, wide, or scale-jittered stamps can still overlap when larger than min_distance.
  • If all requested stamps do not fit, the node outputs those that fit and shows a warning on min_distance.
  • Only the center is guaranteed to lie inside the mask. A larger stamp footprint can extend outside it.
  • The output dimensions match the input mask image.
  • All variation is derived deterministically from seed.
  • When Stamp Candidates is connected, it takes priority over the single Stamp input.
Back to Node List
Mask Scatter — PixPipeline Node Reference