diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3d976c..41dc21e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,7 +72,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif()
include_directories(.)
-#add_subdirectory(stream_compaction) # TODO: uncomment if using your stream compaction
+add_subdirectory(stream_compaction) # TODO: uncomment if using your stream compaction
add_subdirectory(src)
cuda_add_executable(${CMAKE_PROJECT_NAME}
@@ -82,7 +82,7 @@ cuda_add_executable(${CMAKE_PROJECT_NAME}
target_link_libraries(${CMAKE_PROJECT_NAME}
src
- #stream_compaction # TODO: uncomment if using your stream compaction
+ stream_compaction # TODO: uncomment if using your stream compaction
${CORELIBS}
)
diff --git a/README.md b/README.md
index 110697c..98f177d 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,86 @@
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)
+* Liam Dugan -- Fall 2018
+ * [LinkedIn](https://www.linkedin.com/in/liam-dugan-95a961135/), [personal website](http://liamdugan.com/)
+* Tested on: Windows 10, Ryzen 5 1600 @ 3.20GHz 16GB, GTX 1070 16GB (Personal Computer)
+
+
+
+What is Path Tracing?
+=============
+
+
+Path Tracing is a technique for creating images by emulating certain physical properties of light
+
+In the real world a ray of light:
+1. Is emitted from **Light Sources**
+2. **Bounces** around a scene and changes color depending on what it hits
+3. Some hit pixels on the camera, and those get seen
+
+However, a Path Tracer does this backwards by firing rays out of the camera pixels:
+1. Rays bounce around in the scene a certain number of times
+2. If they hit a light source they terminate and color the camera pixel
+3. If they terminate without hitting a light, the pixel is colored black
+
+(Picture taken from course path tracer lecture slide 3)
+
+
+Scenes
+================
+
+Reflection / Refraction / Diffuse
+---------
+
+
+
+In these scenes we can see not only the reflection working (in the infinite wall room), but also we can see refraction and diffuse lighting being accounted for.
+
+Depth of Field
+-------
+
+
+Depth of Field requires jittering the generated ray based on a given distance from a focal point.
+
+Arbitrary Object Loading (with tinyObj)
+-------
+
+
+I loaded in .obj files using tinyObj and then used `glm::intersectRayTriangle` to check for intersections between our ray and every triangle of the mesh.
+
+Performance Optimizations
+================
+
+Total Performance Breakdown
+------
+
+
+To conduct this test I measured the runtime of each of our four main kernels across 4 different scenes and normalized them relative to each other. As we can see from this result the bottleneck of our pipeline is the compute intersections kernel. This is most evident in the sword scene as each ray has to for loop through the many triangles of the mesh. This bottleneck could be relieved greatly by the implementation of a kd tree or other such bounding data structure.
+
+Otherwise our bottleneck seems to be stream compaction, which can be improved greatly by using shared memory
+
+First Iteration Caching
+-------
+
+
+As we can see from the graph here, the average runtime of the ray generation kernel is drastically reduced when the first iteration caching is activated. We do take a performance hit at the beginning due to having to copy the generated rays into the cache but it is well worth it.
+
+Material ID Sorting
+-------
+
+
+Sorting the rays based on material ID attempts to exploit warp coherence to get extra performance, however it seems that in our case, the extra added overhead of the sort was just too significant. The material ID sort performed significantly worse over both a scarcely populated scene and a heavily populated scene.
+
+Stream Compaction
+-------
+
+
+Taking my implementation from Project 2 for Stream Compaction and adapting it here allows us to greatly decrease the total number of rays for which to calculate intersections. This is especially true in more open scenes, where the rays have plenty of room to shoot off into the distance and terminate. One the other hand in a closed scene (like the infinite reflection room) rays will almost always reach their depth limit unless they hit an emittant surface.
-### (TODO: Your README)
+## Bloopers
+Because all good things come from humble beginnings.
-*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.
+
+
diff --git a/external/include/tiny_obj_loader.h b/external/include/tiny_obj_loader.h
new file mode 100644
index 0000000..ee44076
--- /dev/null
+++ b/external/include/tiny_obj_loader.h
@@ -0,0 +1,2029 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2012-2016 Syoyo Fujita and many contributors.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+//
+// version 1.0.6 : Add TINYOBJLOADER_USE_DOUBLE option(#124)
+// version 1.0.5 : Ignore `Tr` when `d` exists in MTL(#43)
+// version 1.0.4 : Support multiple filenames for 'mtllib'(#112)
+// version 1.0.3 : Support parsing texture options(#85)
+// version 1.0.2 : Improve parsing speed by about a factor of 2 for large
+// files(#105)
+// version 1.0.1 : Fixes a shape is lost if obj ends with a 'usemtl'(#104)
+// version 1.0.0 : Change data structure. Change license from BSD to MIT.
+//
+
+//
+// Use this in *one* .cc
+// #define TINYOBJLOADER_IMPLEMENTATION
+// #include "tiny_obj_loader.h"
+//
+
+#ifndef TINY_OBJ_LOADER_H_
+#define TINY_OBJ_LOADER_H_
+
+#include