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 3: Zhihao Ruan #6

Open
wants to merge 93 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
29eaaeb
ignore vscode
Sep 24, 2021
4f02735
add clang-format; fix project to compile on Linux
Sep 24, 2021
ce8538e
add hiDPI scenes
Sep 24, 2021
da43255
run clang-format
Sep 25, 2021
4dad564
add "device_launch_parameters.h"
Sep 25, 2021
7133799
remove or move "using namespace std" into source
Sep 25, 2021
9ccb70d
finished part of core features
Sep 26, 2021
c2c0fc9
add `static` qualifier to device arrays
Sep 26, 2021
b90a6be
increase hidpi scene resolution
Sep 26, 2021
91e82f3
add `depth` to RNG generator in `shadeMaterial`
Sep 26, 2021
eba5d23
add `const` qualifiers
Sep 26, 2021
dbb031a
move extract material IDs to `computeIntersections`
Sep 26, 2021
ee324e7
remove redundant `iterationComplete` variable
Sep 26, 2021
1697945
finish core shading features
Sep 26, 2021
aeacf84
increase lighting effects
Sep 26, 2021
8406a86
add Cornell variant -- multiple balls
Sep 26, 2021
2e3852b
fix floating point issue in `getPointOnRay`
Sep 29, 2021
cf175b1
decrease light intensity
Sep 29, 2021
a1f3ca4
move constants to static_config.h
Sep 30, 2021
eb76898
fix incorrect light rendering & reflections
Sep 30, 2021
147ff58
fix specular material color value in multiball scene
Sep 30, 2021
ec27ad2
add caching first depth ray trace intersections
Sep 30, 2021
c3dfd7e
add sample img for core feature demo
Sep 30, 2021
f5ec656
Finish core features (#1)
shineyruan Sep 30, 2021
f36bb4f
WIP on refraction
Oct 1, 2021
5c97c42
add bloopers
Oct 3, 2021
0180465
add glass material to cornell.txt
Oct 3, 2021
dfb868e
WIP on debugging refraction code
Oct 3, 2021
2843178
multiple improvements
Oct 3, 2021
3595e75
add specular blue to cornell.txt
Oct 3, 2021
cd0e6e7
add stochastic sampled anti-aliasing
Oct 4, 2021
c7262db
add bloopers in anti-aliasing
Oct 4, 2021
1c62d81
fix ray refraction bug
Oct 4, 2021
084af15
Merge branch 'main' into dev
Oct 4, 2021
3df3828
remove one blooper
Oct 4, 2021
249ccd6
add reflection img; add simple README
Oct 4, 2021
f7a071e
Finish Refraction Ray & Anti-Aliasing (#2)
shineyruan Oct 4, 2021
0a5d87a
add camera depth-of-field properties
Oct 4, 2021
df47e00
increase emittance, add glass material, change ball texture
Oct 4, 2021
b7b5e47
Merge branch 'dev' into main
Oct 4, 2021
a1ed318
finished depth of field implementation
Oct 5, 2021
b9835e9
by default, disable depth of field
Oct 5, 2021
526e877
Merge pull request #3 from shineyruan/dev
shineyruan Oct 5, 2021
55e6ca4
add TinyGLTF 2.5 external lib
Oct 5, 2021
9deb19b
remove tinygltf library
Oct 6, 2021
4c5a789
remove glTF dependency; upgrade C++ host standard to 14
Oct 6, 2021
77f6e31
add implementation for mesh loading; not tested
Oct 6, 2021
810829a
add multiple sample obj meshes
Oct 6, 2021
a0d1844
add cube & dodecahedron from CIS 560 code base
Oct 7, 2021
ab0f369
change scene file
Oct 7, 2021
0e5430e
change get normal vector warning condition
Oct 7, 2021
9714bbb
add tinyobj legacy data types in class to support legacy API
Oct 7, 2021
9d7c890
Merge pull request #4 from shineyruan/dev
shineyruan Oct 7, 2021
df0d316
Update README
Oct 8, 2021
5802beb
Merge pull request #5 from shineyruan/dev
shineyruan Oct 8, 2021
8476a70
update cornell multiple ball scene
Oct 9, 2021
4337804
add introduction in README
Oct 9, 2021
1b5403b
fix typos
Oct 9, 2021
ce3d2dd
add performance analysis
Oct 9, 2021
fe7847c
add imgui
Oct 19, 2021
91c1d48
remove unused stream compaction folder
Oct 19, 2021
357b18a
added all imgui & GBuffer related components
Oct 19, 2021
033336f
fix Gbuffer set to 0 error
Oct 19, 2021
7833a17
add images & instructions
Oct 19, 2021
3daad3e
add surface normal in GBuffer; display surface normal
Oct 20, 2021
36de3dd
suppress glm warnings by --expt-relaxed-constexpr
Oct 20, 2021
f52bbb0
temporarily disable antialiasing
Oct 20, 2021
a8d809c
fix typo "barycentric"
Oct 20, 2021
a60995f
add TODOs for denoising
Oct 20, 2021
6f532f7
add visualization for gBuffer position
Oct 20, 2021
9e0ee7a
add denoising kernel & offset initialization
Oct 20, 2021
f1f1f47
multiple updates
Oct 21, 2021
ac9dca6
change dist calculation method
Oct 21, 2021
209be5c
remove "show original image" checker box
Oct 21, 2021
89a818f
change variable names; enable denoised img saving
Oct 21, 2021
6548176
decrease max filter size
Oct 21, 2021
cc7c3f7
reorganize comments
Oct 21, 2021
e5bb9cc
increase max color weight
Oct 21, 2021
6151ea3
update default denoising params
Oct 22, 2021
66ad250
add denoising README introduction & highlights
Oct 22, 2021
7761217
create toc
Oct 22, 2021
04a15af
add "table of contents"
Oct 22, 2021
0bffa7a
add Gaussian blur vs. edge avoiding, filter size
Oct 22, 2021
669b804
add visual results vs. material type
Oct 22, 2021
46b315d
add visual results vs. lighting conditions
Oct 22, 2021
44ab071
add performance analysis
Oct 22, 2021
6ad6942
add default cornell_ceiling_light scene
Oct 22, 2021
8ca42eb
include performance timer
Oct 22, 2021
ca16d4c
change project name
Oct 22, 2021
e19173d
add references
Oct 22, 2021
14c2e6d
add include of "array" for Visual Studio compatibility
Oct 22, 2021
0493917
remove device_atomic_functions
Oct 22, 2021
782abf2
Merge pull request #6 from shineyruan/denoiser
shineyruan Dec 24, 2021
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ build
.LSOverride

# Icon must end with two \r
Icon
Icon


# Thumbnails
._*
Expand Down Expand Up @@ -558,3 +559,5 @@ xcuserdata
*.xccheckout
*.moved-aside
*.xcuserstate

.vscode
55 changes: 41 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)

project(cis565_path_tracer)
project(cuda_path_tracer)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand All @@ -10,8 +10,8 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Enable C++11 for host code
set(CMAKE_CXX_STANDARD 11)
# Enable C++14 for host code
set(CMAKE_CXX_STANDARD 14)

# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
Expand All @@ -26,7 +26,10 @@ endif()
find_package(CUDA 10 REQUIRED)
include(${CMAKE_MODULE_PATH}/CUDAComputesList.cmake)

list(APPEND CUDA_NVCC_FLAGS ${CUDA_GENERATE_CODE})
list(APPEND CUDA_NVCC_FLAGS
${CUDA_GENERATE_CODE}
--expt-relaxed-constexpr
)
list(APPEND CUDA_NVCC_FLAGS_DEBUG "-g -G")
set(CUDA_VERBOSE_BUILD ON)

Expand All @@ -36,6 +39,7 @@ if(WIN32)
endif(WIN32)
########################################

set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED)

if(UNIX)
Expand All @@ -60,11 +64,13 @@ endif(UNIX)

set(GLM_ROOT_DIR "external")
find_package(GLM REQUIRED)
include_directories(${GLM_INCLUDE_DIRS})
include_directories(${GLM_INCLUDE_DIRS} "external/include")
message("\tFind GLM_INCLUDE_DIRS at: ${GLM_INCLUDE_DIRS}")

set(headers
src/main.h
src/image.h
src/stb.hpp
src/interactions.h
src/intersections.h
src/glslUtility.hpp
Expand All @@ -73,29 +79,50 @@ set(headers
src/sceneStructs.h
src/preview.h
src/utilities.h
)
src/stream_compaction.h
src/static_config.h
src/model_loader.hpp
src/timer.h
)

set(sources
src/main.cpp
src/stb.cpp
src/image.cpp
src/glslUtility.cpp
src/pathtrace.cu
src/scene.cpp
src/preview.cpp
src/utilities.cpp
)
src/stream_compaction.cu
src/static_config.cpp
src/obj_loader.cpp
)

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

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

source_group(Headers FILES ${headers})
source_group(Headers FILES ${headers} ${EXTERNAL_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
)
)
256 changes: 255 additions & 1 deletion INSTRUCTION.md

Large diffs are not rendered by default.

215 changes: 208 additions & 7 deletions README.md

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions cmake/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
BasedOnStyle: Google
---
Language: Cpp
AccessModifierOffset: -2
AlignConsecutiveAssignments: true
AlignConsecutiveMacros: true
---

91 changes: 46 additions & 45 deletions cmake/cuda_compute_capability.cpp
Original file line number Diff line number Diff line change
@@ -1,58 +1,59 @@
/*
* Copyright (C) 2011 Florian Rathgeber, [email protected]
*
* This code is licensed under the MIT License. See the FindCUDA.cmake script
* for the text of the license.
*
* Based on code by Christopher Bruns published on Stack Overflow (CC-BY):
* http://stackoverflow.com/questions/2285185
*/
* Copyright (C) 2011 Florian Rathgeber, [email protected]
*
* This code is licensed under the MIT License. See the FindCUDA.cmake script
* for the text of the license.
*
* Based on code by Christopher Bruns published on Stack Overflow (CC-BY):
* http://stackoverflow.com/questions/2285185
*/

#include <stdio.h>
#include <cuda_runtime.h>
#include <stdio.h>

#include <iterator>
#include <set>

int main() {
int deviceCount;
int gpuDeviceCount = 0;
struct cudaDeviceProp properties;
int deviceCount;
int gpuDeviceCount = 0;
struct cudaDeviceProp properties;

if (cudaGetDeviceCount(&deviceCount) != cudaSuccess)
{
printf("Couldn't get device count: %s\n", cudaGetErrorString(cudaGetLastError()));
return 1;
}
if (cudaGetDeviceCount(&deviceCount) != cudaSuccess) {
printf("Couldn't get device count: %s\n",
cudaGetErrorString(cudaGetLastError()));
return 1;
}

std::set<int> computes;
typedef std::set<int>::iterator iter;
std::set<int> computes;
typedef std::set<int>::iterator iter;

// machines with no GPUs can still report one emulation device
for (int device = 0; device < deviceCount; ++device) {
int major = 9999, minor = 9999;
cudaGetDeviceProperties(&properties, device);
if (properties.major != 9999) { // 9999 means emulation only
++gpuDeviceCount;
major = properties.major;
minor = properties.minor;
if ((major == 2 && minor == 1)) {
// There is no --arch compute_21 flag for nvcc, so force minor to 0
minor = 0;
}
computes.insert(10 * major + minor);
}
}
int i = 0;
for(iter it = computes.begin(); it != computes.end(); it++, i++) {
if(i > 0) {
printf(" ");
}
printf("%d", *it);
// machines with no GPUs can still report one emulation device
for (int device = 0; device < deviceCount; ++device) {
int major = 9999, minor = 9999;
cudaGetDeviceProperties(&properties, device);
if (properties.major != 9999) { // 9999 means emulation only
++gpuDeviceCount;
major = properties.major;
minor = properties.minor;
if ((major == 2 && minor == 1)) {
// There is no --arch compute_21 flag for nvcc, so force minor to 0
minor = 0;
}
computes.insert(10 * major + minor);
}
/* don't just return the number of gpus, because other runtime cuda
errors can also yield non-zero return values */
if (gpuDeviceCount <= 0 || computes.size() <= 0) {
return 1; // failure
}
int i = 0;
for (iter it = computes.begin(); it != computes.end(); it++, i++) {
if (i > 0) {
printf(" ");
}
return 0; // success
printf("%d", *it);
}
/* don't just return the number of gpus, because other runtime cuda
errors can also yield non-zero return values */
if (gpuDeviceCount <= 0 || computes.size() <= 0) {
return 1; // failure
}
return 0; // success
}
7 changes: 7 additions & 0 deletions external/include/tinyobjloader-v2.0.0/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
BasedOnStyle: Google
IndentWidth: 2
TabWidth: 2
UseTab: Never
BreakBeforeBraces: Attach
Standard: Cpp03
Loading