No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmake
external
img
results
scenes
src
stream_compaction
.cproject
.gitignore
.project
CMakeLists.txt
GNUmakefile
INSTRUCTION.md
Project3-CUDA-Path-Tracer.launch
README.md

README.md

####University of Pennsylvania ####CIS 565: GPU Programming and Architecture

##Project 3 - CUDA Path Tracer

  • Xueyin Wan
  • Tested on: Windows 7, Xeon(R) E5-1630 @ 3.70GHz 32GB, GTX 1070 8192MB (Moore 103 SigLab)
  • Compiled with Visual Studio 2013 and CUDA 7.5

================================================================== ##My Path Tracer Features ###Core Features

  1. A shading kernel with BSDF evaluation:
  • Ideal Diffuse surfaces
  • Perfectly specular-reflective (mirrored) surfaces
  1. Path continuation/termination using Stream Compaction
  2. toggle between sorting path/intersection continuous by material type
  3. toggle between cache first bounce

###Extra Coolness

  1. Refraction (e.g. glass/water) [PBRT 8.2] with Frensel effects using Schlick's approximation(finally...)
    Found great reference: http://graphics.stanford.edu/courses/cs148-10-summer/docs/2006--degreve--reflection_refraction.pdf
  2. Physically-based depth-of-field
  3. Motion Blur
  4. More is coming!

================================================================== ###Result In Progress

####Fresnel Refraction Using Schlick's Approximation(http://graphics.stanford.edu/courses/cs148-10-summer/docs/2006--degreve--reflection_refraction.pdf) alt text

####Diffuse, Perfect Specular Wall, Transmissive and Depth of Field

  • Left Wall : Reflection = 1
  • Left Blue Ball: Refraction = 1
  • Middle Purple Ball: Refraction + Reflection = 1, No Diffuse
  • Right Pink Ball: Only Diffuse
Original With DOF
alt text alt text

####Motion Blur Motion Blur: The left sphere and middle cube is moving during the whole render process alt text

|alt text

####Depth of Field Comparison

  • Left Ball : Refraction = 1
  • Middle Cube: Reflection = 0.4, Refraction = 0.6, Refraction + Reflection = 1, No Diffuse,
  • Right Ball: Reflection = 0.2, Refraction = 0.2, Diffuse = 0.6

####Original Pic alt text

Focal Length = 10.5 Focal Length = 9
alt text alt text

####SEE WHERE I START FROM... ####BE CONFIDENT ABOUT YOUR HARD WORK!!! BE CONFIDENT ON THE WAY OF GPU!!! BE CONFIDENT WHEN FINDING A JOB!!!

Ideal Diffuse surfaces Perfectly specular-reflective surfaces
alt text alt text

================================================================== ###ON or OFF? SORT_BY_MATERIAL, CACHE_FIRST_BOUNCE, STREAM_COMPATION STATUS | SORT_BY_MATERIAL | CACHE_FIRST_BOUNCE | STREAM_COMPATION | 5000 INTERATIONS TOTAL TIME (s) --- | --- | --- | --- | --- | ON | OFF | OFF | 670.627
| OFF| ON | OFF | 100.689 | OFF| OFF | ON | 169.234 | OFF| OFF | OFF | 117.215 alt text

Above results is based on my cornellTestDOFLAB.txt. I used Siglab Machine to run all the results.

###How to implement these Toggle? In pathtrace.cu, using Macro definition to realize this :)

#define SORT_BY_MATERIAL 0
#define CACHE_FIRST_INTERSECTION 0
#define STREAM_COMPACTION 0

Thanks google groups!

For STREAM_COMPACTION, I used thrust::partition() method to calculate number of paths alive.

For CACHE_FIRST_INTERSECTION, I made two helper variables:

bool cache_first_intersection 
static ShadeableIntersection * dev_first_intersections 

and use cudaMemcpy() method to copy the first batch of intersections into dev_first_intersection memory.

For SORT_BY_MATERIAL, I made helper comparator MaterialComparator() and used thrust::sort_by_key() method to realize sorting by mateiral.

###What can we learn from the table above?

  • SORT_BY_MATERIAL is the slowest one.. If there're a lot of materials in this code, I think that should be better.
  • CACHE_FIRST_INTERSECTION : Totally went wrong when I opened DOF. But without DOF, result is good.
  • STREAM_COMPACTION : Slower than all-OFF, I think maybe the ray's amount is huge, so the method takes unnecessary time. The method itself is good, yet sorting/compaction is slow (which is a pity :(.

###Dive into CUDA alt text

alt text From the pictures above, we could see ComputerIntersections is the most time wasted(72.79%), since this function is used to calculate all the intersections, and as we noticed, the ray's amount is huge.

The second part is shadeFakeMaterial, since we need to deal with each ray's color, remainging bounces information.