Nodes/ComfyUI_Mira/Random Nested Layouts
ComfyUI Node

Random Nested Layouts

Roll a random nested-box layout

By mirabarukaso·Created 2 years ago·Updated 9 days ago· 206
Random Nested Layouts
  • rnd_seed
  • layout
  • top
  • bottom
  • left
  • right
min_nested1
max_nested2
min_weights1.0
max_weights2.0

The nested-mask counterpart to RandomTillingLayouts. Instead of rolling a grid, it rolls a random Layout string for Create Nested PNG Mask - the node that builds concentric rectangles radiating from a center point. Handy when you're batch-exploring nested compositions (a subject in the middle, context rings around it) and don't want to hand-type the layout every time.

Nested masks are a different flavor of regional prompting. Regional prompting is the standard fix for attribute bleed - two subjects in one prompt swapping features because conditioning paints the whole canvas - and where tiling splits it into a grid, nesting stacks regions inside each other. That's a natural shape for a centered figure with a distinct background, or for the watermark-removal use case the author originally built it around.

How it works

You give it a range for how many nested levels you want and a range for the weight of each level, plus a seed. It composes a nested layout string within those bounds. On top of the string, it also rolls four booleans - top, bottom, left, right - which map to the "unlimit" toggles on Create Nested PNG Mask that let regions extend all the way to an edge instead of staying boxed in. So one node randomizes both the nesting and the directional openness.

The inputs that matter

  • min_nested / max_nested - how many nested levels to generate, as a range (1 to 32 each).
  • min_weights / max_weights - the weight assigned to each nest, controlling how the sizes step. Wider range means more size variation between levels.
  • rnd_seed - the randomness source. As with the tiling generator, the README says to connect a Seed Generator and drive it with Global Seed (Inspire), because ComfyUI's native randomize toggle lags - going from fixed back to randomize takes two Queue Prompts to register.

The outputs

  • layout (STRING) - wire it into the Layout input of Create Nested PNG Mask.
  • top / bottom / left / right (BOOLEAN) - wire each into the matching unlimit toggle on that same node, so the random roll also decides which sides open to the edge.

Installing it

ComfyUI Manager: Manager -> Custom Nodes Manager, search ComfyUI_Mira, Install, restart. Or clone:

cd ComfyUI/custom_nodes
git clone https://github.com/mirabarukaso/ComfyUI_Mira.git

Restart. On a load error, pip install -r requirements.txt inside the folder, then restart. No models. You'll want the Inspire Pack too if you use the Global Seed workflow.

Common issues

Same seed caveat as its tiling sibling, and it's the one that trips everyone: rnd_seed does not reproduce a layout. The README is explicit - you cannot recover the same nesting from the same seed, so if a roll comes out great, capture the actual layout string (and the four booleans) in a ShowText or Notes node. Treat the seed as a shuffle button, not a save slot.

The fixed-to-randomize two-queue lag is ComfyUI's behavior, not this node's fault; Global Seed (Inspire) is the standard workaround.

Also, wire all four boolean outputs, not just the layout. If you connect the string but leave top/bottom/left/right unconnected, the nested mask uses its own toggle defaults and the random result won't match what the generator intended.

Support-wise, ComfyUI_Mira is a niche one-person pack (the author is better known for the WAI Character Select app), so lean on the README - its nested-mask examples show how the layout string and the unlimit sides combine into the final shape.

CategoryMira/Util

Inputs (5)

NameTypeDefaultDescription
min_nestedINT11–32
max_nestedINT21–32
min_weightsFLOAT1.00.1–10
max_weightsFLOAT2.01–10
rnd_seed*00–18446744073709550000

Outputs (5)

NameTypeDescription
layoutSTRING
topBOOLEAN
bottomBOOLEAN
leftBOOLEAN
rightBOOLEAN