ComfyUI Node

Cubemap (3x2) → Equirectangular

The return trip, no hassle

By cedarconnor·Created about a year ago·Updated 7 months ago· 2
Cubemap (3x2) → Equirectangular
  • cubemap_atlas
  • equirectangular_image
output_width2048
output_height1024
layout3x2
interpolationlanczos

The Equirectangular → Cubemap (3x2) node turns a panorama into a cubemap. This node is the return flight: give it a 3×2 cubemap atlas and it rebuilds the equirectangular image you started from. If you've ever gone equirect → cubemap → upscale each face → tried to manually glue it back together, you know why this deserves its own page.

The classic reason to reach for it is a round-trip: convert a 360° photo to a 3×2 atlas, run the six faces through a per-face upscaler or a few targeted inpaint passes (they're much easier to work on as flat squares than as one stretched panorama), then drop the atlas back in here to get a proper 2:1 equirectangular for your viewer or VR headset. It also works as the import path if you're bringing in cubemaps built in Blender, a game engine, or one of the many 360° tools that export the 3×2 layout.

How it works

It's the inverse of the To-Cubemap mapping. For every pixel in the output equirectangular image, the node figures out which cube face that viewing direction lands on, then samples the right spot inside that face's square. Like the rest of the pack it does this as an inverse remap via OpenCV (cv2.remap with BORDER_WRAP), which is the "backwards" way of doing it - instead of stretching a face into a warped smear, it looks up where each output pixel comes from, so you don't get the holes and doubling that forward projection produces.

The layout it expects is the one this pack writes: top row left, front, right; bottom row back, top, bottom. Get a cubemap with a different face order and you'll recognize the result instantly - the scene looks scrambled into puzzle pieces.

Inputs and outputs

  • cubemap_atlas (required) - a 3×2 atlas IMAGE. If it came from this pack's To-Cubemap node, you're set.
  • output_width (default 2048) and output_height (default 1024) - the panorama's target size. Keep them 2:1, that's what the equirectangular format assumes.
  • layout - currently only 3x2 exists, so this is a placeholder that says "we know there are other layouts, someday." The Flexible variant is the one that handles more.
  • interpolation - lanczos is the default and the right call for the return trip; you're resampling geometry, so the extra sharpness shows.

Output is a single equirectangular_image, ready to feed the Rotate node, the Edge Blender, or straight to Save Image.

Installing it

Install the whole pack through ComfyUI Manager - search "LatLong" - or do it by hand:

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

Restart ComfyUI and the node appears under the LatLong menu. Requirements are numpy, opencv-python, scipy, torch, and Pillow. No model downloads, no API keys - the "360°" here is pure geometry.

Gotchas

The one thing that'll bite you is face order. This node assumes the atlas matches the pack's [left, front, right / back, top, bottom] convention, and it has no way to detect otherwise. If your cubemap came from a tool with a different order, either reorder the tiles before you feed it in, or use the Flexible variant with a face_order string that matches.

One more: don't expect the round-trip to be lossless. Going equirect → faces → equirect resamples twice, so edges will soften a little even with lanczos. It's fine for upscaling and most workflows; just don't treat it as a byte-identical path back.

CategoryLatLong

Inputs (5)

NameTypeDefaultDescription
cubemap_atlasIMAGEInput cubemap atlas in 3×2 layout from 'Equirectangular → Cubemap' node.
output_widthoptINT2048256–8192Width of output equirectangular panorama (typically 2× height for standard 2:1 ratio).
output_heightoptINT1024128–4096Height of output equirectangular panorama.
layoutoptCOMBO3x2Cubemap layout format (currently only 3×2 supported).
interpolationoptCOMBOlanczosResampling quality: lanczos (highest), bicubic, bilinear, nearest (fastest).

Outputs (1)

NameTypeDescription
equirectangular_imageIMAGE