If your workflow uses VAEEncodeForInpaint, its documented output is a LATENT that includes both the encoded representation and a noise mask. You generally do not need to add SetLatentNoiseMask merely because its name mentions a noise mask. Use the separate node when you have latent samples and a MASK to apply explicitly, and can identify why that is the intended route. The decisive check is where the mask enters the graph, not how many mask-related nodes appear.
Trace the mask and choose a route
The official VAEEncodeForInpaint documentation lists pixels (IMAGE), vae (VAE), mask (MASK), and grow_mask_by (INT) as inputs. Its output is one latent (LATENT), described as containing the encoded image representation and a noise mask. The mask therefore enters this route at the inpainting encoder.
By contrast, SetLatentNoiseMask accepts samples (LATENT) and mask (MASK), then outputs modified latent samples. Its interface is an explicit way to apply a supplied mask to latent samples; the documentation does not say that it is required after VAEEncodeForInpaint, nor that the two nodes are interchangeable.
Use this ordered check before wiring:
- Identify the node creating the latent that will feed the next stage. Read its actual input and output type labels; node colors are only a visual clue.
- Trace the inpainting
MASKupstream. If it entersVAEEncodeForInpaint, note that the encoder output already carries the documented noise mask. - Inspect the next node’s expected input and the graph’s intended mask source. Do not insert another mask operation unless you have a separate
MASKyou intend to apply tosamples. - If using
SetLatentNoiseMask, verify that itssamplesinput is the latent you intend to modify and that itsmaskinput is the intended mask. Follow itslatentoutput downstream.
Record the route before accepting it
This hypothetical worksheet uses two different paths to make the mask source visible. The observations are graph-inspection notes, not a claim about generation results or guaranteed output behavior.
| Hypothetical path and observed connections | Mask source and application point | Decision |
|---|---|---|
Path A: IMAGE and MASK connect to VAEEncodeForInpaint; its LATENT goes downstream | The encoder receives the mask; its output is documented to include a noise mask | Do not add SetLatentNoiseMask solely to repeat the same mask route |
Path B: a separate latent source connects to SetLatentNoiseMask.samples; a separately chosen MASK connects to .mask | The explicit node applies that supplied mask to those samples | Keep this route when the workflow intentionally needs that mask applied there |
| Unclear path: the graph has two mask inputs, but their upstream sources or intended roles are unknown | The available connections do not establish whether the masks are duplicates or serve different purposes | Pause and label each source and intended application point before deciding |
When filling your own worksheet, write the upstream node or image for each MASK, not just “mask.” Record which latent the mask is intended to affect and which LATENT output continues downstream. This makes duplicated or misrouted branches easier to spot.
Limits and next steps when unclear
The node pages describe input and output contracts; they do not specify every downstream sampler’s behavior, a universal mask convention, or a formula for how grow_mask_by changes mask dimensions. Do not infer pixel meanings, mask resizing, or a guaranteed improvement from these descriptions alone. Keep those questions separate from the connection decision.
If the graph has an independent MASK and latent source, but you cannot establish whether the mask belongs in the encoder or at SetLatentNoiseMask, clarify the intended route before proceeding. If a downstream node shows an incompatible type, recheck the actual labels and connector assignments. The documentation cited here does not establish a universal required next node, so choose the next stage according to the workflow you are building.
Three quick questions
Does the encoder output a separate `MASK` socket? Its documentation lists one LATENT output; that output is described as including the noise mask. Do not look for an additional output based on the description alone.
Can I connect another mask anyway? The separate node accepts a mask and latent samples, but the documentation does not establish that reapplying the same mask after the encoder is necessary or beneficial. Decide from the mask’s intended source and application point.
When is `SetLatentNoiseMask` useful? When you deliberately have latent samples and a MASK to apply to them. Its role follows from that interface, not from its name being similar to the inpainting encoder.
Sources and next step
- VAEEncodeForInpaint - ComfyUI Built-in Node Documentation
- SetLatentNoiseMask - ComfyUI Built-in Node Documentation
This guide interprets public documentation and uses explicitly hypothetical acceptance examples, not application tests. Controls and availability can change; verify the cited manual against your installed version.
For work created in Imagild, carry the input requirements and acceptance checklist into the photo editor. The external software controls discussed above belong to their respective products.