Radeon ProRender

Depth of Field Filter

Filter

RIF_IMAGE_FILTER_DEPTH_OF_FIELD

Description

The filter emulates the depth of field of the real camera (Depth of field).

Parameters

Parameter Type Input/Output Description
depthImg image input The image which contains depths, i.e. the distance from the camera to the captured pixel in meters.
focalL float input The focal length of the camera lens in millimeters.
Must be positive. Default value is 10.
focusD float input The focus distance in meters; objects at that distance from the camera will be in focus.
Must be positive. Default value is 1.
aperture float input The opening through which light travels. The aperture limits the ray bundle (Aperture).
Value range is [0, 1], default value is 1. The value of 1/4 corresponds to the camera aperture f/4.
kernelSize uint input

The blurring area (circle) size.
It can be any of the following:

  • RIF_DEPTH_OF_FIELD_FILTER_KERNEL_SIZE_SMALL
  • RIF_DEPTH_OF_FIELD_FILTER_KERNEL_SIZE_MEDIUM
    (default)
  • RIF_DEPTH_OF_FIELD_FILTER_KERNEL_SIZE_LARGE
  • RIF_DEPTH_OF_FIELD_FILTER_KERNEL_SIZE_VERY_LARGE

Usage Example

rif_image_filter filter = nullptr;
rifContextCreateImageFilter(context, RIF_IMAGE_FILTER_DEPTH_OF_FIELD, &filter);
rifImageFilterSetParameter1u(filter, "kernelSize", RIF_DEPTH_OF_FIELD_FILTER_KERNEL_SIZE_LARGE);
rifImageFilterSetParameter1f(filter, "focusD", 1.8f);
rifImageFilterSetParameter1f(filter, "aperture", 0.8f);
rifImageFilterSetParameterImage(filter, "depthImg", depthImage);
rifCommandQueueAttachImageFilter(queue, filter, inputImage, outputImage);
rifContextExecuteCommandQueue(context, queue, nullptr, nullptr, nullptr);

Results

Input image

Output image (focusing on the middle of the table)