Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8421472
Remove unused freeglut copyrights
shehzan10 Jan 16, 2021
a79ca55
Update CUDA Computes List
shehzan10 Sep 10, 2021
78e028a
Retab
shehzan10 Sep 10, 2021
c03780d
Update instructions for Fall 2021
shehzan10 Sep 18, 2021
80ad206
Add vulkan option
shehzan10 Sep 18, 2021
cc3da39
Add sample readmes for inspiration
shehzan10 Sep 19, 2021
784f5ca
Merge pull request #1 from CIS565-Fall-2021/update-instructions-2021
shehzan10 Sep 21, 2021
6d7e696
Added Imgui Integration Files
codeplay9800 Sep 19, 2022
8462d52
Updated Instruction.md
codeplay9800 Sep 19, 2022
c44fccb
Update Instruction.md
codeplay9800 Sep 19, 2022
7165f5c
Merge branch 'main' into Integrate_Imgui
codeplay9800 Sep 19, 2022
26e8bf3
Imgui Integrated
codeplay9800 Sep 20, 2022
3dac24e
Added GUIDataContainer Class
codeplay9800 Sep 20, 2022
e666e6a
Removed ImGUI Cmake
codeplay9800 Sep 21, 2022
5000086
Update INSTRUCTION.md
shehzan10 Sep 21, 2022
98f098c
Fix a bug that causes MouseOverImGuiWindow() to not work
dw218192 Sep 22, 2022
16d6638
Merge pull request #1 from dw218192/patch-1
codeplay9800 Sep 22, 2022
fa270e5
Update INSTRUCTION.md
HummaWhite Sep 16, 2023
0f1be54
Added a section for optimization
wayne-wu Sep 18, 2023
c5d6523
Update INSTRUCTION.md
HummaWhite Sep 19, 2023
6806944
Update pathtrace.cu
danielzhong Sep 24, 2023
239e6b2
Update pathtrace.cu
danielzhong Sep 26, 2023
aba981e
Diffuse & Specular
danielzhong Sep 27, 2023
5946c3a
Refract, GLTF, texture
danielzhong Sep 29, 2023
5a13189
Update glassTest.txt
danielzhong Sep 29, 2023
f6590a7
Update scene.cpp
danielzhong Sep 29, 2023
2d2511e
Antialiasing, but it looks like no difference
danielzhong Sep 29, 2023
34c7313
Completed Anti Aliasing and SkyBox Texture
danielzhong Oct 2, 2023
66ba228
Add random spawn sphere scene, procedural shape and noise textures
danielzhong Oct 5, 2023
3b209ee
adding more procedural
danielzhong Oct 6, 2023
f0201b0
More procedural shape
danielzhong Oct 6, 2023
b8d34e0
Reorganize scene, rewrite perlin noise color
danielzhong Oct 6, 2023
362539d
update
danielzhong Oct 6, 2023
cf00c18
Update interactions.h
danielzhong Oct 6, 2023
afc4633
Add PBR glass diffuse metal, pbr DOF blur, add README
danielzhong Oct 7, 2023
d03ce3f
clean up
danielzhong Oct 7, 2023
bc42d4f
Update README
danielzhong Oct 8, 2023
0d6ad1e
Denoise
danielzhong Oct 21, 2023
df6328d
updating readme
danielzhong Oct 21, 2023
7a5e800
Update README
danielzhong Oct 21, 2023
596644a
Update README.md
danielzhong Oct 21, 2023
c5f0eaa
Adjusting default value, not changing code
danielzhong Oct 21, 2023
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
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ set(headers
src/sceneStructs.h
src/preview.h
src/utilities.h
src/ImGui/imconfig.h
src/gltfLoader.h

src/ImGui/imgui.h
src/ImGui/imconfig.h
src/ImGui/imgui_impl_glfw.h
src/ImGui/imgui_impl_opengl3.h
src/ImGui/imgui_impl_opengl3_loader.h
src/ImGui/imgui_internal.h
src/ImGui/imstb_rectpack.h
src/ImGui/imstb_textedit.h
src/ImGui/imstb_truetype.h
)

set(sources
Expand All @@ -84,6 +96,15 @@ set(sources
src/scene.cpp
src/preview.cpp
src/utilities.cpp
src/gltfLoader.cpp

src/ImGui/imgui.cpp
src/ImGui/imgui_demo.cpp
src/ImGui/imgui_draw.cpp
src/ImGui/imgui_impl_glfw.cpp
src/ImGui/imgui_impl_opengl3.cpp
src/ImGui/imgui_tables.cpp
src/ImGui/imgui_widgets.cpp
)

list(SORT headers)
Expand All @@ -92,6 +113,7 @@ list(SORT sources)
source_group(Headers FILES ${headers})
source_group(Sources FILES ${sources})

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

cuda_add_executable(${CMAKE_PROJECT_NAME} ${sources} ${headers})
Expand Down
196 changes: 101 additions & 95 deletions INSTRUCTION.md

Large diffs are not rendered by default.

80 changes: 72 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,77 @@
CUDA Path Tracer
================
# Denoised for CUDA GPU-Accelerated Path Tracing

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

* (TODO) YOUR NAME HERE
* Tested on: (TODO) Windows 22, i7-2222 @ 2.22GHz 22GB, GTX 222 222MB (Moore 2222 Lab)
**University of Pennsylvania, CIS 565: GPU Programming and Architecture, Project 2**

### (TODO: Your README)
* Ruijun(Daniel) Zhong
* [LinkedIn](https://www.linkedin.com/in/daniel-z-73158b152/)
* [Personal Website](https://www.danielzhongportfolio.com/)
* Tested on: Windows 11 pro, 12th Gen Intel(R) Core(TM) i7-12700K 3.61 GHz 32.0 GB, NVIDIA GeForce RTX 3070 Ti (personal computer)

*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.
## Abstract
This repository showcases a state-of-the-art CUDA-accelerated path tracer, innovatively integrated with the A-Trous denoising technique. The A-Trous denoising method, inspired by the seminal work [Wojciech Jarosz's paper](https://jo.dreggn.org/home/2010_atrous.pdf), enhances the quality of rendered images by effectively reducing the noise produced in path tracing, offering both visual clarity and computational efficiency.

## Demo
|<img src="./img/noisy.png" width="100%">|<img src="img/denoised.png" width="100%">|
|:-:|:-:|
|Original|Denoised|

|<img src="./img/DenoiseOriginal.png" width="100%">|<img src="./img/DenoiseAfter.png" width="100%">|
|:-:|:-:|
|Original|Denoised|


## Break Down
1. implement G-Buffers for normals and positions and visualize

|<img src="img/time-of-flight.png" width="100%">|<img src="img/normals.png" width="100%">|<img src="img/positions.png" width="100%">|
|:-:|:-:|:-:|
|Time of Flight|Normals|Positions|

|<img src="img/GbufferTOF.png" width="100%">|<img src="img/GbufferNormal.png" width="100%">|<img src="img/GbufferPosition.png" width="100%">|
|:-:|:-:|:-:|
|Time of Flight|Normals|Positions|

2. Simple blur effect

|<img src="img/simple_blur.png" width="100%">|
|:-:|
|Simple blur|

3. Add weight parameters & use the G-Buffers to preserve perceived edges

|<img src="./img/denoised.png" width="100%">|<img src="./img/DenoiseAfter.png" width="100%">|
|:-:|:-:|
|Denoised|Denoised|

## Runtime analysis
### Filter size impact on time:
<img src="img/FilterSize.png" width="100%">

Resolution size impact on time:
### <img src="img/Resolution.png" width="100%">

Both filter size and resolution will impact denoise time as they increase. However, overall denoise time is acceptable.

## Quality analysis
### Filter Size Impact:
|<img src="img/Metal10.png" width="100%">|<img src="img/Metal30.png" width="100%">|<img src="img/Metal 50.png" width="100%">|
|:-:|:-:|:-:|
|10|30|50|

As we can see in the pictures, more filter size will denoise the scene better.

### Different material(Same parameter weight):
|<img src="img/Metal10.png" width="100%">|<img src="img/diffuse10.png" width="100%">|<img src="img/Glass10.png" width="100%">|
|:-:|:-:|:-:|
|Metal|Diffuse|Texture & Glass|


From the images, it's evident that texture and glass pose significant challenges for denoising. The transparency appears overly blurred, and regarding the texture, further refinement is likely needed. Incorporating the texture value into the gbuffer might enhance the results when using the A-Trous wavelet approach.

### Different Scene(Same parameter weight):
|<img src="./img/CornelMetal.png" width="100%">|<img src="./img/Metal 50.png" width="100%">|
|:-:|:-:|
|Regular Cornell Box|Larger Ceiling Light Cornell Box|

Based on the pictures, we can tell that a larger light source in path tracing reduces noise better. Becuase A-Trous wavelet denoising technique is applied to such images. it calculates scene details and noise, preserving edges and details while efficiently eliminating residual noise, resulting in a clearer and sharper denoised image.
8 changes: 5 additions & 3 deletions cmake/CUDAComputesList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ IF( CUDA_COMPUTE_20
OR CUDA_COMPUTE_70
OR CUDA_COMPUTE_72
OR CUDA_COMPUTE_75
OR CUDA_COMPUTE_80
OR CUDA_COMPUTE_86
)
SET(FALLBACK OFF)
ELSE()
Expand All @@ -70,8 +72,8 @@ LIST(LENGTH COMPUTES_DETECTED_LIST COMPUTES_LEN)
IF(${COMPUTES_LEN} EQUAL 0 AND ${FALLBACK})
MESSAGE(STATUS "You can use -DCOMPUTES_DETECTED_LIST=\"AB;XY\" (semicolon separated list of CUDA Compute versions to enable the specified computes")
MESSAGE(STATUS "Individual compute versions flags are also available under CMake Advance options")
LIST(APPEND COMPUTES_DETECTED_LIST "30" "50" "60" "70")
MESSAGE(STATUS "No computes detected. Fall back to 30, 50, 60 70")
LIST(APPEND COMPUTES_DETECTED_LIST "30" "50" "60" "70" "80")
MESSAGE(STATUS "No computes detected. Fall back to 30, 50, 60, 70, 80")
ENDIF()

LIST(LENGTH COMPUTES_DETECTED_LIST COMPUTES_LEN)
Expand All @@ -90,7 +92,7 @@ MACRO(SET_COMPUTE VERSION)
ENDMACRO(SET_COMPUTE)

# Iterate over compute versions. Create variables and enable computes if needed
FOREACH(VER 20 30 32 35 37 50 52 53 60 61 62 70 72 75)
FOREACH(VER 20 30 32 35 37 50 52 53 60 61 62 70 72 75 80 86)
OPTION(CUDA_COMPUTE_${VER} "CUDA Compute Capability ${VER}" OFF)
MARK_AS_ADVANCED(CUDA_COMPUTE_${VER})
IF(${CUDA_COMPUTE_${VER}})
Expand Down
96 changes: 48 additions & 48 deletions cmake/FindGLFW.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,66 +20,66 @@
include(FindPackageHandleStandardArgs)

if (WIN32)
# Find include files
find_path(
GLFW_INCLUDE_DIR
NAMES GLFW/glfw3.h
PATHS
$ENV{PROGRAMFILES}/include
${GLFW_ROOT_DIR}/include
DOC "The directory where GLFW/glfw.h resides")
# Find include files
find_path(
GLFW_INCLUDE_DIR
NAMES GLFW/glfw3.h
PATHS
$ENV{PROGRAMFILES}/include
${GLFW_ROOT_DIR}/include
DOC "The directory where GLFW/glfw.h resides")

# Use glfw3.lib for static library
if (GLFW_USE_STATIC_LIBS)
set(GLFW_LIBRARY_NAME glfw3)
else()
set(GLFW_LIBRARY_NAME glfw3dll)
endif()
# Use glfw3.lib for static library
if (GLFW_USE_STATIC_LIBS)
set(GLFW_LIBRARY_NAME glfw3)
else()
set(GLFW_LIBRARY_NAME glfw3dll)
endif()

# Find library files
find_library(
GLFW_LIBRARY
NAMES ${GLFW_LIBRARY_NAME}
PATHS
$ENV{PROGRAMFILES}/lib
${GLFW_ROOT_DIR}/lib)
# Find library files
find_library(
GLFW_LIBRARY
NAMES ${GLFW_LIBRARY_NAME}
PATHS
$ENV{PROGRAMFILES}/lib
${GLFW_ROOT_DIR}/lib)

unset(GLFW_LIBRARY_NAME)
unset(GLFW_LIBRARY_NAME)
else()
# Find include files
find_path(
GLFW_INCLUDE_DIR
NAMES GLFW/glfw.h
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "The directory where GL/glfw.h resides")
# Find include files
find_path(
GLFW_INCLUDE_DIR
NAMES GLFW/glfw.h
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "The directory where GL/glfw.h resides")

# Find library files
# Try to use static libraries
find_library(
GLFW_LIBRARY
NAMES glfw3
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
${GLFW_ROOT_DIR}/lib
DOC "The GLFW library")
# Find library files
# Try to use static libraries
find_library(
GLFW_LIBRARY
NAMES glfw3
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
${GLFW_ROOT_DIR}/lib
DOC "The GLFW library")
endif()

# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(GLFW DEFAULT_MSG GLFW_INCLUDE_DIR GLFW_LIBRARY)

# Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS
if (GLFW_FOUND)
set(GLFW_LIBRARIES ${OPENGL_LIBRARIES} ${GLFW_LIBRARY})
set(GLFW_INCLUDE_DIRS ${GLFW_INCLUDE_DIR})
set(GLFW_LIBRARIES ${OPENGL_LIBRARIES} ${GLFW_LIBRARY})
set(GLFW_INCLUDE_DIRS ${GLFW_INCLUDE_DIR})
endif()

# Hide some variables
Expand Down
44 changes: 22 additions & 22 deletions cmake/FindGLM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# Find GLM
#
# Try to find GLM : OpenGL Mathematics.
# This module defines
# This module defines
# - GLM_INCLUDE_DIRS
# - GLM_FOUND
#
# The following variables can be set as arguments for the module.
# - GLM_ROOT_DIR : Root library directory of GLM
# - GLM_ROOT_DIR : Root library directory of GLM
#
# References:
# - https://github.com/Groovounet/glm/blob/master/util/FindGLM.cmake
Expand All @@ -18,34 +18,34 @@
include(FindPackageHandleStandardArgs)

if (WIN32)
# Find include files
find_path(
GLM_INCLUDE_DIR
NAMES glm/glm.hpp
PATHS
$ENV{PROGRAMFILES}/include
${GLM_ROOT_DIR}/include
DOC "The directory where glm/glm.hpp resides")
# Find include files
find_path(
GLM_INCLUDE_DIR
NAMES glm/glm.hpp
PATHS
$ENV{PROGRAMFILES}/include
${GLM_ROOT_DIR}/include
DOC "The directory where glm/glm.hpp resides")
else()
# Find include files
find_path(
GLM_INCLUDE_DIR
NAMES glm/glm.hpp
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
${GLM_ROOT_DIR}/include
DOC "The directory where glm/glm.hpp resides")
# Find include files
find_path(
GLM_INCLUDE_DIR
NAMES glm/glm.hpp
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
${GLM_ROOT_DIR}/include
DOC "The directory where glm/glm.hpp resides")
endif()

# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(GLM DEFAULT_MSG GLM_INCLUDE_DIR)

# Define GLM_INCLUDE_DIRS
if (GLM_FOUND)
set(GLM_INCLUDE_DIRS ${GLM_INCLUDE_DIR})
set(GLM_INCLUDE_DIRS ${GLM_INCLUDE_DIR})
endif()

# Hide some variables
Expand Down
27 changes: 0 additions & 27 deletions external/include/GL/Copying.txt

This file was deleted.

Loading