ComfyUI Node

Cubemap To Equirectangular (Flexible)

Convert any cubemap layout back to a panorama

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

The plain Cubemap (3x2) → Equirectangular node only accepts one specific atlas layout. This Flexible version accepts several, which matters the moment your cubemap didn't come out of this pack. Did you paint the six faces as a dice cross in Photoshop? Generate a horizontal strip in some other tool? Need to feed a stacked face batch back through? This is the node that reads all of them.

It's the ingest half of the pack's "flexible" cubemap story. The flexible pair exists so you're not locked into the 3×2 atlas convention - you can convert to whatever layout your downstream tool wants, and convert back from whatever you get. list and dict are also listed as options, but they're aliases of stack for ComfyUI compatibility, so don't go looking for JSON semantics there.

How it works

Mechanically it's the same inverse remap as the non-flexible version: each output pixel is traced back to a cube face and sampled. The difference is in the unpacking step before that - the node has to know where each face sits in whatever layout you hand it. That's the whole job of cube_format and face_order:

  • atlas_3x2 - the standard 3×2 grid (top: left, front, right; bottom: back, top, bottom). Fixed face order, face_order ignored.
  • dice - the six faces unfolded into a cross.
  • horizon - a horizontal strip of faces, order controlled by face_order.
  • stack (and its aliases list/dict) - faces stacked vertically as a B*6 batch, order controlled by face_order.

Inputs that matter

  • cubemap (required) - your cubemap IMAGE in whatever layout you declare.
  • cube_format - default atlas_3x2; switch it to match the layout you actually have.
  • face_order - default F,R,B,L,U,D. This is a string of face tokens and it only applies to horizon, stack, list, and dict. The tokens are F, R, B, L, U, D (front, right, back, left, up, down), and the parser also accepts the full words if that's clearer. Wrong order in = scrambled faces out, and there's no way for the node to know.
  • output_width (2048) / output_height (1024) - target panorama size; keep 2:1.
  • interpolation - lanczos default, and it's the right one for a resampling-heavy operation like this.

Output is a single equirectangular_image, ready for the rest of the LatLong pipeline.

Installing it

Same install as the whole pack - 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. This node lives under the LatLong/Cubemap submenu. Dependencies: numpy, opencv-python, scipy, torch, Pillow. No models to fetch.

Gotchas

The number one mistake is leaving cube_format on atlas_3x2 while feeding it a dice cross. The node will happily read the first faces it finds in the wrong places and hand you back a panorama that looks like a Jackson Pollock of your own scene.

Second: face_order is easy to forget because it's buried in the optional inputs, and a stack's order is invisible until you convert it. If you generated the stack with this pack's own Flexible To-Cubemap node, note the order that node wrote it with - the default is F,R,B,L,U,D on both sides, so round-trips just work as long as you don't touch one side and not the other.

CategoryLatLong/Cubemap

Inputs (6)

NameTypeDefaultDescription
cubemapIMAGECubemap input tensor. Use cube_format=atlas_3x2/dice/horizon for packed layouts, or stack/list/dict (alias) for face stacks (B*6 faces).
cube_formatoptCOMBOatlas_3x2How to interpret the input cubemap. 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. Must match how the cubemap was packed.
output_widthoptINT2048256–8192Width of output equirectangular panorama (typically 2x height for standard 2:1 ratio).
output_heightoptINT1024128–4096Height of output equirectangular panorama.
interpolationoptCOMBOlanczosResampling quality when mapping cubemap -> equirectangular.

Outputs (1)

NameTypeDescription
equirectangular_imageIMAGE