Nodes/ComfyUi-MpiNodes/Mpi Wrap Soften
ComfyUI Node

Mpi Wrap Soften

Blur the pano's 1px seam in the sky and leave the trees alone

By MadPonyInteractive·Created about a year ago·Updated about 7 hours ago· 4
Mpi Wrap Soften
  • image
  • IMAGE
◄sigma12.0►
◄radius48►
◄threshold6.0►

Some 360 panos have a hard one-pixel line where the last column meets the first. It usually comes from a stitch or a re-encode: the wrap is the same place in the world, but the pixels either side of it disagree by a few levels, and there's a step.

On its own a 1px step is nearly invisible. The problem is what happens next. Run a seam-joining pass, or a tiled refiner with overlap, and that sharp step gets averaged across the boundary - and a 1px line turns into a soft but clearly visible light ridge. You've swapped one artifact for a bigger one.

MpiWrapSoften fixes it before that pass: blur the step across the wrap, but only in flat areas.

How it works

The image is rolled so the wrap sits at the middle column, a horizontal Gaussian (radius 3σ) is applied with a wrap-around kernel, and it's rolled back. That blur is then blended in with a smoothstep weight that is 1 at the wrap and ramps to 0 by ±radius pixels, so nothing further than 3σ + radius + 32 px from the wrap is touched at all.

The interesting part is threshold, and it's the reason this node exists rather than a plain blur. The decision is made on a σ=2-smoothed copy of the image: soften only where the blur changes things by less than threshold/2 levels, ramping to 0 at the threshold itself. Paper grain and smooth skies move under a blur, so they qualify. A cloud edge or a tree branch that the wrap cuts through does not - and that mask is then eroded 8 pixels and softened again, so the whole neighbourhood around a real edge is excluded, not just the edge itself.

Which is right. Blurring across a real edge is exactly the wrong call: it smears structure that a later pass should be joining rather than averaging. threshold 0 turns the check off and softens everywhere along the wrap.

Inputs and outputs

  • image - a 360 pano whose left and right edges meet.
  • sigma - horizontal blur width across the wrap, in pixels. Default 12, range 0.5–64.
  • radius - blend width each side of the wrap, pixels. Default 48, range 1–512.
  • threshold - soften only where the blur changes less than this many levels. Default 6, range 0–64.

One output: IMAGE.

The 12 / 48 / 6 defaults aren't arbitrary - the source comments record them as the values signed off on the bench for a 2K anime-sharp pano pass. Start there; only go wider if the line survives.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
# restart ComfyUI

No weights. The maths runs in 0..255 levels (it converts in and back out), so on a 16-bit source you're working in 8-bit steps.

Where people get burned

It's for a line at the wrap, not a general seam fixer. If your problem is that two renders disagree after an upscale, that's MpiWrapCutMerge; if it's that your upscaler left a hairline because it had no context across the join, pad first with MpiWrapPad and you may not need this at all.

Turn the threshold down and you'll soften real detail at the seam. That's the trade the widget makes explicit: 0 means "blur everything within radius of the wrap", including a horizon line or a building edge that crosses the join.

Run it before the seam pass, not after. Softening a ridge you've already created is harder and looks different - the whole point is that the following pass should see a gentle ramp rather than a step.

CategoryMpiNodes/Scene

Inputs (4)

NameTypeDefaultDescription
imageIMAGEA 360 pano whose left and right edges meet.
sigmaFLOAT12.00.5–64Horizontal blur across the wrap, px.
radiusINT481–512Blend width each side of the wrap, px.
thresholdFLOAT6.00–64Soften only where the blur changes less than this many levels (flat sky); 0 = soften everywhere along the wrap.

Outputs (1)

NameTypeDescription
IMAGEIMAGE—