TheVaffel / spatiotemporal-variance-guided-filtering

A simple implementation of the Spatiotemporal Variance-Guided Filtering (SVGF) algorithm by Schied. et al
37 stars 4 forks source link

Spatiotemporal Variance-Guided Filtering implementation in OpenCL

This is an implementation of the the SVGF algorithm (Schied et al. 2017) for denoising ray traced images with low sample count.

Modifications

A few simplifications are made from the original algorithm:

Sample Results

The following shows a ray traced scene with one ray sample per pixel, without denoising

Original, non-denoised rendering

The following shows the same image, after denoising has been applied:

Denoised rendering

The algorithm uses buffers containing world-positions, surface normals and albedo for each pixel, as well as samples from previous frames to generate the result.

These performance results are obtained on a laptop with GeForce GTX 960M:

 Reprojecting samples
 --------------------
   Mean   : 2.022 ms
   Min    : 1.974 ms
   Max    : 2.106 ms
   Total  : 119.273 ms

 Computing variance
 ------------------
   Mean   : 10.180 ms
   Min    : 8.363 ms
   Max    : 21.723 ms
   Total  : 600.639 ms

 Running atrous multiple iterations
 ----------------------------------
   Mean   : 39.488 ms
   Min    : 39.071 ms
   Max    : 40.125 ms
   Total  : 2329.813 ms

 Total
 -----
   Mean   : 51.696 ms
   Min    : 49.515 ms
   Max    : 63.598 ms
   Total  : 3050.049 ms

The code is not thoroughly optimized due to time constraints.

When run on desktop hardware, the algorithm is fit for more than 60 frames per second.

Acknowledgements

Much of the utility code and the structure of the OpenCL code is adapted from Koskela et al.'s Blockwise Multi-Order Feature Regression implementation, although the algorithm itself is completely different.