Nodes/ComfyUI Model Bending/Dilation Module (Bending)
ComfyUI Node

Dilation Module (Bending)

Inflate a layer's signal, watch structure blur

By abuzreq·Created about a year ago·Updated 3 months ago· 21
Dilation Module (Bending)
    • BENDING_MODULE
    kernel_size3

    Morphological dilation is a classic image-processing operation - it grows bright regions, filling holes and fattening shapes. Applied to a model's activations instead of a photo, it does something weirder: it pushes the layer's output toward its local maxima, effectively inflating whatever pattern that layer detects. In the Model Bending pack, that turns into a one-knob way to make a layer's features "blob out" - texture collapses toward structure, fine detail gets eaten, and the image takes on a melted, posterized personality.

    It's a BENDING_MODULE builder, so it does nothing on its own: wire the module into Model Bending, Model Bending (SD Layers), or Model VAE Bending and it gets injected at the layer you choose. Under the hood the module calls kornia's morphology.dilation with a square kernel of ones - that's where the pack's kornia dependency comes in, and it's why you can't just delete the requirements and hope.

    The single input is kernel_size, default 3, range 1–10. It's the size of the dilation window, and it's your whole personality knob: 1 is basically identity, 3 is the gentle default, and by 7–10 you're dissolving the layer's finer responses into fat, smoothed blobs. At shallow UNet layers that reads as a stylized soft-focus; in the middle block it can shift composition wholesale.

    The pairing that's genuinely fun: dilation and erosion are opposites, and the pack ships both. Chain an Erosion Module (Bending) at one layer and a Dilation Module (Bending) at another and you get a morphological "push-pull" - some features shrink, others swell. It's a cheap way to see how differently two layers interpret the same image.

    Install: ComfyUI Manager → search "ComfyUI-Model-Bending" → install → restart and refresh. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/abuzreq/ComfyUI-Model-Bending
    

    then pip install -r requirements.txt if your environment didn't pick up kornia (it's required for this node; Manager handles it automatically).

    The realistic caveat: dilation operates per-channel on 4D activations, and at high kernel sizes on late UNet layers it can collapse the image into almost pure noise-blobs that no longer decode into anything. Which is fine if you're hunting for surreal output - it's part of the toy's charm - but start at 3, sample, and only then go big.

    Categorymodel_bending

    Inputs (1)

    NameTypeDefaultDescription
    kernel_sizeINT31–10

    Outputs (1)

    NameTypeDescription
    BENDING_MODULEBENDING_MODULE