Share

PhysicalDefocus Matchbox

The PhysicalDefocus matchbox completes the previously released Physical Bokeh and Convolve by adding depth support to the same convolution engine.

This node offers two independent Defocus model: a custom one and a physical. The node also offers different ways to set the focus plane, as well as leverages the Action Camera value. Finally, you can use its procedural kernel for the bokeh, provide your custom kernel, or use the PhysicalLensKernel matchbox.

Focus Plane

Focus Model

The Focus model sets the behaviour of PhysicalDefocus. Three behaviours are available: Custom, Physical, and Action Camera. Each option comes with its own set of Depth of Field controls.

Focus Model Options

Custom Use Custom when you want to manually handle the Near and Far defocus levels as separate entities.

Focus Range

The depth of field range based on the focus distance value as a centre point.

Near

The maximum amount of blur applied to the slice closest to the Near plane. The blur level is automatically set per slice in between this value and the focus slice, and is based on the number of slices defined by the Slicing Amount parameter.

Far

The maximum amount of blur applied to the slice closest to the Far plane. The blur level is automatically set per slice in between this value and the focus slice, and is based on the number of slices defined by the Slicing Amount parameter.

Near Min

Defines the location of the maximum amount of blur for the Near slices. A value of 1.0 defines the slice the farther away from the focus distance, while a value of 0.01 is the closest slice. Reduce this value to shorten the transition from no blur to maximum blur. Depending on the slicing method, reducing this value can increase significantly the amount of blur if the Near value is set to 1.0 and the object is far from the camera.

Far Max

Defines the location of the maximum amount of blur for the Far slices. A value of 1.0 defines the slice the farther away from the focus distance, while a value of 0.01 is the closest slice. Reduce this value to shorten the transition from no blur to maximum blur. Depending on the slicing method, reducing this value can increase significantly the amount of blur if the Far value is set far from the last object in the scene.

Physical To handle the defocus using a photographic approach, use the Physical mode. In the Physical mode, the settings below are dependant on one another, as they are in a real-world camera, and all contribute to the final defocus effect.

World Scale

Converts units from the world scale to millimeters. Tune this value according to the contents of the scene. Making it smaller increases the defocus effect, making it larger reduces the defocus effect. World Scale is the first parameter to tweak if no defocus is visible or if the defocus is too intense with the default values of the Physical mode.

Field of View

Equivalent to the degrees value of the field of view a camera lense. The smaller the Field of View, the smaller the defocus effect.

F-Stop

Equivalent to the F-Stop of a camera lense. The larger the F-Stop, the larger the defocus effect.

Focal (mm)

Equivalent to the focal length value (in millimeters) of a camera lense. The larger the Focal length, the smaller the defocus effect.

Action Cam Use the Action Camera mode to use the parent Action Camera settings to affect the defocus effect. The Action Camera mode is similar to the Physical mode. Where in the Physical mode you define a physical camera, in Action Camera only the World Scale is available. The FOV, F-Stop, and Focal information are taken from the parent Camera and offer the similar results. What to use depends on your needs.

World Scale

Convert units from the world scale to millimeters. Tune this value according to the contents of the scene. Making it smaller increases the defocus effect, making it larger reduces the defocus effect. World Scale is the first parameter to tweak if no defocus is visible or if the defocus is too intense with the default values of the Action Camera.

Focus Distance

Define how the focus distance is set.

  • Action Cam: Set the point of focus. Use the Action Camera Interest value if it is in Target mode. Use the Distance value if it is in Free mode.
  • Free: Set the point of focus starting from the camera Z position.
  • Pixel Depth: Set the point of focus based on the depth position of the pixel coordinate define by the X and Y values. The pixel depth is computed at each frame, so you must animate it over time.
  • Target: Set the focus point through either an expression in the animation channel, or enter the coordinates of the object in the Action scene containing an X, Y, and Z.

Depth of Field

The settings available in the Depth of Field section are set by the Focus Model. See above .

Viewing

Use Viewing to select the information displayed by the node in the viewport.

  • Result: The result of the PhysicalDefocus effect.

  • Slices: The different slices, each in a different colour. This view helps you see if more slices are required for a smoother result. The slice at focus is magenta, the far slice is red, the near slice is blue.

  • Defocus: A jet map colour coding, from the point of focus to the far and near slices. In this view, the focus point is green, red at the far end, and blue at the near end.

  • Depth: The result of the Depth remapping controls. Sometimes, the Depth map appears as a white frame, and cannot be used properly by the PhysicalDefocus tool. To make it usable, use the Depth controls to remap (normalize) the values of the depth map between 0.0 and 1.0. With the Depth view, you can verify that the normalized map matches the contents of the scene.

    Important: Do not edit the Exposure setting of the viewport or you will skew the results and prevent PhysicalDefocus from working properly.

Slicing

Amount

The number of slices used by the convolution engine. There is always an odd number of slices: the central in-focus slice, and an equal amount of slices on either side of that slice. The higher the number of slices, the slower the rendering, but the smoother the result because of finer transitions in the defocus effect.

Slicing Mode

If the camera motion in the scene is important, use Static. When there's minimal camera motion, use Auto Defocus. Auto Defocus is more precise than Static as it uses a smarter slicing algorithm, but that algorithm is sensitive to camera motion.

  • Auto Defocus: Automatically slice the frustum in order the get the best coverage of the defocus amount range.
  • Static: Slice the frustum evenly, without care for the scene content. The fastest method, but can generate empty slices.

Slice Blending

How each slice is blended with the next one. At 0.0 there is no blending, at 1.0 there is maximum blending. When specularity happens at the edge of a slice, a large amount of blending can cause unnatural results that break the shape of the bokeh.

Depth

Physical Defocus requires a normalized depth ranging, where values range from 0.0 to 1.0. A Depth render pass from a renderer other than Action is probably expressed in absolute unit values, and needs to be normalized. Use the Depth controls to normalize the Depth map.

Custom Near/Far

By default, the Near and Far values of the current Camera are used when the effect is used in Action. If they do not match the Depth data, you override it by manually entering the near and far depth values.

You can improve the precision by entering the camera data that was used when the scene was rendered. If that information is missing, use the colour picker and pick the pixels of the Z-Depth map to find the smallest and largest depth values. Enter these values as the Near (smallest) and the Far (largest) values.

Normalization

  • None: The default option. If you are using the Z-Depth render pass generated by the Action node or any other renderer generating normalized depth, use None: it does not apply any normalization.
  • Inverse: Use if the renderer creates a normalized inverse depth where a white value of 1.0 represents the closest distance to the camera and black at 0.0 the farthest distance from the camera.
  • Near-Far: The renderer outputs a Z-Depth expressed in units from the point of view of the camera. This type of Z-Depth map always appears as white frames: 1.0 represents a single unit of distance from the camera. Use the Near/Far fields below to match as closely as possible the depth range to maximize the depth precision. This is the type of Z data generated by the Arnold renderer.
  • Far-Near: The inverse of the Near-Far option.
  • Min-Max: Automatically map the minimum and maximum colour values to the normalized 0.0-1.0 range. However, this mapping is done for every frame and can lead to discrepancies in the Focus Plane between frames. If you use this option you might have to animate the Focus Plane.
  • Max-Min: The inverse of the Min-Max option.

Z-Depth HQ

Z-Depth is much more precise in 32-bit precision. If for performance reasons you do not want to switch to 32-bit Action Rendering, enable Z-Depth HQ Action output pass instead, which is encoding 32-bit precision in 16-bit file format.

Highlights

Threshold

The colour value limit on which the gain is applied to boost the highlight before sending the input to the convolution engine. This helps the creation of a stronger and larger bokeh shape.

Threshold Max

The maximum colour value to which the gain is applied, limiting the highlight boost and helps in controlling the range of colours boosted by the highlights.

Gain

Increases to create stronger bokeh shape at smaller blur values. The gain follows the blur level curve applied in the individual slices, where there is no blur, no gain is applied. At maximum blur value the gain is fully applied.

Bokeh

Kernel

You can use the included Procedural kernel generator or the Kernel input. Keep in mind that the larger the input size, the longer the rendering time. A kernels size is usually in the range of 300x300 pixels. If you're using the Input option, make sure to connect a kernel image to the Kernel input of the PhysicalDefocus node. Connect the PhysicalLensKernel matchbox to access a wide array of kernels.

Aperture

Aperture settings are only available when Kernel is set to Procedural.

Offset Angle

Rotate the bokeh kernel.

Blades Number

The number of blades. Impacts the shape of the kernel.

Curved Blade

Curve the shape of the blades. Impacts the shape of the kernel.

Anamorphic

Makes the bokeh an anamorphic effect with a 2:1 ratio.

Aberration

Aberration settings are only available when Kernel is set to Procedural.

Spherical Aberration

The maximum aberration, expressed as a relative distance to the focal length. The higher the value, the more the circle of confusion impacts the size of the Bokeh.

Chromatic Aberration

The maximum distance to the focal length of the red-most wavelength. The higher the value, the more the colours are separated in the bokeh.

Lens Noise

A list of real-camera lens noise pattern added to the procedural kernel. Lens Noise helps in breaking up the perfect shape generated by the physical engine.

Rendering

Matte Output Rendering

Output a defocus Matte result by applying the convolution result to the input matte. Off by default, as Matte Output Rendering increases the rendering time because of the need to process an extra convolution.

In Action, enable Matte Output Rendering to remove the Background from the defocus result: by processing the matte, Action can blend the defocus result with the clean background.

CPU Rendering Engine

Run the convolution engine on the CPU instead of the GPU. Enable this option when the graphics card performance is insufficient: you can get better performance by switching to the CPU renderer.

This option only affects the rendering of PhysicalDefocus.

Was this information helpful?