Nodes/Allor Plugin/ImageEffectsLensOpticAxis
ComfyUI Node

ImageEffectsLensOpticAxis

Tilt-shift blur from the lens axis, with a mask to prove it

By Nourepide·Created 3 years ago·Updated 2 years ago· 295
ImageEffectsLensOpticAxis
  • images
  • IMAGE
  • MASK
lens_shape
lens_edge
lens_curvy4.0
lens_zoom2.0
lens_aperture0.5
blur_intensity30

Tilt-shift photography blurs everything except a thin band of focus, and it's the effect people add to make a scene look like a miniature. The catch in most ComfyUI setups is that a plain blur gives you a symmetric blur and no way to know where the focus band actually landed. ImageEffectsLensOpticAxis from the Allor plugin does the thing properly: it computes a lens-shaped focus falloff from the optical axis, blurs only the out-of-focus zone, and hands you the mask so you can see - and reuse - exactly what got blurred.

How it works

The node builds a radial "lens" mask centered on the image, shaped by lens_shape (circle, square, rectangle, or corners) with lens_edge controlling whether the falloff goes around the image or symmetric from center. The mask is then curved by lens_curvy (1–15) and scaled by lens_zoom. From there:

  1. The image is remapped outward along the lens axis by lens_aperture - a subtle barrel-style shift that sells the lens distortion.
  2. The whole thing is blurred with a stack blur at blur_intensity.
  3. The sharp original and the blurred copy are blended using the mask, so only the area outside the focus zone gets soft.

That's the part most tilt-shift imposters skip: the blur is masked, not applied flat. The node also returns the (remapped) mask as a second output, which is gold for building follow-up effects - vignette, focus-fade compositing, or a depth-style gradient for other nodes.

Inputs that matter

  • images - the IMAGE or batch.
  • lens_shape - circle for a classic lens look, rectangle/corners for a more planar focus band.
  • lens_zoom and lens_aperture - how wide the in-focus zone is and how strongly the axis distortion pulls the edges.
  • blur_intensity - how heavy the out-of-focus blur is.
  • Outputs: IMAGE (the processed result) and MASK (the falloff, in case you want it).

Installing it

Part of the Allor pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Nourepide/ComfyUI-Allor

Restart ComfyUI, or install via ComfyUI Manager → Allor Plugin. First boot installs rembg + onnx and writes the pack's config.json - slow the first time, no model downloads after.

Gotchas

  • blur_intensity default is 30, which is plenty heavy. For a subtle depth-of-field, drop it to 8–15 first.
  • It uses OpenCV remapping on the CPU, and blur_intensity scales the stack blur cost - on a 2K image with high blur, this can take a real second or two per frame.
  • Because the mask output is a remapped version of the falloff, don't assume it lines up pixel-perfect with a pre-existing mask - it's meant to be used as the source of truth for this node's own effect.
  • Same pack-wide update gotcha: rebased repo history can break git pull on old clones; re-clone if it errors.

For a simpler edge-darkening effect, ImageEffectsLensVignette is the sibling node that also outputs a mask.

Categoryimage/effects/lens

Inputs (7)

NameTypeDefaultDescription
imagesIMAGE
lens_shapeCOMBO4 options: circle, square, rectangle, corners
lens_edgeCOMBO2 options: around, symmetric
lens_curvyFLOAT4.0
lens_zoomFLOAT2.0
lens_apertureFLOAT0.5
blur_intensityINT30

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK