Equirectangular → Cubemap (3x2)
Turn a 360° panorama into a 3x2 cubemap atlas
- image
- cubemap_atlas
If you've got an equirectangular panorama and you need it to play nice with a game engine, a VR runtime, or a texture-painting tool, it has to become a cubemap first. That's the whole job of Equirectangular → Cubemap (3x2): it takes your 2:1 360° image and re-projects it into six square faces packed into a single 3×2 atlas - top row left, front, right; bottom row back, top, bottom.
Why go through the trouble? Equirectangular is how 360° photos and ComfyUI latents live, but it's a lousy format for most 3D pipelines. Cubemaps store the sphere as six flat-looking planes with much less distortion per face, which is why they're the default interchange format everywhere from Blender to web viewers. Converting also gives you clean squares to work on: each face is a normal image you can upscale, inpaint, or run through a face-fixing pass, then hand back to Cubemap (3x2) → Equirectangular when you want a panorama again.
How it works
The node renders each face by inverse mapping. It computes, for every pixel of each face, the view direction that pixel represents, converts that to latitude/longitude on the sphere, and samples the equirectangular image with OpenCV's cv2.remap using BORDER_WRAP - so when you look past the left edge you wrap around to the right instead of hitting black. Because it samples from the source rather than painting into the destination, the faces line up cleanly and you don't get the stretched, doubled garbage that naive forward projection produces.
Inputs and outputs
image(required) - the equirectangular tensor, (B,H,W,C) in [0,1].face_size- resolution of each face in pixels, default 512, range 16–4096. This is the knob that decides whether the atlas is 3072×2048 (512) or 6144×4096 (1024). Crank it up if you're going to do detail work on the faces.layout- currently only3x2. It's there for future layouts; the Flexible variant is where the real format choices live.interpolation-lanczosdefault. For a geometric re-projection like this, keep it: it's the difference between crisp edges and a soft smear, especially at the poles.
Output is a single cubemap_atlas IMAGE. Wire it to Save Image, into an upscaler, or straight into the matching To-Equirectangular node for a round trip.
Installing it
The pack installs like any ComfyUI custom node - ComfyUI Manager, search "LatLong", or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/cedarconnor/comfyui-LatLong
cd comfyui-LatLong
pip install -r requirements.txt
Restart ComfyUI. Dependencies: numpy, opencv-python, scipy, torch, Pillow. No model downloads. It shows up under the LatLong menu.
Gotchas
Watch the face order, because it's the one thing that can silently wreck a downstream tool. This pack uses top row left/front/right, bottom row back/top/bottom - that's the common convention, but not the only one in the wild. If the atlas looks fine in ComfyUI but comes out scrambled in the thing you're feeding, check whether that tool expects a different order (or use Cubemap Faces Extract to get labeled faces and assemble the layout yourself).
And a gentle reminder: the top and bottom faces are where your panorama's least-detailed regions live. If the poles were smeared in the source, they'll be smeared here too - upscaling a cubemap face doesn't resurrect detail the projection never captured.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Equirectangular input image tensor (B,H,W,C) in [0,1]. | |
| face_sizeopt | INT | 51216–4096 | Resolution (pixels) per cube face. |
| layoutopt | COMBO | 3x2 | Output atlas layout (currently 3x2). |
| interpolationopt | COMBO | lanczos | Resampling filter used during face generation. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| cubemap_atlas | IMAGE | — |