Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
25e31a8
[Part 1] Implemented scaterRay and ShadeMaterial
adithyar262 Sep 26, 2024
46eb199
[Minor] Saving images to testRun folder instead of build
adithyar262 Sep 26, 2024
ad390f2
[Minor] Changed SPhere to Diffuse to test
adithyar262 Sep 26, 2024
1c88689
[Part 1] Added code for reflective surfaces in scatterRay
adithyar262 Sep 28, 2024
cc75b5d
[Part 1] Implemented Basic Path Tracer
adithyar262 Sep 28, 2024
68a6871
[Part 1] Implemented LoadFromJson
adithyar262 Sep 29, 2024
0adb328
[Part 1] Implemented Material Sort
adithyar262 Sep 29, 2024
9fd0cc6
[Part 1] Implemented Anti Aliasing
adithyar262 Sep 30, 2024
4cda98d
[Part 2] Implemented Refraction
adithyar262 Oct 4, 2024
fb71e3f
[Part 2] Implemented Depth of Field
adithyar262 Oct 4, 2024
52285c1
[Part 2] Added Metallic/Plastic surface interactions
adithyar262 Oct 4, 2024
6b2395d
[Part 2] Implemented Direct Light Sampling
adithyar262 Oct 5, 2024
2d5cfe0
[Part 2] Implemented Russian Roulette Path Termination
adithyar262 Oct 5, 2024
a15f466
Update README.md
adithyar262 Oct 5, 2024
cd6c48d
[Minor] Added images for README
adithyar262 Oct 7, 2024
123fec6
Merge branch 'main' of github.com:adithyar262/Project3-CUDA-Path-Tracer
adithyar262 Oct 7, 2024
1ae4166
[Minor] Added updated Depth of field images
adithyar262 Oct 7, 2024
1183421
[README] Updated README with images and performance analysis
adithyar262 Oct 8, 2024
c6cd1f6
[Images] Updated Direct Lighting images
adithyar262 Oct 8, 2024
a767535
[Final Submission] Updated README with image labels
adithyar262 Oct 8, 2024
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
115 changes: 110 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,116 @@ CUDA Path Tracer

**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)
* ADITHYA RAJEEV
* [LinkedIn](https://www.linkedin.com/in/adithyar262/)
* Tested on: Windows 11, i7 13th Gen @ 2.40GHz 16GB, GeForce RTX 4050 8GB (Personal)

### (TODO: Your README)
### Overview

*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 project implements a CUDA-based path tracer with various advanced rendering features. The path tracer is capable of simulating complex light interactions in 3D scenes, producing physically-based, photorealistic images.

![](img/testRuns/Presentation1.png)

![](img/testRuns/Presentation2.png)

![](img/testRuns/Presentation3.png)


## Features

### Core Functionality

* **BSDF Evaluation**:
* Ideal diffuse surfaces (Lambertian reflection)

![](img/testRuns/Cornell_Box.png)

* Perfectly specular-reflective surfaces (mirrors)

![](img/testRuns/Specular_Scene.png)

* **Path continuation/termination** using Stream Compaction
* **Material-based ray sorting** for optimized performance

I implemented material sorting for my path segments and intersections before calling the material shading kernel, expecting it to improve performance.
However, I was surprised to find that this actually made my path tracer slower. Upon reflection, I realized that this might be due to the lack of diversity in my material types. It seems that in my current scene setup, the overhead from sorting is greater than any performance gains from reducing warp divergence. This suggests that the effectiveness of material sorting might depend heavily on the complexity and variety of materials in the scene.

![](img/testRuns/MaterialSortTable.png)

* **Stochastic sampled antialiasing**

#### With Anti-Aliasing

![](img/testRuns/WithoutAntiAliasing.png)

#### Without Anti-Aliasing

![](img/testRuns/WithAntiAliasing.png)


### Advanced Features

* **Refraction** with Fresnel effects (e.g., glass, water)

![](img/testRuns/Diffuse_Reflection_Refraction.png)

* **Physically-based depth-of-field**

#### Depth of Field Enabled

![](img/testRuns/depth_of_field1.png)

#### Depth of Field Disabled

![](img/testRuns/depth_of_field_disabled1.png)

* **Direct lighting simulation**

#### Direct Lighting Enabled

![](img/testRuns/DirectLightingEnabled.png)

#### Direct Lighting Disabled

![](img/testRuns/DirectLightingDisabled.png)

### Russian Roulette Path Termination

Russian Roulette technique was implemented to terminate unimportant paths early. Our analysis shows:

* fps with Russian Roulette Enabled - 43.2 fps
* fps with Russian Roulette Enabled - 34.9 fps
* 23.78% Increase in FPS
* Negligible impact on image quality

#### Russian Roulette Enabled

![](img/testRuns/RussianRouletteEnabled.png)

#### Russian Roulette Disabled

![](img/testRuns/RussianRouletteDisabled.png)

* **Physically-based rendering with Metallic and Platic materials**

![](img/testRuns/materials.png)

## Bloopers

![](img/testRuns/Blooper1.png)

![](img/testRuns/Blooper2.png)

![](img/testRuns/Blooper3.png)

![](img/testRuns/Blooper4.png)

![](img/testRuns/Blooper5.png)

![](img/testRuns/Blooper6.png)

## References

* [PBRT-v3 Book](https://www.pbrt.org/)
* [Physically Based Rendering: From Theory To Implementation](http://www.pbr-book.org/)
* [NVIDIA CUDA Documentation](https://docs.nvidia.com/cuda/)
Binary file added img/testRuns/Blooper1.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/testRuns/Blooper2.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/testRuns/Blooper3.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/testRuns/Blooper4.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/testRuns/Blooper5.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/testRuns/Blooper6.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/testRuns/Cornell_Box.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/testRuns/Diffuse_Reflection_Refraction.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/testRuns/DirectLightingDisabled.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/testRuns/DirectLightingEnabled.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/testRuns/Direct_Lighting.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/testRuns/MaterialSortTable.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/testRuns/Presentation1.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/testRuns/Presentation2.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/testRuns/Presentation3.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/testRuns/RenderWithMaterialSort.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/testRuns/RenderWithoutMaterialSort.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/testRuns/RussianRouletteDisabled.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/testRuns/RussianRouletteEnabled.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/testRuns/Specular_Scene.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/testRuns/SurfaceIneraction.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/testRuns/WithoutAntiAliasing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/testRuns/depth_of_field.png
Binary file added img/testRuns/depth_of_field1.png
Binary file added img/testRuns/depth_of_field_disabled.png
Binary file added img/testRuns/depth_of_field_disabled1.png
Binary file added img/testRuns/materials.png
7 changes: 6 additions & 1 deletion scenes/cornell.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
"TYPE":"Diffuse",
"RGB":[0.35, 0.85, 0.35]
},
"diffuse_test":
{
"TYPE":"Diffuse",
"RGB":[0.35, 0.35, 0.35]
},
"specular_white":
{
"TYPE":"Specular",
Expand Down Expand Up @@ -86,7 +91,7 @@
},
{
"TYPE":"sphere",
"MATERIAL":"specular_white",
"MATERIAL":"diffuse_test",
"TRANS":[-1.0,4.0,-1.0],
"ROTAT":[0.0,0.0,0.0],
"SCALE":[3.0,3.0,3.0]
Expand Down
106 changes: 106 additions & 0 deletions scenes/depth_of_field.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"Materials": {
"light": {
"TYPE": "Emitting",
"RGB": [1.0, 1.0, 1.0],
"EMITTANCE": 5.0
},
"diffuse_white": {
"TYPE": "Diffuse",
"RGB": [0.98, 0.98, 0.98]
},
"diffuse_red": {
"TYPE": "Diffuse",
"RGB": [0.85, 0.35, 0.35]
},
"diffuse_green": {
"TYPE": "Diffuse",
"RGB": [0.35, 0.85, 0.35]
},
"diffuse_blue": {
"TYPE": "Diffuse",
"RGB": [0.35, 0.35, 0.85]
},
"specular_white":
{
"TYPE":"Specular",
"RGB":[0.98, 0.98, 0.98],
"ROUGHNESS":0.0
}
},
"Camera": {
"RES": [800, 800],
"FOVY": 45.0,
"ITERATIONS": 5000,
"DEPTH": 8,
"FILE": "depth_of_field",
"EYE": [0.0, 5.0, 10.5],
"LOOKAT": [0.0, 5.0, 0.0],
"UP": [0.0, 1.0, 0.0]
},
"Objects": [
{
"TYPE": "cube",
"MATERIAL": "light",
"TRANS": [0.0, 10.0, 0.0],
"ROTAT": [0.0, 0.0, 0.0],
"SCALE": [3.0, 0.3, 3.0]
},
{
"TYPE":"cube",
"MATERIAL":"diffuse_white",
"TRANS":[0.0,0.0,0.0],
"ROTAT":[0.0,0.0,0.0],
"SCALE":[10.0,0.01,10.0]
},
{
"TYPE":"cube",
"MATERIAL":"diffuse_white",
"TRANS":[0.0,10.0,0.0],
"ROTAT":[0.0,0.0,90.0],
"SCALE":[0.01,10.0,10.0]
},
{
"TYPE":"cube",
"MATERIAL":"diffuse_white",
"TRANS":[0.0,5.0,-5.0],
"ROTAT":[0.0,90.0,0.0],
"SCALE":[0.01,10.0,10.0]
},
{
"TYPE":"cube",
"MATERIAL":"diffuse_red",
"TRANS":[-5.0,5.0,0.0],
"ROTAT":[0.0,0.0,0.0],
"SCALE":[0.01,10.0,10.0]
},
{
"TYPE":"cube",
"MATERIAL":"diffuse_green",
"TRANS":[5.0,5.0,0.0],
"ROTAT":[0.0,0.0,0.0],
"SCALE":[0.01,10.0,10.0]
},
{
"TYPE": "sphere",
"MATERIAL": "diffuse_red",
"TRANS": [-4.0, 2.0, 0.0],
"ROTAT": [0.0, 0.0, 0.0],
"SCALE": [2.0, 2.0, 2.0]
},
{
"TYPE": "sphere",
"MATERIAL": "specular_white",
"TRANS": [0.0, 2.0, 0.0],
"ROTAT": [0.0, 0.0, 0.0],
"SCALE": [2.0, 2.0, 2.0]
},
{
"TYPE": "sphere",
"MATERIAL": "diffuse_blue",
"TRANS": [4.0, 2.0, 0.0],
"ROTAT": [0.0, 0.0, 0.0],
"SCALE": [2.0, 2.0, 2.0]
}
]
}
Loading