Skip to main content

Poisson Disc Sampler

The Distribution Expert. Generates a list of points across a mask while ensuring that no two points are closer than a specified minimum distance.

Ports

PortTypeDescription
Weights FloatThe weight map used to prune candidates and ensure minimum distance.
Mask Bool MaskA hard mask (0/1) defining the valid sampling area.
Points Point ListThe resulting list of non-overlapping coordinates.

Details

This node uses the Poisson Disc Sampling algorithm to create a "blue noise" distribution. This results in points that feel naturally scattered but uniform, avoiding the tight clusters often found in pure random sampling.

Parameters

  • Min Distance: The minimum spacing (in tiles) between any two points.
  • Max Attempts: How many times the algorithm tries to find a neighbor for a point before giving up. Higher values create a more dense, tight pack (default is 30).
  • Point Count: If set to a value greater than 0, the node will randomly prune the final list to match this exact count.

Potential Use Cases

  • Natural Foliage: Generate points with a Min Distance of 3.0 to place trees in a forest. This ensures trees aren't overlapping or clipping into each other.
  • Dungeon Entrance Placement: Use a mask of the "Outer Walls" and sample exactly 1 point to find a valid location for a door.
  • Pickups/Loot: Scatter "Health Packs" across a level with a high Min Distance (e.g., 15.0) to ensure the player has to travel between them.