Equirectangular Mask to Face
Bring your inpaint mask along when you pull a face out of the pano
- mask
- Face MASK
The problem with doing mask work in equirectangular space is that your mask has to live in the same distorted projection as the image - a circle you draw on a pano's Down face becomes a weird stretched blob when the pano is flat, and the coordinates never line up the way you expect. The clean solution is to do your masked editing on a flat cube face instead, where a circle is a circle. Equirectangular Mask to Face is the node that drags your existing mask along with the image when you make that move.
It's the mask-tensor twin of Equirectangular to Face. The image node pulls a single face out of the pano; this one pulls the mask out of the same pano, using the same projection. That way your mask and your face image stay in perfect alignment no matter how many times you convert.
How it works
It takes a MASK tensor (equirectangular-shaped), converts it to a cubemap via e2c from pytorch360convert, and returns whichever face you ask for. Inputs:
- mask - your equirectangular mask.
- face_width - face edge size in pixels, default
-1(half the image height). - cube_face - which face to extract:
Up,Down,Right,Left,Front,Back(defaultFront). - padding_mode - sampling mode, bilinear default.
Output is Face MASK, the same region re-projected onto a flat square.
Why it matters
Alignment. If you hand-drew a mask on the equirect pano and then separately extracted the face image, the two wouldn't match up - the projection distorts both, and any mismatch means your inpaint covers the wrong region or, worse, leaks outside the area you meant to protect. Doing the extraction through the same code path keeps them lockstep: extract image and mask with matching settings, and the mask lines up with the face's geometry by construction.
The practical flow: mask the pole region in equirectangular space (or use the pack's Create Pole Mask), convert both the face image and the mask with this node, inpaint on the flat face, then send the edited face and mask back through Face Mask to Equirectangular and Face to Equirectangular. Feather the mask (Create Pole Mask and friends have feather inputs) so the round trip doesn't leave a hard edge.
Gotchas
The cube_face you extract must match the face you extracted the image with - mismatch and you'll be inpaint-masking the wrong wall. And masks are resampled during conversion, so they come out slightly softened around edges; that's normal, and usually harmless (a soft mask edge is often better for inpainting anyway).
Install
Standard pack install: ComfyUI Manager → "ComfyUI_pytorch360convert", or git clone https://github.com/ProGamerGov/ComfyUI_pytorch360convert into ComfyUI/custom_nodes and restart. The requirements.txt is empty, so python -m pip install pytorch360convert is usually needed by hand. No model downloads.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| face_width | INT | -1 | — |
| padding_mode | COMBO | bilinear | 3 options: bilinear, bicubic, nearest |
| cube_face | COMBO | Front | 6 options: Up, Down, Right, Left, Front, Back |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Face MASK | MASK | — |