Temporal Accumulation Filter
Filter
RIF_IMAGE_FILTER_TEMPORAL_ACCUMULATOR
Description
This filter can be used for accumulation and averaging of the frames taking into account changes in the position and perspective of the camera. Using a view projection matrix, the filter performs reprojection of the previously stored buffer for new camera position and adds this data to the new frame. This avoids the complete loss of ray tracing data when the camera is changed, which greatly improves the picture’s quality. The filter uses consistency testing to avoid mixing, when objects are moving on the scene. A filter can be used to find temporal variance of the output colors. Note that the filter retains internal state.
Parameters
Parameter |
Type |
Input/Output |
Description |
---|---|---|---|
viewProjMatrix |
float16 |
input |
View-projection matrix for the current frame. This matrix is used to reprojection a previously obtained frame to a new position. The filter stores the view projection matrix of the current step and uses it on the next step for obtaining the motion buffer. The motion buffer is used for reprojection. It should be updated at each camera change. |
positionsImg |
image |
input |
The image containing position vectors. Used to generate motion buffer, and for consistency testing. This parameter is required for correct operation and can be ignored. |
normalsImg |
image |
input |
The image containing normal vectors. Used for consistency testing. The filter stores this buffer and uses it on the next step to check if a geometry change has occurred. The parameter is optional. If used, can improve the consistency testing. |
meshIdsImg |
image |
input |
The image containing IDs of meshes. The filter stores this buffer and uses it on the next step to check if a geometry change has occurred. The parameter is optional. If used, can improve the consistency testing. |
outVarianceImg |
image |
output |
The image in which output temporal variance will be stored. Temporal variance is used by some filters (see EAW and Local Weighted Regression filters) to adjust the threshold. This allows you to reduce the blur in a region with a small variance and increase where the variance is higher. The parameter is optional. |
Usage Example
rif_image_filter filter = nullptr;
rif_image_filter filter = nullptr;
rifContextCreateImageFilter(context, RIF_IMAGE_FILTER_TEMPORAL_ACCUMULATOR, &filter);
//Attach renderer outputs to filter
rifImageFilterSetParameterImage(filter, "positionsImg", positionsImg);
rifImageFilterSetParameterImage(filter, "normalsImg", normalsImg);
rifImageFilterSetParameterImage(filter, "meshIdsImg", meshIdsImg);
rifCommandQueueAttachImageFilter(queue, filter, inputImage, outputImage);
while (isRun)
{
// Render new frame
//Update view projection matrix
rifImageFilterSetParameter16f(filter_, "viewProjMatrix", mvp);
rifContextExecuteCommandQueue(context_, queue_, nullptr, nullptr, nullptr);
}