ComfyUI Node

Pattern Generator

The Pattern Generator that quietly does six jobs behind one 'parameter1'

By orion4d·Created about a year ago·Updated about a year ago· 3
Pattern Generator
    • IMAGE
    width128
    height128
    pattern_typeNoise
    color1_hex#000000
    color2_hex#FFFFFF
    parameter11
    parameter21
    seed0

    The PatternGeneratorNode is the workhorse of the orion4d/illusion_node pack: one node that procedurally generates stripes, a checkerboard, random dots, a solid fill, a gradient, or blocky noise. Default size is a modest 128×128, which tells you what it's really for - making tiles. This is the node that feeds the autostereogram creator its pattern, or produces a quick seamless-ish texture you can tile up with the pack's Tile Image Repeater.

    How it works

    Six pattern_type modes, all computed in numpy/Pillow at the width × height you set. The catch - and it's the one genuinely confusing thing about this node - is that parameter1 and parameter2 mean different things in different modes. The author's tooltips are the Rosetta stone:

    • Stripes - parameter1 is stripe width.
    • Checkerboard - parameter1 is square size.
    • Random Dots - parameter1 is density as a percentage, parameter2 is max dot radius.
    • Solid Color - fills with color1_hex. Parameters ignored.
    • Gradient - parameter1 is direction (0 = left-to-right, 1 = top-to-bottom, 2 = right-to-left, 3 = bottom-to-top).
    • Noise - parameter1 of 0 gives color noise, 1 gives grayscale; parameter2 is the block scale (1 = pixel-level).

    seed drives the randomness in the dots and noise modes, so you can regenerate the same texture.

    The inputs that matter

    • width / height (default 128 each, range 16–4096, step 8): output size.
    • pattern_type (default Noise): the six modes above.
    • color1_hex / color2_hex (default #000000 / #FFFFFF): the two colors.
    • parameter1 / parameter2: mode-dependent, see above.
    • seed (default 0): random source for dots and noise.

    One IMAGE output. The practical sweet spot: generate a busy pattern here and feed it into the autostereogram node as the pattern input - a dense random-dot field is literally what classic Magic Eye images are made of.

    Install

    Ships in orion4d/illusion_node ("ComfyUI Illusion & Pattern Nodes"), all nodes under the "illusion" category. ComfyUI Manager search "Illusion" will find it, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/orion4d/illusion_node.git
    

    Restart ComfyUI afterward. The pack's requirements.txt is numpy, torch, and Pillow - nothing a stock ComfyUI doesn't already have - and there are no model files to fetch.

    Common issues

    Nine times out of ten, confusion here is "I set parameter1 to 10 expecting stripes and got noise" - because the parameter's meaning changes with the mode. Check the tooltip on the widget itself before you panic. Also watch the defaults: the Noise default with parameter2 at 1 gives you pure pixel soup, which is correct behavior, not a bug. If you want chunky blocks instead, raise the block scale. And remember width/height default to 128 - generate up to whatever you need, but the node was designed as a tile factory, so think in tile sizes.

    Categoryillusion

    Inputs (8)

    NameTypeDefaultDescription
    widthINT12816–4096
    heightINT12816–4096
    pattern_typeCOMBONoise6 options: Stripes, Checkerboard, Random Dots, Solid Color, Gradient, Noise
    color1_hexSTRING#000000
    color2_hexSTRING#FFFFFF
    parameter1INT10–256Stripes:width; Dots:density%; Gradient:direction; Noise:0=Color/1=Grayscale
    parameter2INT11–64Dots:max_radius; Noise:block_scale
    seedINT00–4294967295

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE