ImageEffectsLensOpticAxis
Tilt-shift blur from the lens axis, with a mask to prove it
- images
- IMAGE
- MASK
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:
- The image is remapped outward along the lens axis by
lens_aperture- a subtle barrel-style shift that sells the lens distortion. - The whole thing is blurred with a stack blur at
blur_intensity. - 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-circlefor a classic lens look,rectangle/cornersfor a more planar focus band.lens_zoomandlens_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_intensitydefault 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_intensityscales 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 pullon old clones; re-clone if it errors.
For a simpler edge-darkening effect, ImageEffectsLensVignette is the sibling node that also outputs a mask.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| lens_shape | COMBO | 4 options: circle, square, rectangle, corners | |
| lens_edge | COMBO | 2 options: around, symmetric | |
| lens_curvy | FLOAT | 4.0 | — |
| lens_zoom | FLOAT | 2.0 | — |
| lens_aperture | FLOAT | 0.5 | — |
| blur_intensity | INT | 30 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |