Skip to content

Commit 122720e

Browse files
committed
fix unchecked nan
1 parent 5e28caf commit 122720e

File tree

5 files changed

+46
-13
lines changed

5 files changed

+46
-13
lines changed

README.md

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,33 @@ CUDA Path Tracer
77
* [LinkedIn](https://www.linkedin.com/in/chang-liu-0451a6208/)
88
* [Personal website](https://hummawhite.github.io/)
99
* Tested on personal laptop:
10-
- Windows 11
1110
- i7-12700 @ 4.90GHz with 16GB RAM
1211
- RTX 3070 Ti Laptop 8GB
1312

13+
## Introduction
14+
15+
This is our third project of CIS 565 Fall 2022. In this project, our goal is to implement a GPU-accelerated ray tracer with CUDA.
16+
1417
## Representative Outcome
1518

1619
![](./img/photo_realistic.jpg)
1720

18-
<div align="center">"Photoly" realistic!</div>
21+
<p align="center">"Photoly" realistic!</p>
1922

20-
<div align="center">Rendered at 2400x1800, 3000 spp within 7 minutes </div>
23+
| Scene Specs | [[./scenes/pbr_texture.txt]](./scenes/pbr_texture.txt) |
24+
| ----------------------- | ------------------------------------------------------ |
25+
| Resolution | 2400 x 1800 |
26+
| Samples Per Pixel | 3000 |
27+
| Render Time | < 7 minutes (> 7.5 frames per second) |
28+
| Million Rays Per Second | > 32.4 |
29+
| Triangle Count | 25637 |
30+
| Lighting | HDR Environment Map |
2131

22-
![](./img/aperture_custom.jpg)
2332

24-
<div align="center">Star-shaped bokehs</div>
2533

26-
## Introduction
34+
![](./img/aperture_custom.jpg)
2735

28-
This is our third project of CIS 565 Fall 2022. In this project, our goal is to implement a GPU-accelerated ray tracer with CUDA.
36+
<p align="center">Star-shaped bokehs</p>
2937

3038

3139

@@ -45,24 +53,44 @@ Tired of "virtual artificial" light sources? Let's introduce some real-world li
4553

4654
#### Physically-Based Camera: Depth of Field & Custom Bokeh Shape
4755

48-
This is really my favorite part of the project.
56+
This is my favorite part of the project.
57+
58+
| No DOF | DOF |
59+
| --------------------------- | ----------------------- |
60+
| ![](./img/aperture_off.jpg) | ![](./img/aperture.jpg) |
61+
62+
This idea can even be extended by stochastically sampling a masked aperture image instead of the whole aperture disk.
4963

5064
<div align="center">
51-
<img src="./img/aperture_off.jpg" width="49%"/>
52-
<img src="./img/aperture.jpg" width="49%"/>
65+
<img src="./scenes/texture/star3.jpg" width="15%"/>
66+
<img src="./scenes/texture/heart2.jpg" width="15%"/>
5367
</div>
5468

69+
| Star Mask | Heart Mask |
70+
| ------------------------------ | ----------------------------- |
71+
| ![](./img/aperture_custom.jpg) | ![](./img/aperture_heart.jpg) |
72+
73+
#### Efficiently Sampling: Sobol Low Discrepancy Sequence
74+
75+
| Pseudorandom Sequence | Xor-Scrambled Sobol Sequence |
76+
| ---------------------------- | ---------------------------- |
77+
| ![](./img/sampler_indep.jpg) | ![](./img/sampler_sobol.jpg) |
5578

5679

57-
#### Xor-Scrambled Sobol Low Discrepancy Sequence
5880

5981
#### Post Processing
6082

83+
##### Gamma Correction
84+
85+
##### Tone Mapping
86+
87+
---
88+
6189

6290

6391
### Performance
6492

65-
#### Stackless SAH-Constructed Bounding Volume Hierarchy
93+
#### Fast Intersection: Stackless SAH-Constructed BVH
6694

6795
For ray-scene intersection, I did two levels of optimization.
6896

@@ -107,3 +135,4 @@ Therefore, in my opinion, material sorting is best applied when:
107135
- There are many different materials in the scene
108136
- Primitives sharing the same material are randomly distributed in many small clusters over the scene space. The clusters' sizes in solid angle are typically less than what a GPU warp can cover
109137

138+
### Image Texture vs. Procedural Texture

img/aperture_heart.jpg

135 KB
Loading

scenes/aperture.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Resolution 1800 1350
33
FovY 20.5
44
LensRadius 0.39
55
FocalDist 10.8
6-
ApertureMask Null
6+
ApertureMask texture/star3.jpg
77
Sample 3000
88
Depth 8
99
File Cornell

scenes/texture/heart2.jpg

32 KB
Loading

src/pathtrace.cu

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,10 @@ __global__ void singleKernelPT(int iter, int maxDepth, DevScene* scene, Camera c
555555
}
556556
}
557557
WriteRadiance:
558+
if (isnan(accRadiance.x) || isnan(accRadiance.y) || isnan(accRadiance.z) ||
559+
isinf(accRadiance.x) || isinf(accRadiance.y) || isinf(accRadiance.z)) {
560+
return;
561+
}
558562
image[index] += accRadiance;
559563
}
560564

0 commit comments

Comments
 (0)