Nodes/ComfyUI-Leputen-Utils/Load Cubemap Faces
ComfyUI Node

Load Cubemap Faces

Load cubemap faces without hunting through folders

By lilquail·Created 9 months ago·Updated 9 months ago· 1
Load Cubemap Faces
    • pos_x
    • neg_x
    • pos_y
    • neg_y
    • pos_z
    • neg_z
    directory
    base_patterncubemap
    alpha_bleedfalse
    blur_radius0.0

    A cubemap is six flat images pretending to be a sphere: one face for each direction (right, left, top, bottom, front, back), pinned to a point in space and rendered outward. Games use them for skyboxes, reflections, and IBL lighting. If you're generating game textures in ComfyUI, at some point you'll have six face PNGs in a folder and need them in a specific order. Load Cubemap Faces finds them by filename, loads all six in one shot, and hands them to you as separate tensors - no dragging six Load Image nodes into your graph.

    It's the front half of the pack's skybox pipeline: Load Cubemap Faces feeds Cubemap Assembler, which stitches the six faces into a single DDS cubemap with compression and mipmaps, then Save DDS Image writes it in an engine-ready format. Even if you never touch DDS, getting six named outputs from one node instead of six wired-by-hand loaders is worth it alone.

    How it works

    The node scans the folder you point at and matches filenames against a set of face-suffix conventions. All matching is case-insensitive, and it understands the common dialects:

    • Axis: _px, _nx, _py, _ny, _pz, _nz
    • Direction: _right, _left, _top, _bottom, _front, _back
    • Index: _0 through _5
    • Blender style: _posx, _negx, _posy, _negy, _posz, _negz

    So sky_px.png, sky_right.jpg, and sky_0.png all resolve correctly - even mixed together. If a face is missing, it errors out and tells you exactly which one, which is far better than silently loading a broken skybox. Mismatched face sizes get resized (Lanczos) to match the first face loaded, so a slightly-off texture won't kill the assembler downstream.

    The inputs that matter

    Only two required inputs, and both are obvious:

    • directory - the folder with the six faces. The node validates it exists before you run anything, so a typo gets caught early.
    • base_pattern - the common filename prefix. sky matches sky_px.png, sky_right.jpg, etc. Leave it empty and it'll match any file with a face suffix, which is great in a dedicated folder and dangerous in a busy one.

    The optional pair - alpha_bleed and blur_radius - exist to fix the classic transparent-texture halo: it pushes edge pixels outward so you don't get a bright rim around an alpha'd texture in-engine. Leave them off for skybox faces (they're mostly opaque) and turn them on for textures with transparency.

    Outputs are the six faces as IMAGE tensors, named pos_x through neg_z (with tooltips telling you which is which: +X is Right, +Y is Top, -Z is Back). Wire them into Cubemap Assembler in matching order and you're done.

    Install

    Leputen Utils is a game-dev texture toolkit by lilquail, a Windows-oriented pack. Install it with ComfyUI Manager (search "ComfyUI-Leputen-Utils") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lilquail/ComfyUI-Leputen-Utils
    

    Restart ComfyUI. It pulls in scipy, opencv-python, onnxruntime, and imageio via requirements.txt, and some sibling nodes auto-clone a DeepBump repo on first boot - but this node is plain PIL/torch loading, so none of the heavy stuff matters for it.

    Where people get burned

    The most common failure is the missing-face error: you've got sky_px.png but the file is sky_pos_x.png with an underscore between pos and x - that still matches, but sky_positive_x.png won't. If it can't find a face, double-check the exact suffix spelling first. And remember the size-resizing is silent - if you wanted exact dimensions, verify your source files agree.

    CategoryLeputen-Utils/DDS

    Inputs (4)

    NameTypeDefaultDescription
    directorySTRINGDirectory containing the cubemap face images.
    base_patternSTRINGcubemapBase filename pattern. E.g., 'sky' matches sky_px.png, sky_right.jpg, etc. Leave empty to match any file with face suffixes.
    alpha_bleedoptBOOLEANfalseApply alpha bleeding to loaded images.
    blur_radiusoptFLOAT0.00–10Blur radius for alpha bleeding.

    Outputs (6)

    NameTypeDescription
    pos_xIMAGE+X face (Right)
    neg_xIMAGE-X face (Left)
    pos_yIMAGE+Y face (Top)
    neg_yIMAGE-Y face (Bottom)
    pos_zIMAGE+Z face (Front)
    neg_zIMAGE-Z face (Back)