Nodes/ComfyUI-MiniMaxH3-PerRowMasking/MiniMax H3 Mask Grid Preview & Snap
ComfyUI Node

MiniMax H3 Mask Grid Preview & Snap

See the exact 32x32 cells MiniMax H3 will edit before you burn a render

By ethanfel·Created 2 months ago·Updated 2 months ago· 1
MiniMax H3 Mask Grid Preview & Snap
  • image
  • mask
  • snapped_mask
  • grid_preview
  • grid_info
cell_selection
cell_adjust0
overlay_opacity0.38
show_gridtrue
show_source_outlinetrue

The problem this node solves isn't drawing a mask - it's that MiniMax H3 never edits where your mask says, exactly. H3's DiT doesn't regenerate freeform pixels. It works on a coarse 2x2 latent patch grid stacked on top of a 16x VAE downscale, which means every unit it can flip on or off covers roughly a 32x32 block of source pixels. A thin SAM3 scribble down someone's shirt can quietly become a solid 32-pixel column of regeneration. MiniMax H3 Mask Grid Preview & Snap is the node that shows you exactly which of those cells your mask actually turns on, before you spend GPU time discovering it the expensive way.

What it does

Feed it the resized H3 canvas frames you're about to VAE-encode (image) and any standard ComfyUI mask (mask) - SAM3 Detect, SAM3 Track to Mask, a painted mask, whatever. It snaps the mask onto H3's 32x32 cell grid, draws the result back over your video as an orange overlay with cyan cell lines, and hands you a snapped_mask that's guaranteed to line up with what the sampler will actually do.

The snap mode matters, and this is where the pack earns its keep. Runtime exact (latent max) is the default and the honest one: it reproduces the exact resize-to-16x-latent-then-per-row-max decision H3 makes during sampling, so what you see is what you get. The other modes - any / 50% / full pixel coverage - decide cells by counting direct pixel hits instead, and are there when you deliberately want broader or more conservative selection.

One real gotcha the README calls out: because runtime-exact shrinks the mask down to the 16x latent before choosing, a tiny isolated SAM3 mark can vanish entirely before cell selection. If every marked source pixel must force its full 32x32 cell on, switch to any pixel coverage.

Inputs and outputs that matter

Beyond image, mask, and cell_selection, you mostly touch two things:

  • cell_adjust (INT, -8 to 8) - grow or shrink the selection by whole 32x32 cells. Positive expands; negative contracts.
  • overlay_opacity / show_grid / show_source_outline - purely cosmetic controls for the preview. The last one draws your original mask boundary in white so you can see how far the snap wandered.

Outputs: snapped_mask (MASK) feeds straight into MiniMax H3 Set Generation Mask; grid_preview (IMAGE) is what you stare at; grid_info (STRING) gives you a per-frame cell count plus grid geometry if you're automating.

One alignment rule you can't skip: both image dimensions must be divisible by 32, or the node stops with a clear error rather than showing you a misaligned grid. The frames you pass in have to be the exact canvas that gets VAE-encoded - resizing them after this node invalidates the preview.

Installing

Part of the ethanfel/ComfyUI-MiniMaxH3-PerRowMasking pack, which ships three siblings (the patch, the set-generation-mask, and the source trimmer) that you'll want anyway for the full workflow. ComfyUI Manager search for ComfyUI-MiniMaxH3-PerRowMasking, or:

cd ComfyUI/custom_nodes
git clone https://github.com/ethanfel/ComfyUI-MiniMaxH3-PerRowMasking.git

Then restart ComfyUI. No extra Python packages - the pack leans entirely on what ComfyUI already ships.

Where it sits

This is a preview-and-verify node, not a processing step. In the pack's example workflow it runs off the same trimmed, resized frames that branch to the VAE encode, so the preview and the actual generation see identical geometry. That ordering is the whole trick: check the grid, eyeball whether the snapped selection matches what you meant to change, adjust cell_adjust if not, and only then run the sampler. Fifteen seconds of looking beats fifteen minutes of rerolling.

Categorylatent/mask/minimax

Inputs (7)

NameTypeDefaultDescription
imageIMAGEThe exact resized H3 canvas frames that will be VAE-encoded. Width and height must be divisible by 32 so the displayed cells align with H3.
maskMASKConnect SAM3 Detect, SAM3 Track to Mask, a painted mask, or any standard ComfyUI MASK. White is treated as the requested generation area.
cell_selectionCOMBORuntime exact reproduces H3's latent resize and per-row max decision. Other modes select cells from direct pixel coverage and can be more or less conservative.
cell_adjustINT0-8–8Grow with positive values or shrink with negative values, measured in complete 32x32 H3 cells.
overlay_opacityFLOAT0.380–1Opacity of the orange generated-cell overlay.
show_gridBOOLEANtrueDraw cyan boundaries for every 32x32 H3 cell.
show_source_outlineBOOLEANtrueDraw the original SAM3 or input-mask boundary in white.

Outputs (3)

NameTypeDescription
snapped_maskMASK
grid_previewIMAGE
grid_infoSTRING