Nodes/comfyui-stable-materials/Load StableMaterials
ComfyUI Node

Load StableMaterials

The one node every workflow in this pack starts with

By P5ina·Created 7 months ago·Updated 7 months ago· 1
Load StableMaterials
    • pipeline
    mode

    Every workflow in comfyui-stable-materials starts here, and not just out of habit: the two generate nodes don't hide a model behind a convenience widget the way a typical ComfyUI pack does. They demand a pipeline input, and this node is the only thing that makes one. Load StableMaterials is the pack's entry point - it pulls the actual diffusion model into VRAM and hands you a handle you feed to Generate PBR (Text) or Generate PBR (Image).

    The model behind it is StableMaterials by Giuseppe Vecchio, loaded through HuggingFace's diffusers library. It's a diffusion model trained on the MatSynth dataset that outputs five physically-based rendering (PBR) maps at once: basecolor, normal, height, roughness, and metallic. If you've come from the image-to-3D side of ComfyUI, PBR is the same concept that makes Hunyuan3D 2.1 and TRELLIS.2 textures relightable - the material ships as separate channels a game engine or renderer can light, not one baked image.

    One input, two modes

    The entire config surface is a single enum, mode:

    • LCM (4 steps, fast) - the default you want for iterating. Roughly 2 seconds per generation on a 4090.
    • Standard (50 steps, quality) - the full sampling schedule when you've settled on a material and want the best result.

    Reading the source, the mode switch is doing real work. In LCM mode it loads the unet_lcm subfolder of the model repo and swaps in an LCMScheduler; in standard mode it loads the full pipeline. Both use trust_remote_code=True because StableMaterials ships custom pipeline code, not just weights.

    The catch nobody mentions: the cache

    The pipeline is cached globally per mode. That's great - generate once, reuse cheaply. But it means the first run in a session does the heavy lifting: ComfyUI reaches out to HuggingFace, downloads the model, and loads it. The README doesn't shout about this, so plan for a long first generation.

    The sneaky part: if you switch mode on the loader, the old pipeline is deleted and torch.cuda.empty_cache() is called before the new one loads. Expect a VRAM spike and a pause. If you run both an LCM and a standard graph in one session, you'll pay the load cost twice. My advice: pick a mode and stick with it for a session.

    The output is a single pipeline of type SM_PIPELINE - it doesn't do anything on its own, it just feeds the generate nodes.

    Install

    The README recommends ComfyUI Manager: search for "StableMaterials" and install. Manual install is the usual two steps:

    cd ComfyUI/custom_nodes
    git clone https://github.com/P5ina/comfyui-stable-materials.git
    cd comfyui-stable-materials
    pip install -r requirements.txt
    

    Then restart ComfyUI. Requirements are thin: diffusers, transformers, and accelerate - nothing exotic, which is refreshing. The model itself downloads to your HuggingFace cache on first use (a few GB), not to models/, and it needs HF reachable. The repo is MIT; the model is OpenRAIL, so commercial use of generated materials is fine.

    Where people get burned

    Because the model uses trust_remote_code, an old or mismatched diffusers version can throw on load - if the pipeline errors at the loader, update the three requirements first. And if generation is slow on your first try, check you're actually in LCM mode; standard mode at 50 steps is meant to be slow.

    CategoryStableMaterials

    Inputs (1)

    NameTypeDefaultDescription
    modeCOMBO2 options: LCM (4 steps, fast), Standard (50 steps, quality)

    Outputs (1)

    NameTypeDescription
    pipelineSM_PIPELINE