Git Product home page Git Product logo

cis-565-4-cuda-denoiser's Introduction

CUDA Denoiser For CUDA Path Tracer

University of Pennsylvania, CIS 565: GPU Programming and Architecture, Project 4

Repo link

Tested on: Windows 10, i7-10750H @ 2.60GHz, 16GB, GTX 3060 6GB

Feature

A real-time path tracing denoiser. Reference: Spatiotemporal variance-guided filtering: real-time reconstruction for path-traced global illumination.

feature.mp4

G-Buffer optimization

In order to better represent the geometries of reflection, I blend the geometries according to material types:

Diffuse material:

  • Albedo buffer: store first bounce albedo

  • Normal buffer: store first bounce normal

  • Depth buffer: store first bounce depth

Glossy Material:

  • Albedo buffer: blend the first and second bounce albedo

  • Normal buffer: store first bounce normal

  • Depth buffer: store first bounce depth

Specular Material:

  • Albedo buffer: blend the albedo until hits non-specular material

  • Normal buffer: store the first non-specular material's normal

  • Dpeth buffer: accumulate the depth until hits non-specular material

This denoiser is based on SVGF so there is another buffer storing the square luma.

The square luma is calculated by:

$SqrLuma = ({ 0.299, 0.587, 0.114 } \cdot ( Color \div (Albedo + \epsilon ))^2$

Also notice that the final albedo buffer is the blend of all spp's albedo buffer.

Denoiser

The denoiser is essentially a bilateral wavelet filter. Its weight can be denoted by:

$W = W_Z \cdot W_N \cdot W_L$

where

$W_Z = \exp(-\frac{|Z(p) - Z(q)|}{\sigma_Z + \epsilon})$

$W_N = \mathrm{max}(0, N(p) \cdot N(q))^{\sigma_N}$

$W_L = \exp(-\frac{|L(p) - L(q)|}{\sigma_L \cdot Dev + \epsilon})$

Where the luminance $L$ is calculated by

$L = Color \div (Albedo + \epsilon )$

The deviation $Dev$ is calculated by:

$\mathrm{clamp}(g_{3 \times 3}(\sqrt{|SqrLuma(p)-({ 0.299, 0.587, 0.114 }\cdot L(p))^2|}), \epsilon, 1)$

where $g_{3 \times 3}$ is the 3X3 gaussian filter.

In practice, the filter size is 5X5, $\sigma_Z$ is 1, $\sigma_N$ is 64, and $\sigma_L$ is 4. The image will be iteratively denoised 4 times, with the dilation of 1, 2, 4, and 8.

To stabilize the preview, the GUI will blend the last result and the current result.

Comapre to Gaussian Filter

wavelet filter gaussian filter

The results of wavelet filter and gaussian filter look similar. However, the computation of wavelet filter is less.

Performance Analysis

As shown in the demonstration video, it took 64 iterations for generating a plausible result for an inner scene.

Performance impacted by resolutions

Performance impacted by luminance weight

By introducing the luminance weight, the filter will be aware of the edges between light and dark, thus better preserving the edges of shadows and light sources.

Also, introducing the deviation term further improves the edge preservation and can decrease the blurring as the rendering result converges. With more and more samples, the $Dev$ and $W_L$ will become closer to zero.

Performance impacted by wavelet filter

By adding dilations, wavelet filters can a have larger reception field than normal filters with similar computational costs.

5x5 wavelet filter, 4 times, 4.96ms 9x9 normal filter, 5ms

At the same time cost, the wavelet filter generates better result.

Performance impacted by filter size

9x9 wavelet filter, 4 times, 18.5ms 7x7 wavelet filter, 4 times, 10.9ms
5x5 wavelet filter, 4 times, 4.96ms 3x3 wavelet filter, 4 times, 2ms

cis-565-4-cuda-denoiser's People

Contributors

kainino0x avatar likangning93 avatar iwakurarein avatar shrekshao avatar shehzan10 avatar austineng avatar pjcozzi avatar yvin3d avatar j9liu avatar codeplay9800 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.