Once installed Bokeh can be found in the Peregrine toolbar as pgBokeh and, as with all Nuke tools, selecting the icon will create an instance of Bokeh and place it in your node network.

Bokeh takes 4 inputs, the first ( required for general defocus effects ) is the image to apply the effect too, the second is an optional image that will act as the shape of the Bokeh effect ( if Input kernel type is selected ) - third is an optional camera and the fourth is used for deep data.

Although it’s possible to defocus an RGBA ( or any other channel set specified using the Bokeh channels parameter ) image that is missing a Z channel the result will be uniformly defocused by the multiplication level - to simulate a true depth of field the input image requires a Z depth channel which may be selected using the depth channel parameter.

Example Workflow

An image is loaded as normal, preferably with a z channel. Create a Bokeh node and attach the new image as an input and view.

To accurately set your focal plane and region size settings change the Output Type to Focus Distance Visualization - this provides a quick indication of the depth of field effect, blue/green channels are the near and far focus regions with red being in focus.

Next the Output Type is changed to Filter Shape to preview the shape of our lens kernel, we’ve chosen one that represents the aperture blades in a lens and in this example the softness has been increased slightly along with the spherical aberration.

Switching back to the Defocused Image Output Type the multiplier is increased to 50 and the depth of field is rendered.