Skip to content

Commit

Permalink
Render images, README.
Browse files Browse the repository at this point in the history
  • Loading branch information
terrynsun committed Oct 7, 2015
1 parent 91f21c6 commit 06f5313
Show file tree
Hide file tree
Showing 37 changed files with 80,635 additions and 83 deletions.
79 changes: 65 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Terry Sun; Arch Linux, Intel i5-4670, GTX 750

A CUDA-accelerated path tracer: a global-illumination renderer.

![](img/main-10000.png)

## Features

### Materials
Expand All @@ -17,8 +19,14 @@ The pathtracer supports the following material surfaces:
* specular/reflective (perfect and imperfect): light reflects perfectly off the
surface; or, light takes an imperfect reflected directly using the [Phong
BRDF][gpu-specular].
* refractive (using [Schlick's Approximation][wiki-schlick] to blend reflective
and refractive light bounces): glass, water
* refractive (using [Schlick's Approximation][wiki-schlick] of the Fresnel
effect to blend reflective and refractive light bounces).

![](img/specular-5000.png)
![](img/refract-5000.png)

*(Left: specular exponent 200; specular exponent 25)*
*(Right: indices of refraction 1.31 (water ice), 1.7 (impure glass))*

[gpu-specular]: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html
[wiki-schlick]: https://en.wikipedia.org/wiki/Schlick%27s_approximation
Expand All @@ -30,30 +38,74 @@ of rays shot from the camera. DOF is defined with a focal distance from the
camera, at which objects are perfectly in focus, and an aperture radius,
defining the amount of variance added to each ray.

![](img/nodof.png)
![](img/dof05.png)
![](img/dof03.png)
![](img/dof-none-5000.png)
![](img/dof04-5000.png)

*(no DOF; DOF with distance 5.5, aperture 0.4; 5000 iterations each)*

### Antialiasing

Camera rays are shot from the camera's position in the direction of a pixel.
Antialiasing jitters the target of the ray within a pixel.
Antialiasing jitters the target of the ray within a pixel. This is a brief
computation that happens once per pixel per iteration; it has little impact on
performance.

![](img/aa-none-5000.png)
![](img/aa-5000.png)

*(note antialiasing along cube, light, and wall corners)*

### Texture mapping

Textures can be read in to define diffuse colors for a material.

[TODO: picture]
For spheres, polar coordinates *phi* and *theta* are used as the UV coordinates,
wrapping a texture across a sphere. For cubes, polar coordinates are calculated
relative to the cube face; each face of the cube has an identical copy of the
texture.

For both texture and normal mapping: add a small amount of complexity to the
intersection tesitng code in order to output UV coordinates. Most of the cost,
if any, would come from additional memory requirements (access into global
memory when reading the texture).

![](img/uv1-5000.png)
![](img/uv2-5000.png)

### Normal mapping

Textures can be read in to define ray-bounce surface normals (superceding normal
vectors generated by the geometry intersection).

Combining the two above effects:

![](img/globe-texture-5000.png)
![](img/globe-normal-5000.png)
![](img/globe-both-5000.png)

*(normal map only; texture map only; texture and normal map)*

### Stream compaction.

Shared-memory work-efficient stream compaction.
This pathtracer uses `thrust::remove_if` to perform stream compaction on dead
rays.

[TODO: analysis]
I also implemented a [GPU-shared-memory, work-efficient stream compaction
algorithm][p2-shared-mem]. Unfortunately I couldn't integrate that into this
project -- I suspect there are memory errors when I translated the stream
compaction to handle pathtracing structs rather than integer values.

### Texture mapping
[p2-shared-mem]: https://github.com/terrynsun/CIS565-P2-Stream-Compaction

![](data/live_rays.png)

[TODO: picture(s)]
The type of scene has a large effect on the number of rays alive in a scene.

### Bump mapping
![](data/ray_scatter.png)

[TODO: picture(s)]
Comparisons done with the demo scene at the top of this README (found in
`scenes/main.txt`) at 700x700. Open scenes have the front wall removed. Large
lights are 10x10 (entire ceiling); normal lights are 6x6.

## Run

Expand Down Expand Up @@ -104,7 +156,6 @@ MATERIAL (material ID) //material header
RGB (float r) (float g) (float b) //diffuse color
SPECX (float specx) //specular exponent
SPECRGB (float r) (float g) (float b) //specular color
REFR (bool refr) //refractivity flag, 0 for no, 1 for yes
REFRIOR (float ior) //index of refraction for Fresnel effects
EMITTANCE (float emittance) //the emittance of the material; >0 is a light source
TEXTURE (int textureid) //texture corresponding to diffuse coloring
Expand Down
21 changes: 21 additions & 0 deletions data/closed_large_light.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
depth, intersect time, compact time, live rays
0, 345.800403, 189.747829, 19897834.300000
1, 529.565765, 152.956438, 16707276.450000
2, 609.487291, 129.201187, 14613067.300000
3, 549.965330, 114.281574, 12999635.500000
4, 490.922901, 102.845467, 11703350.400000
5, 442.483781, 95.139066, 10599731.200000
6, 400.311603, 86.168085, 9632819.550000
7, 363.525166, 79.759112, 8802539.850000
8, 331.648603, 73.327230, 8089032.300000
9, 304.331611, 68.235384, 7476352.100000
10, 280.627125, 64.967070, 6950144.350000
11, 259.992184, 60.099235, 6497065.800000
12, 242.463538, 56.711714, 6106920.000000
13, 226.842378, 54.055035, 5771159.800000
14, 213.753557, 51.672931, 5481962.900000
15, 201.839717, 49.385086, 5232776.700000
16, 191.812510, 48.190931, 5018265.850000
17, 182.690216, 46.272653, 4833342.300000
18, 174.978714, 44.708288, 4674002.200000
19, 167.555973, 43.778882, 4536869.200000
Loading

0 comments on commit 06f5313

Please sign in to comment.