Nodes/ComfyUI Model Bending/Latent Operation (Rotate)
ComfyUI Node

Latent Operation (Rotate)

Latent Operation (Rotate)

By abuzreq·Created about a year ago·Updated 3 months ago· 21
Latent Operation (Rotate)
    • LATENT_OPERATION
    axis
    angle0.00

    Before you wire this up expecting the image to spin like a GIF, know the catch: this rotates the latent's feature space, not its pixels. The README's own showpiece - a portrait rotating a full 360° - is done with the Rotate Module (Bending) applied to a UNet layer, which is a different node. This one returns a LATENT_OPERATION that applies a rotation matrix across the latent's channel/feature dimensions using the pack's rotate_x/y/z functions. Visually, the effect is more like the model's "understanding" of the tensor getting twisted than the picture getting twisted - which is far weirder and often far more interesting.

    Mechanically, rotate_z builds a 4×4 rotation matrix and contracts it over the tensor; rotate_x and rotate_y do the same along the other feature axes. So "rotating" here means linearly mixing the feature channels - rotating one axis of the semantic embedding into another. Feed the result into ConditioningApplyOperation and you're rotating part of the prompt's semantic vector; feed it into LatentApplyOperationCFGToStep and you're twisting the intermediate latents at exactly one denoising step.

    Inputs: axis - x, y, or z, which feature rotation you want (each mixes the channels along a different pairing, and the results do differ) - and angle in radians (default 0, so it's a no-op until you set it). Yes, radians: the source passes the angle straight into math.cos/math.sin. A full revolution is 2π ≈ 6.28, and the pack's showcase animation on the rotate module sweeps the full circle. If you set angle to 180, remember that's 180 radians, not degrees - you'll definitely notice.

    The reason this is worth keeping on hand: rotation is periodic, unlike noise or scalar shifts. Rotate a bit and you get a subtle semantic tilt; keep going and things cycle, which makes it the only operation in the kit where you can sweep a value continuously and watch the model's interpretation loop. It's also the operation the pack's demos love, because a full rotation of a layer's features produces a mesmerizing, coherent morph that looks intentional.

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

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

    Dependencies: kornia and scikit-learn.

    The honest note: because this operates in feature space, the mapping between "angle" and "what I see" is unintuitive - there's no formula, you just sweep. The pack's basic_unet_bending.json workflow is the fastest way to feel it out. And if you wanted actual pixel rotation, look at Rotate Module (Bending) (spatial, via kornia) instead - easy to confuse, and the source even ships both.

    Categorymodel_bending

    Inputs (2)

    NameTypeDefaultDescription
    axisCOMBO3 options: x, y, z
    angleFLOAT0.00

    Outputs (1)

    NameTypeDescription
    LATENT_OPERATIONLATENT_OPERATION