Nodes/ComfyUI-MiniMaxH3-Contex-Loop/MiniMax H3 Masking · Grid Preview
ComfyUI Node

MiniMax H3 Masking · Grid Preview

Your H3 inpaint mask is lying to you — snap it to the real grid

By ethanfel·Created 17 days ago·Updated about 18 hours ago· 315
MiniMax H3 Masking · Grid Preview
  • image
  • mask
  • snapped_mask
  • grid_preview
  • grid_info
cell_selectionruntime exact (latent max)
cell_adjust0
preview_frame0
overlay_opacity0.38
show_gridtrue
show_source_outlinetrue
mask_meaningwhite = generate

MiniMax H3 doesn't denoise at your mask's resolution. Its video VAE downsamples the canvas into 32×32 source-pixel cells, and the mask you carefully painted freehand gets reduced through that latent stack - which doesn't always mean the pixels you intended get regenerated. This node is the one that shows you exactly what H3 will actually treat as "generate" and lets you snap your mask to it. If you've ever had an H3 inpaint silently regenerate a strip you painted as preserved (or the reverse), this is why, and this is the fix.

What it does

MiniMaxH3ContexMaskGridPreview takes your exact H3 canvas (the resized image whose width and height are divisible by 32) and your mask, then snaps the mask to H3's effective causal 32×32 cell grid. The snapped_mask output is what you feed into Apply Target Mask so the "regenerate here" region you see on screen is the region that actually regenerates.

You get three knobs that matter:

  • cell_selection - runtime exact (latent max) matches H3's actual latent reduction. The coverage modes (any pixel, 50%, full) are deliberate conservative/strict alternatives for when you want to be sure a cell regenerates only if it's really inside your paint.
  • cell_adjust - grows or shrinks the region by whole 32×32 cells, from −8 to +8. Handy when H3's latent math eats the thin edges of your stroke.
  • mask_meaning - white = generate or white = preserve. Use the same convention here as on Apply Target Mask, or you'll chase ghosts.

The rest is inspection: preview_frame picks which frame the overlay shows (the snapped MASK output still carries the whole batch), overlay_opacity controls the orange overlay, and show_grid / show_source_outline draw the cell grid and the outline of your original unsnapped mask so you can see the difference. grid_info is a text summary of frame, grid dimensions, and coverage.

Where it fits

This is a prep node for the pack's masked-editing path. In a Masked Video Inpaint workflow you'll see the chain Loop Mask Slice → this grid preview → Apply Target Mask → sample. Paint your mask, wire the canvas in, check the overlay, adjust with cell_adjust if the snap ate anything, and hand the snapped mask downstream. It's purely a transformation plus a preview - nothing here touches the latent itself, so you can preview and iterate without burning a sample.

Install and gotchas

Same as the rest of the pack:

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

Restart ComfyUI. You can also use ComfyUI Manager and search "MiniMax H3 Contex Loop". There's no pip step - the pack rides on ComfyUI's own environment, but it needs a current ComfyUI build with the native "Add Guide for MiniMax H3" support (ComfyUI PR #15439), and ffmpeg on PATH is preferred. Models aren't bundled: you bring the MiniMax H3 weights yourself, which means checking the MiniMax H3 Community License - it excludes the US, EU, UK and South Korea from the local-weights path.

The one trap: the image input must be the exact resized H3 canvas, not your original source file. Feed it whatever resolution the video VAE is actually working at, and make sure both dimensions are divisible by 32 - the node will tell you if you're off.

Categoryconditioning/minimax/contex_loop/masking

Inputs (9)

NameTypeDefaultDescription
imageIMAGEExact resized H3 canvas used by the video VAE. Width and height must be divisible by 32.
maskMASKStatic or tracked ComfyUI mask interpreted using mask_meaning.
cell_selectionCOMBOruntime exact (latent max)Runtime exact matches H3 latent reduction. Coverage modes provide deliberate conservative or strict alternatives.
cell_adjustINT0-8–8Grow or shrink by complete 32x32 H3 cells.
preview_frameINT00–10000Frame displayed by grid_preview. The snapped MASK output still contains the complete batch.
overlay_opacityFLOAT0.380–1Opacity of the orange snapped-generation overlay in grid_preview.
show_gridBOOLEANtrueDraw the effective 32x32 H3 source-pixel cell grid over the preview.
show_source_outlineBOOLEANtrueOutline the original unsnapped mask so its difference from the effective mask is visible.
mask_meaningoptCOMBOwhite = generateUse the same white-pixel convention here and on Apply Target Mask. The overlay always shows the effective generation region.

Outputs (3)

NameTypeDescription
snapped_maskMASKComplete mask batch snapped to H3's effective causal 32x32 source-pixel cells, using the selected white-pixel convention.
grid_previewIMAGESelected source frame with the snapped mask and optional grid or source outline overlaid.
grid_infoSTRINGSummary of the selected frame, grid dimensions, and snapped-mask coverage.