Monte Carlo Raytracer from Scratch in C++11/14
A Monte Carlo raytracer produces photorealistic images of given scenes (given good assets and enough time to fully converge). It's a technique which allows global illumination, giving optical effects such as color bleeding, hard and soft shadows and caustics. In this repository you'll find a full Monte Carlo raytracer implementation written in modern C++, along with the accompaying paper Monte Carlo Raytracing from Scratch which describes the theory and practical details needed to both understand and implement your own raytracer, along with some benchmarks, reflections and future work. Our raytracer is written from the ground up, and doesn't need any libraries to be linked. We've used the header only libraries: g-truc/glm (for vector and matrix operations), nlohmann/json (for our scene loader) and syoyo/tinyobjloader (for loading meshes).
Below you'll find a non-exhaustive list of features:
OpenMP
premake5
build system.premake5 gmake
if building on Make.make -j8 -C build
and wait.bin
.make render
and make view-render
.bin/mcrt <image-file> [<scene-file> <param-file>]
: render scene in <scene-file>
with the raytracer parameters in <param-file>
to an image file <image-file>
using a supported format (ppm, ff and png). Uses defaults if not given.make render
and make view-render
: builds the project and render share/scene.json
with share/param.json
. Can be changed to something else by looking at the Makefile
. Uses the premake5
build system; make sure to have that :). It also opens your image share/render.png
with feh
and continuously updates when additional details are rendered.make profile
and make view-profile
: produces flame graphs by profiling with perf
.make docs
: produces the report Monte Carlo Raytracing from Scratch for mcrt
.utils/photon-map.r
: gives a visualization of the directly built photon map.utils/png-distance.r
: takes in two images, produce difference between them.utils/PKGBUILD
: use makepkg -i
to install this when you are running Arch Linux.
man mcrt
and assets in /usr/share/mcrt/
.Should run on anything, even on toaster-like potato-ish hardware.
Fortunately, there aren't any dependencies besides premake
now.
bin
: contains the built software and accompanying testing suite.build
: stores intermediate object files and generated GNU Make files.
obj
: has all of the generated object files given under compilation.Makefile
: automatically generated by executing premake5 gmake
.*.make
: program specific make config for augmenting Makefile
.docs
: any generated documentation for this project is over here.include
: both external and internal project headers are here.
project directories
: internal headers for the project.license.md
: please look through this very carefully.premake5.lua
: configuration file for the build system.readme.md
: this file, contains information on the project.share
: any extra data that needs to be bundled should be here.src
: all source code for the project should be located below here.
project directories
: source code for specific project build.utils
: any sort of helper scripts or similar should be over here.git remote update
git branch <feature>
git checkout <feature>
git add -A
(everything) or git add -u
(updates).git commit -m "Message describing the additions."
git push origin <feature>
git checkout -b master
git pull origin master
master
:
git checkout <feature>
git rebase master
git checkout master
There are definitely no known bugs in this software at this time.