A Monte Carlo Path Tracer implemented in CUDA.
- Anti-aliasing
- Depth of Field
- Diffusion & Specular Reflection
- Fresnel Equation for Transmission
- Support
obj&mtlFormat - Store Result in
ppmFormat
- Bidirection Tracing
- Accelerating Intersection using BVH
- Use
float4instead offloat3 - Memory Access Accelerating via CUDA Constant & Texture Memory
- Debian 8 (Jessie) 64bits, other systems are not tested
- GCC 4.9, GCC 6 is not allowed!!!
- CUDA 8.0, lower versions are not tested
- CMake >= 2.8
- NVIDIA GeForce Titan Black (CUDA capability: 3.5) lower CUDA capabilities are not tested
include/- 3rd-party headers, including tinyobjloader & some helper functions from NVIDIA's offical CUDA examples (with filename starts with "helper_")src/- Source codescenes/- 2 demo scenes -scene-1/for Cornell Box &scene-2/for Glossy Planeresults/- Some demo results
In src/ directory:
types.hpp&types.cppimplement some essential data structures such asRay,Triangle,Material,Camera,Scene, etc.constants.hppdefines some useful constant values.utils.hppimplements some helper functions.path_tracer.hpp&path_tracer.cuimplement the Monte Carlo Path Tracing algorithm.
The code style of the source code files above follows Google C++ Code Style
$ cd /PATH/TO/PROJECT
$ mkdir build
$ cd build$ cmake ..
$ make -j8The demo program needs 5 command-line parameters - scene id, output filename samples per pixel, maximum tracing bounces and gpu id respectively.
Currently only 3 scenes are supported:
1for scene 1 (Cornell Box)2for scene 2 (Glossy Planes)3for my own scene (modified Cornell Box)
Here is an example:
$ ./PathTracerDemo 1 scene-1.ppm 2000 10 # Create scene 1 on default gpu (gpu 0)
$ ./PathTracerDemo 2 scene-2.ppm 1000 10 1 # Create Scene 2 on gpu 1
$ ./PathTracerDemo 3 scene-3.ppm 10000 20 2 # Create Scene 3 on gpu 2Note: Execution time information are measured by time command, e,g.:
$ time ./PathTracerDemo 1 scene01-10000-ppm 10000 10 0- Samples per pixel (spp): 100, 1000, 10000
- Maximum tracing bounces: 10
- Samples per pixel (spp): 100, 1000, 10000
- Maximum tracing bounces: 10
- Samples per pixel (spp): 10000
- Maximum tracing bounces: 20
Note: This scene has Depth of Field effect.
See LICENSE