Rotate Module (Bending)
Spin a layer's activations
- BENDING_MODULE
The showcase effect of this whole pack is a rotation. The README opens with a portrait that visibly morphs as the UNet's middle_block.2.out_layers activations are rotated a full 0–360° - and Rotate Module (Bending) is the module that does it. Every activation map flowing through your target layer gets spun by the angle you set, and because those maps carry the image's spatial structure, the rotation shows up as an uncanny, organized distortion instead of noise.
It's a BENDING_MODULE factory: one angle in, one BENDING_MODULE out, ready for Model Bending, the SD Blocks/Layers variants, Model VAE Bending, or LoRA Bending. If the rotation-in-latent-space flavor is what you're after, Latent Operation (Rotate) does a similar trick on latents directly - but for bending a layer's activations, this is the module.
The one input
- angle_degrees (
FLOAT, default0, range −360 to 360, step 0.01) - spatial rotation applied to the target's output feature maps.
The default is 0, i.e. a pass-through. Rotation is spatial, so it makes sense on layers whose activations have spatial structure - which is most of a UNet's conv feature maps. The bend uses kornia's rotation under the hood, and the code casts fp16 activations to fp32 for the operation and back, so you don't pay a precision penalty on half-precision runs.
How to use it
The classic demo: Model Bending (SD Blocks), block_type = middle_block, feed it a Rotate module, and sweep the angle in small steps. At small angles you'll see composition gently skew - subjects lean, backgrounds slide. Around 90° things get structural, and past that the layer starts fighting the model's own expectations, which is where the interesting breakage lives. For a smooth morph like the showcase, wire the angle to a keyframed value or an animation schedule and run a batch.
Two tips from the catalog: pair rotation with an ablation pass first (Multiply Scalar at 0 on the same target) so you know what the layer actually contributes before you spin it, and try rotation on early output_blocks vs the middle block - the same angle does completely different things depending on which stage of the U it lands on.
Installing
Part of ComfyUI-Model-Bending:
cd ComfyUI/custom_nodes
git clone https://github.com/abuzreq/ComfyUI-Model-Bending
Restart ComfyUI and refresh your browser, or install via ComfyUI Manager (search ComfyUI-Model-Bending). Deps are kornia + scikit-learn; no model files to fetch. Keep the clone folder named ComfyUI-Model-Bending - the README's ComfyUI-Web-Bend-Demo name is stale.
Where people get tripped up
Rotation of activation maps at big angles is very much a "broken on purpose" effect - don't expect a 180° spin to look like a flipped image; it won't, it'll look like the model's brain slid sideways. On Flux, remember the block-targeting nodes are SD-only, so route through Model Bending with a path from the Interactive Bending Web UI. And if the angle does nothing, your module is at its 0 default - that's the pass-through, not a bug.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| angle_degrees | FLOAT | 0.00-360–360 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BENDING_MODULE | BENDING_MODULE | — |