ComfyUI Node

Equirectangular To Cubemap (Flexible)

Cubemaps in dice, strip, or stack — pick your poison

By cedarconnor·Created about a year ago·Updated 7 months ago· 2
Equirectangular To Cubemap (Flexible)
  • image
  • cubemap
face_size512
cube_formatatlas_3x2
face_orderF,R,B,L,U,D
interpolationlanczos

The plain Equirectangular → Cubemap (3x2) node gives you one layout, full stop. This one gives you five. If you've ever opened a 360° panorama and thought "I wish this were a dice cross in Photoshop," this is your node.

Equirectangular To Cubemap (Flexible) converts a panorama into a cubemap in any of these formats:

  • atlas_3x2 - the standard 3×2 grid, same as the non-flexible node.
  • dice - the six faces unfolded into a cross. This is the layout people paint in Photoshop and Substance: the cross shape maps to how you'd wrap a cube's texture.
  • horizon - the faces laid out in a horizontal strip. Nice for eyeballing all six sides side by side, or for feeding a strip-based tool.
  • stack - faces stacked vertically, a B*6 batch. This is the one to pick when you want to process the faces as a batched tensor (each face is a separate frame to ComfyUI) and unstack them later with the pack's Split/Stack face nodes. list and dict are listed as options but are aliases of stack for ComfyUI compatibility.

The face_order string (default F,R,B,L,U,D, i.e. front, right, back, left, up, down) controls the order of faces in horizon and stack. It also accepts full words (front,right,...) if that reads better than initials. For atlas_3x2 and dice the order is fixed, so face_order is ignored there.

How it works

Same rendering engine as the rest of the pack: each face is built by inverse-mapping - every pixel of the face is traced back to a latitude/longitude on the sphere and sampled from the source with OpenCV cv2.remap and BORDER_WRAP for clean wraparound. The only difference from the non-flexible node is how the rendered faces get packed into the output image, which is where cube_format earns its keep.

Inputs that matter

  • image (required) - the equirectangular tensor (B,H,W,C) in [0,1].
  • face_size - pixels per face, default 512, up to 4096.
  • cube_format - the layout, default atlas_3x2.
  • face_order - only matters for horizon/stack/list/dict, as above. Get it wrong and the stack is scrambled, but at least it's your scramble to fix with a matching string on the way back in.
  • interpolation - lanczos default; keep it for the geometry resampling.

Output is a single cubemap IMAGE in the format you picked.

Installing it

ComfyUI 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. Found under LatLong/Cubemap. Deps: numpy, opencv-python, scipy, torch, Pillow - no model files.

Gotchas

The flexible formats are a commitment. Once you output a stack, only another flexible node (or the pack's Stack/Split helpers) can read it back meaningfully - the plain 3×2 converter will treat it as an atlas and give you nonsense. Keep track of the face_order you used, because there's no metadata embedded in the image; you have to feed the same order back into the Flexible To-Equirectangular node to reconstruct your panorama.

CategoryLatLong/Cubemap

Inputs (5)

NameTypeDefaultDescription
imageIMAGEEquirectangular input image tensor (B,H,W,C) in [0,1].
face_sizeoptINT51216–4096Resolution (pixels) per cube face.
cube_formatoptCOMBOatlas_3x2Output cubemap layout: 3x2 atlas, dice cross, horizon strip, or stack (B*6 faces). Note: list/dict are aliases of stack for ComfyUI compatibility.
face_orderoptSTRINGF,R,B,L,U,DFace order for stack/horizon (and list/dict alias) formats. Tokens: F,R,B,L,U,D (also accepts front/right/back/left/up/down). Example: 'F,R,B,L,U,D'.
interpolationoptCOMBOlanczosResampling filter used during face generation.

Outputs (1)

NameTypeDescription
cubemapIMAGE