Equirectangular to Cubemap
Turn a 360° HDRI into six cubemap faces, DirectX order, in one node
- image
- pos_x
- neg_x
- pos_y
- neg_y
- pos_z
- neg_z
You download a gorgeous 360° HDRI for reflections, and your engine wants it as a cubemap, not a panorama. Equirectangular to Cubemap converts a 2:1 equirectangular image into six separate cubemap faces in DirectX order, and its natural partner is the pack's Cubemap Assembler, which packs those six faces into a single .dds file. Together they're a two-node "HDRI → game-ready environment map" pipeline.
This is a genuinely nice workflow: most people end up converting equirect HDRIs with an external tool or a one-off script, and here it's a node you can drag into any workflow.
How it works
The node renders each of the six cube faces by projecting rays from the center of the cube and sampling the equirectangular image accordingly - standard cubemap extraction math, done in numpy. The outputs follow the DirectX convention, which is what the Cubemap Assembler expects:
pos_x(+X, Right),neg_x(−X, Left)pos_y(+Y, Top),neg_y(−Y, Bottom)pos_z(+Z, Front),neg_z(−Z, Back)
Inputs and outputs
image- the equirectangular panorama. The tooltip calls out the 2:1 aspect ratio for a full 360×180; feed it anything else and the projection will be distorted.face_size- output size per face, with Auto (width / 4) as the sane default plus explicit 128 → 8192 options. Auto is what you want 95% of the time: a 4K panorama gives you 1024px faces.
Six IMAGE outputs (pos_x, neg_x, pos_y, neg_y, pos_z, neg_z) - wire them in matching order into Cubemap Assembler.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/lilquail/ComfyUI-Leputen-Utils
Restart ComfyUI, find it under Leputen-Utils → DDS. Pure numpy math, so unlike the DDS save/load nodes it works fine on any platform - no texconv dependency for the conversion itself.
Troubleshooting
- Distorted faces - the input isn't 2:1. Crop/resize to exactly 2:1 before converting.
- Faces are swapped/rotated in-engine - check your engine's cubemap convention. This node outputs DirectX order; if your engine uses OpenGL order, the Top/Bottom (Y) faces are flipped vertically. That's a "convert after export" problem, not a node bug.
- HDR values preserved? - the math operates on whatever the input tensor carries. If you loaded the HDRI as a tone-mapped 8-bit PNG, the output faces are tone-mapped too. Load the EXR (this pack's Load Image (Leputen) handles EXR) if you want true HDR values in the cubemap.
The pairing with Cubemap Assembler is the part that's easy to miss: convert here, assemble to BC6H_UF16 Linear there, and you've got a proper HDR environment map for your engine without ever opening a texture tool.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Equirectangular panorama image (2:1 aspect ratio for full 360x180). | |
| face_size | COMBO | 1024 | Output size for each cubemap face. Auto = width / 4. |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| pos_x | IMAGE | +X face (Right) |
| neg_x | IMAGE | -X face (Left) |
| pos_y | IMAGE | +Y face (Top) |
| neg_y | IMAGE | -Y face (Bottom) |
| pos_z | IMAGE | +Z face (Front) |
| neg_z | IMAGE | -Z face (Back) |