Studio Yotsuba
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

Input Ports

NameTypeDescription
Mask
mask
Image
Required
Mask used to select stamp centers; the stamp footprint may extend past it
Stamp
stamp
Image
Image to place at each selected point (1px dot if not connected)
Stamp Candidates
stamps
List<Image>
Images chosen per placement. When connected, this list takes priority over the single Stamp input
Candidate Weights
weights
List<Float>
Relative chance for each Stamp Candidate. Use 0 to exclude one; leave disconnected for equal chances

Output Ports

NameTypeDescription
Image
output
Image
Generated scatter image

Parameters

NameTypeDefaultRangeDescription / Options
Count
count
Int
161–4096

Number of objects to place

Seed
seed
Int
00–99999

Random seed for reproducible placement

Placement
placement
Enum
Random—

Choose random clustering or placement with a guaranteed center gap

  • RandomRandom
    Keep the familiar fully random placement; nearby stamps may cluster
  • KeepApartKeepApart
    Reject centers that are too close; useful for grass, stars, stones, and wood knots
Minimum Center Gap
min_distance
Float
41–512 / step 0.5

Minimum center-to-center gap in pixels. Start around the stamp width to reduce overlap; lower it if fewer than Count fit

Wrap X
wrap_x
Bool
false—

Continue stamp pixels across the left and right edges. Keep Apart also measures center gaps across this seam; enable for seamless tiles

Wrap Y
wrap_y
Bool
false—

Continue stamp pixels across the top and bottom edges. Keep Apart also measures center gaps across this seam; enable for seamless tiles

Threshold
threshold
Float
0.50–1 / step 0.01

Minimum mask value required for placement

Draw Order
draw_order
Enum
GenerationOrder—

Controls which stamp covers another where they overlap

  • GenerationOrderGenerationOrder
    Keep the seeded generation order; use this to preserve existing project output
  • BackToFrontYBackToFrontY
    Draw higher anchors first so lower objects appear in front; useful for grass, trees, and characters
Anchor
anchor
Enum
Center—

Point in each stamp aligned to the selected mask pixel

  • CenterCenter
    Place each stamp by its center; matches existing project behavior
  • BottomCenterBottomCenter
    Place the bottom center on the mask point; useful for feet, trunks, grass roots, and props
  • CustomCustom
    Use a pixel coordinate measured from the stamp's top-left corner
Anchor X
anchor_x
Int
00–4096

horizontal pixel coordinate from the stamp's top-left. 0 is the first pixel; values outside a candidate are clamped to its edge

Anchor Y
anchor_y
Int
00–4096

vertical pixel coordinate from the stamp's top-left. 0 is the first pixel; values outside a candidate are clamped to its edge

Use Alpha
alpha_enabled
Bool
true—

Use the mask alpha channel instead of brightness

Invert
invert
Bool
false—

Scatter in the opposite area of the mask

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

Dot color when the stamp input is not connected

Random Flip
random_flip
Bool
false—

Randomly flip each stamp horizontally or vertically

Random Rotate
random_rotate
Bool
false—

Randomly rotate each stamp in 90° steps

Scale Jitter
scale_jitter
Float
00–1 / step 0.05

Random size variation per stamp (0 = uniform size)

Brightness Jitter
brightness_jitter
Float
00–1 / step 0.05

Random brightness variation per stamp (0 = uniform)

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