Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project 4: Jilin Liu #1

Open
wants to merge 37 commits into
base: base-code
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4637a12
Add naive scatter
Songsong97 Sep 27, 2020
20a2663
add basic path tracer
Songsong97 Sep 28, 2020
d1f7331
Add cache first bounce, material sort
Songsong97 Sep 29, 2020
6797a45
Update README.md
Songsong97 Sep 29, 2020
0504173
Merge branch 'mid-project-submission'
Songsong97 Sep 29, 2020
0054d28
Add demo
Songsong97 Sep 29, 2020
2b8f399
Merge branch 'mid-project-submission'
Songsong97 Sep 29, 2020
ad2e9c8
fix a bug
Songsong97 Sep 30, 2020
b76cc6d
Add fresnel with bug
Songsong97 Sep 30, 2020
b34d6ef
Fix the bug of fresnel refraction
Songsong97 Oct 1, 2020
79eb33b
Improve refraction
Songsong97 Oct 3, 2020
91e4a24
add milestone
Songsong97 Oct 3, 2020
de29c33
import tiny_gltf
Songsong97 Oct 3, 2020
22aedce
Add naive triangle ray intersection
Songsong97 Oct 4, 2020
836d0aa
Add mesh loader
Songsong97 Oct 5, 2020
4801ceb
Add none
Songsong97 Oct 6, 2020
963ed39
Add octree. Todo: GPU intersection based on octree.
Songsong97 Oct 6, 2020
4f978ac
Add naive octree
Songsong97 Oct 8, 2020
62a53d6
Troubleshooting
Songsong97 Oct 8, 2020
df9693e
Add octree
Songsong97 Oct 8, 2020
3216178
Add scenes
Songsong97 Oct 9, 2020
fd52321
Update README.md
Songsong97 Oct 9, 2020
ec05a73
Add images
Songsong97 Oct 9, 2020
60c9e66
Update README.md
Songsong97 Oct 9, 2020
d38dbbc
Add images
Songsong97 Oct 9, 2020
5807056
Merge branch 'master' of github.com:Songsong97/Project3-CUDA-Path-Tracer
Songsong97 Oct 9, 2020
44be749
Add imgui
Songsong97 Oct 16, 2020
927e250
Add GBuffer Capture and Visualization
Songsong97 Oct 17, 2020
19d3b72
Add denoise
Songsong97 Oct 17, 2020
b87bcce
Add denoise
Songsong97 Oct 18, 2020
fffb5dc
Update README.md
Songsong97 Oct 18, 2020
7c149b8
Update README.md
Songsong97 Oct 18, 2020
04650b6
Add images
Songsong97 Oct 18, 2020
8a5c3e9
Merge branch 'denoiser' of github.com:Songsong97/Project4-CUDA-Denois…
Songsong97 Oct 18, 2020
4b8fb69
Add image
Songsong97 Oct 18, 2020
c331761
Update README.md
Songsong97 Oct 18, 2020
2bf8d60
Update README.md
Songsong97 Dec 1, 2020
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
24 changes: 23 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ set(headers
src/sceneStructs.h
src/preview.h
src/utilities.h
src/mesh.h
src/json.hpp
src/tiny_gltf.h
)

set(sources
Expand All @@ -84,17 +87,36 @@ set(sources
src/scene.cpp
src/preview.cpp
src/utilities.cpp
src/mesh.cpp
)

set(imgui
imgui/imconfig.h
imgui/imgui.cpp
imgui/imgui.h
imgui/imgui_draw.cpp
imgui/imgui_internal.h
imgui/imgui_widgets.cpp
imgui/imgui_demo.cpp
imgui/imgui_impl_glfw.cpp
imgui/imgui_impl_glfw.h
imgui/imgui_impl_opengl2.cpp
imgui/imgui_impl_opengl2.h
imgui/imgui_impl_opengl3.cpp
imgui/imgui_impl_opengl3.h
)

list(SORT headers)
list(SORT sources)
list(SORT imgui)

source_group(Headers FILES ${headers})
source_group(Sources FILES ${sources})
source_group(imgui FILES ${imgui})

#add_subdirectory(stream_compaction) # TODO: uncomment if using your stream compaction

cuda_add_executable(${CMAKE_PROJECT_NAME} ${sources} ${headers})
cuda_add_executable(${CMAKE_PROJECT_NAME} ${sources} ${headers} ${imgui})
target_link_libraries(${CMAKE_PROJECT_NAME}
${LIBRARIES}
#stream_compaction # TODO: uncomment if using your stream compaction
Expand Down
64 changes: 57 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,63 @@
CUDA Path Tracer
CUDA Pathtracing Denoiser
================

**University of Pennsylvania, CIS 565: GPU Programming and Architecture, Project 3**
**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)
* Jilin Liu
* [LinkedIn](https://www.linkedin.com/in/jilin-liu97/), [twitter](https://twitter.com/Jilin18043110).
* Tested on: Windows 10, i7-8750H @ 2.20GHz, 16GB, GTX 1050Ti 4096MB (personal)

### (TODO: Your README)
## Features and Results

*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.
This is a GPU-based Denoiser for Monte Carlo path-traced images implemented in C++ and CUDA.
Denoisers can help produce a smoother appearance in a pathtraced image with fewer samples-per-pixel/iterations.

![](./img/compareDenoise.JPG)

The technique is based on "Edge-Avoiding A-Trous Wavelet Transform for fast Global Illumination Filtering," by Dammertz, Sewtz, Hanika, and Lensch. You can find the paper here: https://jo.dreggn.org/home/2010_atrous.pdf. The raytracing part is based on [this repo](https://github.com/Songsong97/Project3-CUDA-Path-Tracer).

Features:
1. Basic denoiser for Monte-Carlo ray-traced images.
2. Preserve sharp edges for rendered image by using G-Buffer.

## Performance Analysis

### Timing
The denoiser adds a constant overhead to get the final result.

| Scene | ray tracing (one sample iteration) | denoising |
|---|---|---|
| [Cornell Box](./img/non.png) | 18ms | 58ms |
| [Halloween](./img/halloween.png) | 944ms | 58ms |

Since we denoise the image only once, the time is generally much shorter than what the ray-tracing stage takes. This makes sense because the key point for denoiser is to reduce the number of samples for rendering. Further optimization could be made to the denoiser to achieve real-time performance.

### Number of iterations
About 5 to 8 iterations are needed to get an acceptably smooth result. Sometimes it is necessary to increase the number of iterations to get rid of artifacts on edges. For example, when we only sample 5 rays per pixel, there will be visible strange lines in the corner.

![](./img/artifact.JPG)

This artifact will be smoothed if we sample 7 rays per pixel or more.

![](./img/c7.png)

### Execution time at different resolutions
The denoiser's execution time is proportional to the image resolution, which is expected as the theoretical complexity is O(pixelCount).

| 800 * 800 | 1600 * 1600 |
|---|---|
| 58ms | 233ms |

### Denoise with different material types
The denoiser is unaware of any material types in the scene. So many different types of material only affect ray tracing part but do not affect denoising part. As mentioned before, the algorithm is only bounded by the pixel number.

### Limitation
When denoising Cornell Box with smaller area light, it works much worse than brighter scenes. The authors of the paper used HDR for their environment, so it might be easier for them to preserve the color of the scene. When the scene is under sampled, the denoiser typically gives us a result that looks dark and stained.

![](./img/cornellDenoised.png)

![](./img/halloweenComp.JPG)

It is also tricky to tune parameters for the Gaussian kernel.

The author mentioned in the paper that, for highly complex scenes, the algorithm is problematic since low number of samples no longer suffice to capture the necessary information.
Loading