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

Sobel Module (Bending)

Make a layer see only its own edges

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

    A sobel filter is the classic image-processing edge detector - it highlights where brightness changes sharply. Sobel Module (Bending) does that to a layer's feature maps: every activation map flowing through your target gets replaced by its own edges before the next layer sees it. The result is a bend that strips spatial content down to outlines, and the network downstream has to reconstruct from an edge-only description of the features it was expecting.

    That makes this the "line art" module of the pack, and one of the most visually legible bends you can do - instead of an abstract smear you get something that reads like a contour drawing the model is forced to color back in. It's a BENDING_MODULE factory for ComfyUI-Model-Bending: one boolean in, a BENDING_MODULE out, consumed by the Model Bending / VAE Bending / LoRA Bending nodes.

    The one input

    • normalized (BOOLEAN, default true) - whether the sobel output is normalized.

    This is the kornia filters.sobel(normalized=...) operation. Normalized gives you gradient magnitude in a comparable range (what you want for most bends, because it keeps magnitudes sane); unnormalized keeps raw response magnitudes, which get spikier and more destructive. Start with true on.

    How to use it

    The most reliable trick: put a Sobel Module (Bending) on a mid- or early-decoder layer via Model Bending (SD Layers), keep normalized = true, and watch the image start looking like it was drawn from contours - objects hold their edges while their interiors wash out into texture. Then feed that edge-heavy description back through by stacking a second bend downstream, and you'll see the model invent interior detail from the outline. It's a fast route to "etched" or "woodcut" looks that a prompt alone won't reliably give you.

    One genuinely useful pattern: use it as an ablation probe on a LoRA. A LoRA that's mostly about detail will visibly lose its character when its weights are sobel'd; a LoRA that's mostly about composition won't care. That's a fun way to fingerprint what a LoRA actually encodes.

    Installing

    Part of the pack:

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

    Restart ComfyUI and refresh, or install via ComfyUI Manager (search ComfyUI-Model-Bending). Deps: kornia + scikit-learn, no model files. Clone folder should stay ComfyUI-Model-Bending despite the README's stale ComfyUI-Web-Bend-Demo snippet.

    Where people get tripped up

    Sobel is destructive by construction - the output is an edge map, not the original features, so don't expect "stronger edges in my image." You're replacing the layer's output wholesale, and the image only indirectly responds as the downstream network compensates. With normalized = false you'll frequently blow past useful into pure noise; keep the checkbox on until you know why you're turning it off. And on layers near the very start of the UNet, where activations are small and already noisy, the edge map can just dominate and wash everything gray - move the target deeper if that happens.

    Categorymodel_bending

    Inputs (1)

    NameTypeDefaultDescription
    normalizedBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    BENDING_MODULEBENDING_MODULE