Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 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
8c596e8
a basci path tracer
SydianAndrewChen Sep 20, 2023
bf259ae
refactor integrator
SydianAndrewChen Sep 20, 2023
2541d28
add primitive
SydianAndrewChen Sep 21, 2023
37d72d2
first try to add primitive and triangles
SydianAndrewChen Sep 22, 2023
582abcf
fix triangle intersection bug
SydianAndrewChen Sep 22, 2023
c45e4b2
finish gltf triangle mesh loading
SydianAndrewChen Sep 23, 2023
841ec3a
Merge branch 'dev_mesh'
SydianAndrewChen Sep 23, 2023
f84f96f
change old scene
SydianAndrewChen Sep 26, 2023
5451e3e
change assembler to scene
SydianAndrewChen Sep 26, 2023
7edd294
removee deprecated scene
SydianAndrewChen Sep 26, 2023
439c206
a slightly cleaner version
SydianAndrewChen Sep 26, 2023
9e80b94
add bsdf with a cleaner way
SydianAndrewChen Sep 26, 2023
01200e2
update scene
SydianAndrewChen Sep 26, 2023
12ebd8f
add bsdf
SydianAndrewChen Sep 26, 2023
feb4370
add a cleaner version of bsdf
SydianAndrewChen Sep 26, 2023
25b0448
fix normal
SydianAndrewChen Sep 26, 2023
7fcb7c1
fix occlusion & change tri intersection
SydianAndrewChen Sep 26, 2023
382c12f
may finish triangle & bsdf finally
SydianAndrewChen Sep 27, 2023
29e90f8
update README
SydianAndrewChen Sep 27, 2023
2a18400
cleaner version of pathtrace
SydianAndrewChen Sep 27, 2023
eb26190
add macro for estim lighting and change bsdf sample
SydianAndrewChen Sep 27, 2023
09d1a5c
first trial on serialized bvh
SydianAndrewChen Sep 27, 2023
7759ec8
naive bvh first trial
SydianAndrewChen Sep 28, 2023
b21363e
naive bvh probably finished
SydianAndrewChen Sep 28, 2023
24594e1
finish gbuffer
SydianAndrewChen Sep 28, 2023
20446cf
first trial on SAH
SydianAndrewChen Sep 28, 2023
e4b3fb9
first finish on SAH(probably...)
SydianAndrewChen Sep 28, 2023
64e7b99
start working on texturing
SydianAndrewChen Sep 28, 2023
bc3a65e
finish billboarding
SydianAndrewChen Sep 29, 2023
f19bda9
add bump mapping & first trial on microfacet bsdf
SydianAndrewChen Sep 30, 2023
d250e8a
update README
SydianAndrewChen Sep 30, 2023
ca13eda
change scene load to relative path
SydianAndrewChen Sep 30, 2023
3acd32d
add jitter
SydianAndrewChen Sep 30, 2023
4ae5e08
fix pdf bug of hemiSphereCosineWeightedSampling
SydianAndrewChen Sep 30, 2023
71db279
refactor mainloop new free
SydianAndrewChen Sep 30, 2023
7689e5c
add toggable sort by bsdf
SydianAndrewChen Oct 1, 2023
6a64015
another trial on microfacet(seems to work)
SydianAndrewChen Oct 4, 2023
67e4b57
add more results
SydianAndrewChen Oct 4, 2023
14a8aa8
solve most issue of sampling light source
SydianAndrewChen Oct 5, 2023
e6e3e1d
add pdf function
SydianAndrewChen Oct 5, 2023
c70da34
finish direct lighting(noise not settled)
SydianAndrewChen Oct 6, 2023
6d385d9
refactor config
SydianAndrewChen Oct 6, 2023
ca5b695
first add env_map
SydianAndrewChen Oct 6, 2023
ac77c7f
add environmental mapping
SydianAndrewChen Oct 8, 2023
64f6a5e
fix random number bug & a better direct light sample
SydianAndrewChen Oct 8, 2023
16c7a3c
refactor bsdf math
SydianAndrewChen Oct 8, 2023
153fbab
fix scene scale issue
SydianAndrewChen Oct 9, 2023
90aba95
seems to have finished direct lighting & mis
SydianAndrewChen Oct 9, 2023
221eca1
add mis macro
SydianAndrewChen Oct 9, 2023
5ed009f
add rr
SydianAndrewChen Oct 9, 2023
8834485
refactor mis & speedup
SydianAndrewChen Oct 9, 2023
628db9a
add depth of field && realtime slider
SydianAndrewChen Oct 10, 2023
d5fd16f
more test scenen
SydianAndrewChen Oct 10, 2023
f5a841e
update README
SydianAndrewChen Oct 10, 2023
7b763e6
update field of depth imagee
SydianAndrewChen Oct 10, 2023
0232cdc
update README
SydianAndrewChen Oct 10, 2023
e5197b3
update README
SydianAndrewChen Oct 10, 2023
b962762
update env_map macro
SydianAndrewChen Oct 10, 2023
b41930a
update README
SydianAndrewChen Oct 10, 2023
b6a1c56
update README
SydianAndrewChen Oct 11, 2023
8bdbe6d
update README url
SydianAndrewChen Oct 11, 2023
5647b45
update README
SydianAndrewChen Oct 11, 2023
6fb46bb
update video url
SydianAndrewChen Oct 11, 2023
f4e4f42
add buffer combo gui
SydianAndrewChen Oct 19, 2023
10f5b59
finish basic denoiser
SydianAndrewChen Oct 20, 2023
8d5f9f4
finish denoiser
SydianAndrewChen Oct 20, 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
97 changes: 77 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,39 +62,96 @@ set(GLM_ROOT_DIR "external")
find_package(GLM REQUIRED)
include_directories(${GLM_INCLUDE_DIRS})

set(headers
src/main.h
src/image.h
set(material
src/bsdf.h
src/bsdfStruct.h
src/texture.h
src/textureStruct.h
)

set(scene
src/sceneStructs.h
src/interactions.h
src/intersections.h
src/glslUtility.hpp
src/pathtrace.h
src/light.h
src/lightStruct.h
src/config.h
src/config.cpp
src/scene.h
src/sceneStructs.h
src/preview.h
src/utilities.h
)
src/scene.cpp
src/bvh.h
src/bvh.cpp
)

set(sources
set(core
src/main.h
src/main.cpp
src/stb.cpp
src/preview.h
src/preview.cpp
src/image.h
src/image.cpp
src/glslUtility.cpp
src/pathtrace.h
src/pathtrace.cu
src/scene.cpp
src/preview.cpp
src/utilities.cpp
)

set(imgui
src/ImGui/imconfig.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
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)
list(SORT sources)
set(tinygltf
src/tinygltf/json.hpp
src/tinygltf/stb_image.h
src/tinygltf/stb_image_write.h
src/tinygltf/tiny_gltf.h
)

source_group(Headers FILES ${headers})
source_group(Sources FILES ${sources})
set(common
src/utilities.h
src/utilities.cpp
#src/utilities.cuh
#src/utilities.cu
src/glslUtility.hpp
src/glslUtility.cpp
src/mathUtil.h
src/mathUtil.cpp
#src/stb.cpp
)

list(SORT scene)
list(SORT core)
list(SORT imgui)
list(SORT tinygltf)
list(SORT common)
list(SORT material)

source_group(Scene FILES ${scene})
source_group(ImGUI FILES ${imgui})
source_group(Core FILES ${core})
source_group(Common FILES ${common})
source_group(Tinygltf FILES ${tinygltf})
source_group(Material FILES ${material})

#add_subdirectory(src/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} ${imgui} ${tinygltf} ${core} ${scene} ${common} ${material})
target_link_libraries(${CMAKE_PROJECT_NAME}
${LIBRARIES}
#stream_compaction # TODO: uncomment if using your stream compaction
Expand Down
196 changes: 101 additions & 95 deletions INSTRUCTION.md

Large diffs are not rendered by default.

52 changes: 46 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,53 @@
CUDA Path Tracer
================
[pbrt]: https://pbrt.org/

**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)
* Yian Chen
* [LinkedIn](https://www.linkedin.com/in/yian-chen-33a31a1a8/), [personal website](https://sydianandrewchen.github.io/) etc.
* Tested on: Windows 10, AMD Ryzen 5800 HS with Radeon Graphics CPU @ 3.20GHz 16GB, NVIDIA GeForce RTX3060 Laptop 8GB

### (TODO: Your README)

*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.
### Denoiser

- G-Buffer
Implemented a combo to show different G-Buffer conveniently
![Alt text](img/position_buffer.png)
![Alt text](img/normal_buffer.png)

- Denoised result

We use the scene `pathtracer_bunny_mis.glb` to test the denoiser.

The floor is specular and the bunny is diffuse.
<table>
<tr>
<th>No denoiser</th>
<th>Denoiser with 10 Pixel Filter</th>
</tr>
<tr>
<th><img src="img/denoise_pt_500it.png" /></th>
<th><img src="img/denoise_denoise_10_500it.png" /></th>
</tr>
<tr>
<th>Denoiser with 30 Pixel Filter</th>
<th>Denoiser with 50 Pixel Filter</th>
</tr>
<tr>
<th><img src="img/denoise_denoise_30_500it.png" /></th>
<th><img src="img/denoise_denoise_50_500it.png" /></th>
</tr>
</table>

### Performance Analysis

We also tested the time used during denoise process under different size of denoise filter.

- Denoised Time under different filter size
![](img/filter_time_with_different_filter_size.png)

It could be found out that although denoise time is increasing as filter size increases, the increasing speed declines.

Also, we can observe from the result above that as we increase the filter size, the details in the resulting image is also more vague.

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
Loading