Nodes/ComfyUI-DiT360/Apply Circular Padding VAE
ComfyUI Node

Apply Circular Padding VAE

Make the VAE itself understand that left meets right

By cedarconnor·Created 10 months ago·Updated 9 months ago· 3
Apply Circular Padding VAE
  • vae
  • vae
inplacetrue
x_axis_onlytrue

360° VAE Decode fixes the seam by wrapping the latent before decode. Apply Circular Padding VAE attacks the same problem one level deeper: it patches the VAE's own Conv2d layers so every convolution inside the decoder uses circular padding on the X axis. That means when the decoder is painting the right edge, its kernels actually see the left edge's pixels - the seam gets corrected at the source instead of being blended away afterward.

Inputs:

  • vae - from a VAELoader. This is the VAE you'll then wire into 360° VAE Decode (or any decode node).
  • inplace (default true) - patch the loaded VAE directly (fast, low memory) or deep-copy it first. Use False only if one workflow needs both a patched and an unpatched VAE at the same time.
  • x_axis_only (default true) - circular on X only, which is correct for equirectangular. The tooltip notes that circular on both X and Y is generally not recommended - wrapping vertically would let the poles wrap into each other, which makes no sense for a sphere.

Output is a patched vae, ready to plug into your decode. Mechanically it's the same Conv2d-forward trick the ComfyUI_pytorch360convert pack uses: circular padding on X, constant (zero) padding on Y, applied manually before the convolution. It's a VAE-side-only change, so it can't break sampling - only decoding.

The gotcha, and it's a big one: if you patch the VAE here, set Equirect360VAEDecode.circular_padding to 0. The tooltip says it explicitly, the README repeats it, and it's the #1 way people get doubled, mushy edges with this pack. Pick one seam strategy per layer - decoder-internal (this node) or pre-decode padding (the decode node) - not both.

Install

Same as the whole pack - Manager (search "ComfyUI-DiT360"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/cedarconnor/ComfyUI-DiT360
cd ComfyUI-DiT360
pip install -r requirements.txt

then restart. Nothing heavy in requirements.txt (numpy, Pillow). Models: FLUX.1-dev in models/checkpoints, DiT360 LoRA (~2–5GB) from Insta360-Research on Hugging Face in models/loras, strength 1.0.

Troubleshooting

  • Doubled or soft edges → you're double-padding; zero the decode node's circular_padding.
  • Seam still there → pair this with sampler circular padding and the Edge Blender. A decoder patch alone rarely fixes a big seam.
  • Need both a patched and stock VAE in one graphinplace = False. It costs memory, so don't leave it on out of habit.

Honest take: this is a set-and-forget node once you've internalized the double-padding rule - patch the VAE, zero the decode padding, and the decoder stops being a seam factory. If you decode only once per workflow it's arguably cleaner than decode-side padding, because it can't leave padding artifacts in your output.

CategoryDiT360/vae

Inputs (3)

NameTypeDefaultDescription
vaeVAEConnect the VAE to patch (from VAELoader). If used, set 360° VAE Decode circular_padding to 0 to avoid double-padding.
inplaceBOOLEANtrueModify the loaded VAE (True) or a deep-copied VAE (False). Recommended: True (faster/less memory). Use False only if you need both patched and unpatched VAEs in one workflow.
x_axis_onlyBOOLEANtrueApply circular padding only on X (recommended for equirectangular) or on both X and Y (generally not recommended).

Outputs (1)

NameTypeDescription
vaeVAE