Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 116 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,122 @@
CUDA Denoiser For CUDA Path Tracer
==================================
CUDA Path Tracer Denoiser
================

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

* (TODO) YOUR NAME HERE
* Tested on: (TODO) Windows 22, i7-2222 @ 2.22GHz 22GB, GTX 222 222MB (Moore 2222 Lab)

### (TODO: Your README)
* Yilin Liu
* [LinkedIn](https://www.linkedin.com/in/yilin-liu-9538ba1a5/)
* [Personal website](https://www.yilin.games)
* Tested on personal laptop:
- Windows 10, Intel(R) Core(TM), i7-10750H CPU @ 2.60GHz 2.59 GHz, RTX 2070 Max-Q 8GB

*DO NOT* leave the README to the last minute! It is a crucial part of the
project, and we will not be able to grade you without a good README.
Overview
=============

In this project I implemented a pathtracing denoiser that runs on CUDA and directs a smoothing filter using geometry buffers (G-buffers). It helps provide a smoother appearance in a pathtraced image with fewer samples per pixel and is based on the study "Edge-Avoiding A-Trous Wavelet Transform for rapid Global Illumination Filtering."

Features
=============
* A-Trous denoiser
* G Buffer visualization


Performance Analysis
============
**Additional Time for Each Frame**

The additional time varies from 1ms to ~10ms depending on the resolution. In a typical frame of 800x800, the average denoising time is 3ms.

**How denoising influences the number of iterations needed to get an "acceptably smooth" result**

A denoised image with 30 iteratiions could qualify the naive path traced image with 1000 iterations!

| 30 samples denoised image | 1000 samples naive image |
:-------:|:-------:
|![](img/denoiser/denoise_2.png)|![](img/original_50_iter.png) |

**How denoising at different resolutions impacts runtime**

From the table below, we could see that the time for denoising increases linearly as the resolution increases. However, when the filter size reaches 80, the time becomes almost constant.

| Denoising time vs Resolution |
|:--:|
|![image](img/denoiser/time.png)|

**How varying filter sizes affect performance**

The effect of filter size increases initially and goes down later.


| Denoising time vs Resolution |
|:--:|
|![image](img/denoiser/time_fs.png)|

**how visual results vary with filter size -- does the visual quality scale uniformly with filter size?**

We can see from the table below that while the filter size is below 30, the denoise effect is not significant enough. When the filter size goes large, the background is blurred. Therefore, the ideal range of an efficient filter size should be between 30 to 60.

| Filter Size | Image |
:-------:|:-------:
|5|![](img/denoiser/fs5.png) |
|10|![](img/denoiser/fs10.png) |
|20|![](img/denoiser/fs20.png) |
|30|![](img/denoiser/fs30.png) |
|40|![](img/denoiser/fs50.png) |
|50|![](img/denoiser/fs60.png) |
|60|![](img/denoiser/fs70.png) |
|70|![](img/denoiser/fs80.png) |
|80|![](img/denoiser/fs90.png) |
|90|![](img/denoiser/fs100.png) |
|100|![](img/denoiser/fs110.png) |

**how effective/ineffective is this method with different material types**

We can see that the denoiser works fine on alll types of materials except that the refractiion could be blurred a little bit.

| Materials | Orignial Image| Denoised Image |
:-------:|:-------:|:-------:
|Diffuse|![](img/denoiser/diffuse_naive.png) |![](img/denoiser/diffuse_denoised.png) |
|Specular|![](img/denoiser/specular_naive.png) |![](img/denoiser/fs50.png) |
|Refractive|![](img/denoiser/refract_naive.png) |![](img/denoiser/refract_denoised.png) |

**How do results compare across different scenes - for example, between cornell.txt and cornell_ceiling_light.txt. Does one scene produce better denoised results? Why or why not?**

In my case, the denoiser works better in brighter scene. The reason is, with a light that has a larger areas, more paths fall onto the light source within a limited number of iterations and the scene converges faster. As a result, there are less noises inherently in the scene and leave less work for the denoiser whose performance could significantly be influenced by the initial conditions.


**Other scenes**

We can see from the table below that the denoiser fails to work to render a bunny with ~50 samples. The reason could be that too many triangles with different information are concentreted in a small range. The problem can be mitigated when we switch to a small size filter.



| Bunny with 50 samples | Denosied Bunny with Filter Size 60 | Denosied Bunny with Filter Size 25 |
:-------:|:-------:|:-------:
|![](img/denoiser/bunny_naive.png)|![](img/denoiser/bunny_denoised.png) |![](img/denoiser/bunny_denoised25.png) |


**G Buffers**


| World Normal | Position |
:-------:|:-------:
|![](img/denoiser/normal.png)|![](img/denoiser/pos.png) |


Bloopers
===============
| *G-Buffer Position Fail* |
|:--:|
|![image](img/bloopers/gbuffer_pos_bug2.png)|


| *G-Buffer Position Fail2* |
|:--:|
|![image](img/bloopers/gbuffer_pos_bug3.png)|

Reference
===============
* [Edge-Avoiding A-Trous Wavelet Transform for fast Global Illumination Filtering](https://jo.dreggn.org/home/2010_atrous.pdf)

* [imgui]( https://github.com/ocornut/imgui)
Binary file added img/2096 iteration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/AA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/FD10_R05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/FD10_R1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/NO_AA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/aa_comparision.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/aa_large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/bloopers/cow1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/bloopers/cow2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/bloopers/gbuffer_pos_bug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/bloopers/gbuffer_pos_bug2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/bloopers/gbuffer_pos_bug3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/bloopers/refract_fail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/bloopers/refract_fail2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/bunny_refract.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/cover2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/denoiser/1000sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/denoiser/30sample_denoiser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/denoiser/bunny_denoised.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/denoiser/bunny_denoised25.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/denoiser/bunny_naive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/denoiser/denoise_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/denoiser/diffuse_denoised.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/denoiser/diffuse_naive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/denoiser/fs10.png
Binary file added img/denoiser/fs100.png
Binary file added img/denoiser/fs110.png
Binary file added img/denoiser/fs20.png
Binary file added img/denoiser/fs30.png
Binary file added img/denoiser/fs5.png
Binary file added img/denoiser/fs50.png
Binary file added img/denoiser/fs60.png
Binary file added img/denoiser/fs70.png
Binary file added img/denoiser/fs80.png
Binary file added img/denoiser/fs90.png
Binary file added img/denoiser/normal.png
Binary file added img/denoiser/pos.png
Binary file added img/denoiser/refract_denoised.png
Binary file added img/denoiser/refract_naive.png
Binary file added img/denoiser/specular_naive.png
Binary file added img/denoiser/time.png
Binary file added img/denoiser/time_fs.png
Binary file added img/figure/bbcheck.png
Binary file added img/figure/cache.png
Binary file added img/figure/ms.png
Binary file added img/figure/sc.png
Binary file added img/motion_blur_camera.png
Binary file added img/motion_blur_camera2.png
Binary file added img/motion_blur_object.png
Binary file added img/motion_blur_object2.png
Binary file added img/noAA_large.png
Binary file added img/original_50_iter.png
Binary file added img/refraction.png
Binary file added img/refraction2.png
Binary file added img/release mode .png
48 changes: 38 additions & 10 deletions scenes/cornell.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ REFR 0
REFRIOR 0
EMITTANCE 0

// Refractive white
MATERIAL 5
RGB .98 .98 .98
SPECEX 0
SPECRGB .98 .98 .98
REFL 0
REFR 1
REFRIOR 0.71
EMITTANCE 0

// Camera
CAMERA
RES 800 800
Expand All @@ -66,52 +76,70 @@ cube
material 0
TRANS 0 10 0
ROTAT 0 0 0
SCALE 3 .3 3
SCALE 5 .3 5

// Floor
OBJECT 1
cube
material 1
TRANS 0 0 0
ROTAT 0 0 0
SCALE 10 .01 10
SCALE 18 .01 18

// Ceiling
OBJECT 2
cube
material 1
TRANS 0 10 0
ROTAT 0 0 90
SCALE .01 10 10
SCALE .01 18 18

// Back wall
OBJECT 3
cube
material 1
TRANS 0 5 -5
TRANS 0 5 -4
ROTAT 0 90 0
SCALE .01 10 10

// Left wall
OBJECT 4
cube
material 2
TRANS -5 5 0
TRANS -8 5 0
ROTAT 0 0 0
SCALE .01 10 10

// Right wall
OBJECT 5
cube
material 3
TRANS 5 5 0
TRANS 8 5 0
ROTAT 0 0 0
SCALE .01 10 10

// Sphere


// Sphere 3
//OBJECT 6
//sphere
//material 5
//TRANS -5 4 -1
//ROTAT 0 0 0
//SCALE 3 3 3

// Back wall
OBJECT 6
sphere
cube
material 1
TRANS 0 5 -6
ROTAT 0 90 0
SCALE .01 20 20

// Bunny
OBJECT 7
obj
material 4
TRANS -1 4 -1
TRANS 0 -2 0
ROTAT 0 0 0
SCALE 3 3 3
SCALE 50 50 50
12 changes: 11 additions & 1 deletion scenes/cornell_ceiling_light.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,21 @@ REFR 0
REFRIOR 0
EMITTANCE 0

// Refractive white
MATERIAL 5
RGB .98 .98 .98
SPECEX 0
SPECRGB .98 .98 .98
REFL 0
REFR 1
REFRIOR 0.71
EMITTANCE 0

// Camera
CAMERA
RES 800 800
FOVY 45
ITERATIONS 10
ITERATIONS 30
DEPTH 8
FILE cornell
EYE 0.0 5 10.5
Expand Down
Loading