🔧 VAE Round-Trip
Blame the VAE or the sampler? This node settles the argument
- image
- vae
- mask
- roundtripped
- difference
- mask_overlay
Every outpaint workflow hits the same moment: you extend the canvas, run the sampler, and there's a seam. The instinct is to blame the sampler - adjust denoise, tweak the prompt, cry a little. But sometimes the VAE did it before the sampler ever got a chance. VAERoundTrip is the diagnostic that settles which one.
It comes from elliefox-ai/comfyui-scene-generator, a pack whose whole reason to exist is outpainting seam quality. The author clearly hit the same wall you're hitting and built two diagnostic nodes for it - this one and LatentBoundaryAnalyzer. VAERoundTrip asks the cleanest possible question: if I encode an image to latent and decode it right back with no sampling at all, does it come out wrong? If yes, the VAE is contributing to your seam. If no, the problem is downstream - in the sampler, the conditioning, or the mask.
How it works
The implementation is refreshingly simple - it's almost a test harness rather than a fancy node:
vae.encode(image)- pushes your image into latent space.vae.decode(latent)- pulls it right back out. No denoising, no CFG, no mask processing in between.- Computes the pixel-level difference between input and output, amplified 5× so small shifts are actually visible.
- If you supply a mask, it overlays it on the result: red in the padding region (mask = 1), green in the source region (mask = 0), so you can literally see which zone is degrading.
That's the whole trick. Encode→decode is exactly what happens to your image every time it enters and leaves latent space in a real generation - the roundtrip exposes any color shift, smoothing, or boundary artifact the VAE itself introduces.
Inputs and outputs
- image - the padded image (or any image you suspect is getting mangled).
- vae - the exact VAE from your generation workflow. Testing with a different one tells you nothing about your setup.
- mask - optional, but for outpaint debugging you want it: it's how the node colors the padding vs. source regions.
Outputs: roundtripped (IMAGE - the decoded image), difference (IMAGE - the 5× amplified difference map), and mask_overlay - typed as MASK in the schema but in practice it's the colored overlay visualization, so treat it as another preview, not as a mask you'd feed anywhere.
Installing it
Shared install with the rest of the pack:
cd ComfyUI/custom_nodes/
git clone https://github.com/elliefox-ai/comfyui-scene-generator.git ComfyUI-EllieFoxAI-scene-gen
Restart and it's 🔧 VAE Round-Trip under EllieFoxAI/Diagnostics. ComfyUI Manager works too (search "comfyui-scene-generator"). No Python dependencies, no model downloads - it just needs the VAE already in your graph.
Common issues
- Roundtrip has a color cast - that's the VAE's fault, and it's real information. The community has known this trick for years (it's the same reason face detailers sometimes leave a grey box - a VAE encode/decode cycle shifts color). If your roundtrip is visibly off, try swapping the VAE for the one your checkpoint was trained with; the "best" VAE on the internet is not necessarily the right one.
- Difference map looks alarming - remember it's amplified 5×. Tiny sub-pixel shifts become bright blobs. Use it comparatively (before/after a VAE or feather change), not as an absolute quality score.
- Seam persists but roundtrip is clean - congratulations, you've exonerated the VAE. Go tune the mask feather, the denoise, or the conditioning instead of replacing hardware.
- No mask supplied - you get the decoded image and difference but no colored region split, which makes the output much harder to read for outpaint work. Feed the mask in.
It's a two-minute check that can save you an hour of chasing the wrong culprit. Every outpaint debugging stack should have one of these in it - this one happens to be free, dependency-free, and sitting inside a pack you might already have installed.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| vae | VAE | — | |
| maskopt | MASK | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| roundtripped | IMAGE | — |
| difference | IMAGE | — |
| mask_overlay | MASK | — |