ComfyUI Node

TiltShift

The fake-miniature depth-of-field effect

By licyk·Created 2 years ago·Updated 12 months ago· 14
TiltShift
  • image
  • image
tilt_shift_focus_ratio0.0
tilt_shift_dof60

You've seen this effect even if you didn't know the name: a photo of a city or landscape shot from above, with a sharp horizontal band across the middle and everything above and below it blurred into softness, so the whole scene reads as a tiny scale model rather than a full-size place. That's the real optical effect of a tilt-shift lens, and it's also one of the most recognizable Instagram-era filters. TiltShift fakes it in post - no lens, no diffusion, just a synthetic focus band with blur that increases toward the top and bottom of the frame.

The inputs and outputs that matter

Two settings, both floats:

  • tilt_shift_focus_ratio (-3 to 3, step 0.5, default 0) - where the sharp band sits vertically in the frame. Zero centers it; moving the value up or down shifts the "in-focus" strip toward the top or bottom of the image. The step size (0.5) is coarse on purpose - small nudges go a long way.
  • tilt_shift_dof (10–100, default 60) - how wide that sharp band is, and by extension how quickly blur ramps up outside it. A higher number gives a wider, gentler focus band (a subtler effect); a lower number narrows the sharp strip and increases blur outside it fast, which is what pushes the image toward the exaggerated "toy model" look.

One image output.

How to install it

Search ComfyUI-HakuImg in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone --recurse-submodules https://github.com/licyk/ComfyUI-HakuImg

Restart ComfyUI, find it under Image → HakuImg. No models, no submodule dependency for this node specifically.

Common issues & troubleshooting

Effect doesn't look convincing on this particular image. This node applies a single horizontal focus band across the whole frame - there's no region mask or subject-detection involved. It works best on compositions that already have a clear horizontal plane running through them: aerial shots, cityscapes, landscapes shot from a height. On a portrait or a scene without that kind of horizontal structure, the same settings can just look like an odd blur band rather than a believable miniature effect. Pick your source image with the effect in mind rather than expecting it to work on anything.

Focus band is in the wrong place. Adjust tilt_shift_focus_ratio - remember it's centered at 0 and the step is coarse (0.5), so you may need fewer, bigger adjustments than you'd expect rather than fine-tuning in small increments.

Effect is too subtle or too extreme. That's tilt_shift_dof, not the focus ratio - lower it for a narrower, more dramatic sharp band and stronger falloff; raise it toward 100 for a gentle, almost-natural-looking depth cue instead of an obvious "miniature" gimmick.

Categoryimage/HakuImg

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
tilt_shift_focus_ratioFLOAT0.0-3–3
tilt_shift_dofINT6010–100

Outputs (1)

NameTypeDescription
imageIMAGE