Nodes/ComfyUI_pytorch360convert/Equirectangular to Cubemap
ComfyUI Node

Equirectangular to Cubemap

The Swiss Army node of the 360 toolkit — turn a spherical panorama into six flat faces

By ProGamerGov·Created 2 years ago·Updated 11 months ago· 37
Equirectangular to Cubemap
  • e_img
  • Cubemap Image
face_width-1
padding_modebilinear
cube_formatstack

If you've ever tried to generate a 360 panorama, you already know the problem this node solves. A normal SD model has no idea what an equirectangular image is - it thinks the poles are weird stretched blobs and the left and right edges are two separate worlds. The fix that everyone lands on is the same one game engines have used for thirty years: split the sphere into a cubemap, work on the six flat faces, then stitch back.

Equirectangular to Cubemap (E2C) is the first half of that. It takes one equirectangular image and remaps it into the six square faces - Front, Right, Back, Left, Up, Down - of a cubemap. It's part of Ben Egan's (ProGamerGov's) ComfyUI_pytorch360convert pack, which wraps his pytorch360convert library as ComfyUI nodes, and it's the node most of the pack's workflows start from. If you got here from a 360 HDRI or skybox workflow, this is probably the first node you wire up.

How it works

Under the hood it calls e2c from pytorch360convert, which does the classic projection remap: for every pixel in each cube face it figures out which point on the sphere that pixel sees, then samples the equirectangular image there (bilinear by default). It's a pure tensor operation - differentiable, runs on GPU or CPU, and needs no model files. Nothing downloads; it's math.

The inputs that matter:

  • e_img - your equirectangular image (a IMAGE tensor, batch of 1 - the node asserts a batch size of 1, so don't feed it a batch).
  • face_width - the edge length of each cube face in pixels. Default -1 means "use half the image height," which is the standard choice for a 2:1 equirect. Set it explicitly if you want bigger or smaller faces.
  • cube_format - the layout of the output. stack (default) gives you the standard 3×2 grid you see in skybox workflows. dice unrolls into a strip, horizon is a horizontal strip, list and dict are for piping faces into other nodes in this pack (like Split Cubemap Faces or the per-face conversion nodes). If you're doing per-face processing, dict is your friend because the faces come back labeled.
  • padding_mode - bilinear, bicubic, or nearest. Bilinear is fine for almost everything; bicubic is marginally crisper but slower and can ring on sharp edges.

The single output is Cubemap Image, a six-batch IMAGE.

Why you'd actually reach for it

The whole reason to bother: once a panorama is a cubemap, each face is a normal flat image with uniform distortion. That means ControlNet works, inpainting works, and upscalers work on faces without fighting the pole stretching. People use this pack to upscale each face, regenerate the nadir (Down) face to fix a missing tripod hole, or inpaint the seam where the panorama wraps around. Work on the faces, then hand them to Cubemap to Equirectangular to get a pano back.

Install and gotchas

Install the pack via ComfyUI Manager (search "ComfyUI_pytorch360convert" or paste the GitHub URL), or cd ComfyUI/custom_nodes && git clone https://github.com/ProGamerGov/ComfyUI_pytorch360convert and restart. One real gotcha: the pack's requirements.txt is empty, so Manager won't pull in the pytorch360convert dependency for you. If the node errors on import, run python -m pip install pytorch360convert in your ComfyUI Python environment. No model files are involved.

Two things to know before you wire it up. First, the round trip E2C → C2E is lossy - converting back and forth degrades quality slightly, which is exactly why this pack ships a Masked Diff C2E node to limit the damage. Second, a cubemap won't preview as a 360 in ComfyUI's image viewer (you'll see the six-face grid); the author's separate ComfyUI_preview360panorama pack gives you a proper draggable 360 preview.

Categorypytorch360convert/equirectangular

Inputs (4)

NameTypeDefaultDescription
e_imgIMAGE
face_widthINT-1
padding_modeCOMBObilinear3 options: bilinear, bicubic, nearest
cube_formatCOMBOstack5 options: stack, dice, horizon, list, dict

Outputs (1)

NameTypeDescription
Cubemap ImageIMAGE