Skip to content

Nodes · More

Bokeh

Morev1core

Overview

Nuke's Bokeh node, knob for knob: the depth-driven lens defocus. The stream's depth channel sets each pixel's circle of confusion around the focal plane — from a real lens (focal length, f-stop, film back) or from a multiplier — with a focus region, front and back regions with their own amounts, a kernel that is a circle, an iris of curved blades or an image, bloom and aberrations, corrective depth slices so near blur covers far, and five output types. Wire depth-carrying footage (EngineLive, a Render3D pass, an EXR with a Z layer); without depth the image passes through and the node says so. For a flat 2D disc blur, use Defocus.

How to

How-to

  1. Wire footage that carries depth (EngineLive, a Render3D pass, an EXR with a Z layer) and set depthChannel to its layer. Without depth the image passes through and the node says so.
  2. Set worldScale to the depth's unit (EngineLive writes metres) and focalPlane to the distance that stays sharp; focusRegionSize widens the sharp plateau.
  3. multiplier is the amount. Or turn on realWorldLens and type the plate's focalLength, fStop and filmFormat — the defocus then matches the lens.
  4. outputType = Focal Distance Visualization shows where the plane sits (red) against front (green) and back (blue); switch back to Defocused Image.
  5. Shape the bokeh on the Kernel page: a disc, an iris of kNumSides blades, or an image on the Kernel input; kSoftness and kCurvature round it off.
  6. correctiveSlices keeps near blur over far; 0 is the fast single pass. bloom and the aberrations are on Optical Artifacts.

Inputs

InputWhat it takes
inthe image this node works on
kernel—
masklimits the effect to this matte — the engine's universal mask slot, applied for every node that declares it

Outputs

OutputType
outImage

Parameters

ParameterTypeDefaultWhat it does
channelsChoicergbaWhich channels the defocus is applied to; everything else passes straight through. allrgbargbalphanone
depthChannelTextdepthThe channel that carries depth (Nuke's depth.Z; here the stream's depth layer). Its values are world distances in worldScale units — or 1/z when depthStyle says so.
outputTypeChoiceDefocused ImageWhat the node renders. Defocused Image: the result. Lens Bloom: only the bloom. Focal Distance Visualization: red where the focal plane is, green in front, blue behind, brighter the more defocused. Filter Shape: the kernel drawn at its maximum size. Focus Mattes: r the front matte, g the back matte, b in focus. Defocused ImageLens BloomFocal Distance VisualizationFilter ShapeFocus Mattes
focusOutputChoiceBothWhich side of the focal plane gets defocused: Front (nearer than the plane), Back (farther), or Both. FrontBackBoth
multiplierFloat1.0The overall amount of defocus. Without a real-world lens, 1 gives ten pixels of circle of confusion at infinity, scaling with distance from the focal plane like a thin lens. With one, it scales the lens's own result.
frontmultiplierFloat1.0Extra amount for the front region (nearer than the focal plane): 1 leaves it as computed.
backmultiplierFloat1.0Extra amount for the back region (farther than the focal plane): 1 leaves it as computed.
depthStyleChoiceRealHow the depth channel is read: Real — world distances (EngineLive, most renders); 1/z — inverse depth as ScanlineRender writes it. Real1/z
focalPlaneFloat100.0The distance that is totally in focus, in worldScale units. Nuke's default 100 is a metre when worldScale is cm; set worldScale to what your depth carries (EngineLive writes metres).
focusRegionSizeFloat1.0The thickness of the in-focus plateau around the focal plane, in worldScale units. Everything within half of it either way stays sharp; the defocus starts at its edges.
focusRegionFalloffChoiceLinearHow the defocus grows from the focus region's edge: Linear (the lens's own curve from the edge) or Smooth (eased in over one region width). LinearSmooth
defocusMatteChannelTextnoneA channel that scales the defocus per pixel (0 sharp, 1 full): none uses the Mattes input when one is wired, else the whole frame; a layer name uses that layer of the input.
normalizeVisualizationBooltrueFocal Distance Visualization: limit the colour to 0–1 (by the maximum kernel size) so it reads on a monitor.
realWorldLensBoolfalseCompute the circle of confusion from a physical lens — focal length, f-stop, film back, world scale — instead of the multiplier. Match a plate's lens and the defocus matches the plate.
focalLengthFloat35.0Real-world lens: the focal length in millimetres.
fStopFloat6.0Real-world lens: the aperture as an f-number. Lower is a wider aperture and more defocus.
worldScaleChoicecmThe unit the depth channel and focalPlane are in: mm, cm, m, in or ft. EngineLive and most renders are metres. mmcmminft
worldScaleMultiplierFloat1.0A multiplier on worldScale for depth in some other scale (2 if a unit is two centimetres).
filmFormatChoice35mmThe film back the real-world lens projects onto: 35mm (22×16 mm), Super 35, Full Frame, APS-C, or Custom to type the aperture yourself. 35mmSuper 35Full FrameAPS-CCustom
apertureWidthFloat22.0Custom film format: the film back's width in millimetres. Sets how many pixels a millimetre of blur on the sensor is.
apertureHeightFloat16.0Custom film format: the film back's height in millimetres.
bloomFloat0.0How bright the bloom is: what is brighter than bloomThreshold spreads under the defocus and is added on top. 0 is off.
bloomCurvatureFloat2.0How far the bloom spreads relative to the defocus: 2 blooms twice as wide as the circle of confusion, 1 as wide.
bloomThresholdFloat0.7The brightness above which pixels bloom (scene-linear).
kSphAbbFloat0.0Spherical aberration: 0 is an even disc, 1 puts the disc's light on its rim — the bright-ringed bokeh of a fast lens.
kChrAbbFloat0.0Chromatic aberration: how far each colour's disc departs from the others, by kChrAbbOff. 0 is off; fringes grow with it.
kChrAbbOffColor[0.6, 1.0, 1.0, 1.0]Chromatic aberration: the per-channel (r, g, b) size of the disc relative to 1. The default shrinks red to 0.6 — the classic red-inside, blue-outside fringe.
kernelTypeChoiceCircularThe filter's shape. Circular: a disc. Aperture Blades: an iris of kNumSides blades, kCurvature bowing them toward a circle, kRotation turning it. Input: the image on the Kernel input, sampled as the shape (white where it weighs). CircularAperture BladesInput
max_kernelsizeFloat256.0The largest circle of confusion allowed, as a diameter in pixels (Nuke's 256). It is also how far the node reaches for neighbours, so it is the cost.
expandBBoxToMaxKernelSizeBoolfalseGrow the output's bounding box by half the maximum kernel size so blur can spill past the input's edges. Off (Nuke's default) keeps the input's box.
kAspectRatioFloat1.0The kernel's aspect: below 1 squeezes it into the ovals of an anamorphic lens.
kSoftnessFloat0.1How soft the kernel's edge is, as a fraction of its radius: 0 is a hard disc (the crispest bokeh), 0.1 takes the aliasing off, 0.5 is a soft blob.
kNumSidesInt6Aperture Blades: how many blades the iris has, 3 to 16. 5–9 is a camera.
kCurvatureFloat0.1Aperture Blades: how much the blades bow outward, 0 straight (a polygon) to 1 fully round.
kRotationFloat0.0Aperture Blades: turn the iris, in degrees.
catadioptricFloat0.0Ours, not Nuke's: a mirror-lens hole in the kernel — 0 none, 0.9 a thin ring (donut bokeh).
correctiveSlicesInt10How many depth bands the image is cut into and defocused separately, far to near, so a near blur covers what is behind it and a far blur never bleeds forward. 0 is the single pass (fastest, and the GPU path); Nuke's 10 handles most shots; more for many depth layers.
overrideNearAndFarForSlicesBoolfalseTake the depth range the slices cover from depthSlicesNearAndFar instead of measuring it from the frame.
depthSlicesNearAndFarFloat2[0.0, 0.0]With the override on: the near and far depths (in worldScale units) the corrective slices are spread across.
disabledBoolfalseBypass: the node passes its first input through untouched (D in the graph). The knobs keep their values for when it comes back.
labelTextA note shown under the node in the graph — what this node is FOR. Never affects the render or the cache.
hide_inputBoolfalseDraw the node without its input wire — a tidy graph for a node whose source is obvious (a Dot, a viewer tap).