Nodes/MKRShift_Nodes/Texture Weave Pattern
ComfyUI Node

Texture Weave Pattern

Cloth, not 'AI fabric' — a procedural weave with real thread structure

By criskb·Created 7 months ago·Updated 5 months ago· 0
Texture Weave Pattern
    • image
    • mask
    • weave_info
    settings_json{"width":1024,"height":1024,"style":"plain","warp_scale_px":32.0,"weft_scale_px":32.0,"thread_width":0.72,"relief":0.82,"fiber_variation":0.22,"contrast":1.2,"balance":0.0,"invert":false,"seed":79}

    Fabric is one of those materials where the AI tell is obvious: it looks like a soft painting of cloth, not like interlocked threads. If you need an actual weave - with warp and weft, thread relief, and a structure that reads when lit - Texture Weave Pattern is the procedural answer. It draws the cloth itself, and like every generator in this pack it tiles, which is exactly what you want for a fabric texture.

    How it works

    procedural_weave_pattern builds a proper loom structure: a warp (vertical threads) and a weft (horizontal threads) that pass over and under each other. warp_scale_px and weft_scale_px set the thread spacing in each direction - keep them equal for square-weave cloth, or differ them for a ribbed textile. thread_width controls how much of each cell is thread versus gap, and relief is the important one: it lifts the over-threads above the under-threads, which is what turns a flat checkerboard into something that catches light like real fabric. fiber_variation adds subtle noise along the threads so they don't read as perfectly uniform plastic yarn.

    Three style options change the weave: plain (the classic over-under grid, default), twill (the diagonal offset you see in denim and herringbone), and basket (pairs of threads woven together for a coarser, more open cloth). All wrapped value noise in numpy, deterministic on seed, seamless by construction.

    The inputs that matter

    Everything in one settings_json text box - pack convention is JSON, not sliders. Defaults are runnable; you'll edit:

    • style - plain / twill / basket
    • warp_scale_px and weft_scale_px - thread spacing per direction
    • thread_width and relief - how much thread and how much lift (relief is the one that makes it look like cloth)
    • fiber_variation - thread roughness
    • seed - new texture
    • contrast / balance / invert

    Outputs: image (grayscale as RGB), mask (single channel - the relief output is a natural bump/height feed), and weave_info with resolved settings.

    Installing it

    Ships in MKRShift Nodes from criskb. ComfyUI Manager → search "MKRShift Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/criskb/MKRShift_Nodes
    

    Restart ComfyUI; it's under MKRShift Nodes → Surface → Texture. No models or pip extras - numpy/Pillow/torch only.

    Common gotchas

    The pack has no community footprint yet, so the code is your reference. The standard traps: malformed settings_json silently falls back to defaults, and out-of-range values clamp silently. For fabric, resist the urge to max relief - past about 0.85 the threads start to look like corrugated cardboard, not cloth. And if your weave looks too regular and synthetic, that's fiber_variation doing too little; nudge it up before you chase anything else.

    CategoryMKRShift Nodes/Surface/Texture

    Inputs (1)

    NameTypeDefaultDescription
    settings_jsonSTRING{"width":1024,"height":1024,"style":"plain","warp_scale_px":32.0,"weft_scale_px":32.0,"thread_width":0.72,"relief":0.82,"fiber_variation":0.22,"contrast":1.2,"balance":0.0,"invert":false,"seed":79}

    Outputs (3)

    NameTypeDescription
    imageIMAGE
    maskMASK
    weave_infoSTRING