ComfyUI Node

Create Pole Mask

Mask the top and bottom of your 360°

By cedarconnor·Created about a year ago·Updated 7 months ago· 2
Create Pole Mask
  • image
  • pole_mask
circle_radius0.10
pixel_radius0
feather0
modeface
face_size512

The poles are where equirectangular projection lies to you. The top and bottom of a 360° panorama are tiny patches of the sphere stretched across the whole image width, so whatever the camera saw straight up or down - usually a smeared ceiling or a soft bit of floor - is the lowest-quality region in the whole frame. Create Pole Mask is the node that lets you target exactly those regions for an inpaint pass.

Think of it as the seam mask's sibling, pointed at a different problem. The seam mask handles the vertical wrap; this one handles the poles, and it does it in two modes depending on where you're working:

  • face mode - makes a centered circle mask on a single cubemap face. This is for when you're working with cube faces (the top and bottom faces of a cubemap are where the poles live as circles in the middle of the square).
  • equirectangular mode - the clever one. It creates the circular pole masks on the Up and Down cube faces first, then maps those masks back into equirectangular space. That gives you a pole mask that correctly targets the stretched pole regions inside your panorama - the right shape for inpainting the top and bottom bands of a 2:1 image.

How it works

The circle is defined by a radius and an optional feather:

  • circle_radius (default 0.10) - radius as a fraction of the max possible (min(H,W)/2).
  • pixel_radius (default 0) - exact radius in pixels; overrides circle_radius if greater than 0.
  • feather (default 0) - softens the circle's edge by that many pixels.

In face mode the input image must be a square face (H==W) - the node raises an error otherwise, which is its way of telling you you've fed it the wrong thing. In equirectangular mode you also get face_size (optional, default 512) to pick the cube-face resolution used to generate the pole mask; set it to −1 for auto (H/2 of your panorama).

Output is a single pole_mask, mask-convention-standard: 1 = regenerate, 0 = keep.

Installing it

Standard pack install - Manager search "LatLong", or:

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

Restart ComfyUI. Under LatLong/Mask. Deps: numpy, opencv-python, scipy, torch, Pillow; no model downloads.

Gotchas

The mode mismatch is the classic stumble. If you feed an equirectangular panorama (2:1, not square) into face mode, the node refuses with a "square faces expected" error - that's the signal to switch modes, not to crop your image to a square. And don't expect magic: even a perfectly targeted pole mask can't make a model invent detail the source never had. The pole region is genuinely low-information, so pair the inpaint with a prompt that describes plausible sky/ceiling, or accept some smoothness at the top and bottom - that's the honest cost of the 360° format.

CategoryLatLong/Mask

Inputs (6)

NameTypeDefaultDescription
imageIMAGEReference IMAGE (face or equirectangular) used to size the mask.
circle_radiusFLOAT0.100–1Circle radius as a fraction of the max possible radius (min(H,W)/2). Ignored if pixel_radius > 0.
pixel_radiusINT00–8192Circle radius in pixels (overrides circle_radius if > 0).
featherINT00–4096Feather width in pixels.
modeCOMBOfaceface: mask matches input face dimensions. equirectangular: creates masks on Up/Down cube faces then maps back to equirectangular.
face_sizeoptINT512-1–4096Only used for mode=equirectangular. Cubemap face size to generate the pole mask. Set to -1 for auto (H//2).

Outputs (1)

NameTypeDescription
pole_maskMASK