LensZDefocus

Depth defocus with real lens character. LensZDefocus reads your depth pass directly and blurs your render the way a real lens would.

First submitted: 8 November 2026

Updated: 9 November 2026

Author: Harikrishnan V

Compatible Nuke versions: All

Compatibility: Linux, Mac, Windows

LensZDefocus for Nuke

Depth defocus with real lens character. LensZDefocus reads your depth pass directly and blurs your render the way a real lens would. Bokeh turns into cat's eyes and swirls toward the frame edges, focus curves at the corners, and highlights bloom into soft balls. It runs as BlinkScript, so it uses your GPU when one is available.

Features

Reads depth directly: use a channel on your beauty (such as depth.Z) or a separate depth input. It handles real distance (Arnold, Redshift, V-Ray, Karma), 1/z (Nuke ScanlineRender) and normalised passes.

Real lens swirl: cat's-eye vignetting clips the bokeh toward the edges. Stretch and twist settings then turn the background into a circular swirl around the optical centre.

Field curvature: the plane of focus bends like on a Petzval lens, so the centre stays sharp while the edges soften.

Iris control: set the blade count, rotation and curvature, or use 0 blades for perfectly round bokeh.

Anamorphic squeeze: gives oval bokeh, like a 2x anamorphic lens.

Bokeh character: soap-bubble rims, soft glowing centres, onion rings, colour fringing and highlight boost.

Clean edges: blurred foreground spills over sharp objects, but the background never bleeds onto what's in focus.

Physical or artistic: use real focal length, f-stop and filmback, or just one simple blur size.

Focus point and autofocus: drag a point in the viewer to set focus. Autofocus follows that point every frame, so you can track or animate it for focus pulls.

Six lens presets: Modern prime f/1.4, Helios 44-2, Petzval 85mm, Trioplan 100mm, Anamorphic 2x and Stopped-down 6-blade. You can still edit every setting after picking one.

Check views: a focus overlay (green = sharp, red = in front, blue = behind) and a blur map let you check focus before a full render.

Farm-safe: the node saves its code inside your .nk script, so it renders on machines that don't have the plugin installed.

How to use

Install: copy the LensZDefocus folder into ~/.nuke and add this line to ~/.nuke/init.py: nuke.pluginAddPath("./LensZDefocus") Then restart Nuke.

Add the node: select your render and choose LensZDefocus › LensZDefocus from the toolbar. It connects to the selected node.

Set up depth: in Depth & Focus, pick where depth comes from and which channel holds it. Then set depth math to match your renderer (ScanlineRender writes 1/z).

Set focus: drag the focus point onto your subject in the viewer and click set focus from point. Turn on autofocus if the subject moves.

Pick a look: choose a preset in Lens Character, for example Helios 44-2 for swirl. Then adjust size, cat eye, swirl stretch and swirl twist to taste.

Check, then render: use output › focus overlay to confirm what's sharp, then switch back to result. Use around 256 samples while you work and 512–1024 for final renders.

Tips

Swirl shows up best on busy, bright backgrounds like foliage or city lights.

If the result looks flat, check depth math first.

A depth pass without anti-aliasing gives the cleanest edges between a sharp foreground and a blurred background.

Render time grows with samples × maximum², so keep maximum close to the most blur you actually need.

If the node doesn't work, run LensZDefocus › Diagnose from the toolbar to see the cause.

Requirements: Nuke 12.2 or later. Nuke 13 and older need NukeX; any edition of Nuke 14+ works.

Copyright © 2026 Harikrishnan V. All rights reserved. See LICENSE.txt.

LensZDefocus for Nuke
Copyright (c) 2026 Harikrishnan V. All rights reserved.

This software and its source code are the property of Harikrishnan V.
You may install and use it in your own projects and productions.
You may not resell, redistribute or publish modified or unmodified copies
without written permission from Harikrishnan V.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.

or register to download or rate.

Comments

or register to join the conversation.

Download Verification