Motivational Image: "Planet in a bottle"
The idea behind my project proposal is to put an entire hovering planet (for example, Earth) on display in a museum. The planet is understood to be a shrunken version of an actual planet and could show full planetary effects such as atmospheric scattering, volumetric clouds, reflections off the oceans, moons, or city lights on the dark side, for example.
I like the idea of the unusual artifact - a shrunken planet - because it allows toying with different scales and combining things that aren't usually seen in the same picture. There are many possible ways to put the planet in scene; for example, the planet could be on display inside a small forgotten test tube on a side shelf or in a large display case in the center of a gallery.
For my final project, I implemented a forward path tracer called "Tungsten". The renderer is written entirely in C++11 and uses features such as variadic templates, smart pointers and lambdas to make the code efficient and compact. The majority of the code resides in header files only to allow aggressive inlining by the compiler and achieve better performance.
A handful of external libraries are used for convenience. They are listed below:
- embree: Intel's ray tracing library, which provides high performance BVH construction and intersection routines
- lodepng: A light weight png loader and exporter
- rapidjson: A light weight, high performance JSON loader and exporter
- SFMT: A high performance implementation of the Mersenne Twister method
- Sobol: An efficient implementation of the Sobol sequence by Leonhard Gruenschloss
- STB Image: A light weight, all purpose image loader
- tinyformat: A C++11 typesafe
printfbased on variadic templates
- Intel Thread Building Blocks: A threading utility library
- Qt: An extensive GUI framework used for the editor
Tungsten scenes are specified in human readable JSON text files. The intention of choosing a text based format is to allow easy creation and modification of scenes without having to use specialized tools other than a text editor.
Apart from manual creation, I also wrote various tools to make scene creation easier. One of these tools is
obj2json, which automatically creates scene files from OBJ models including materials and textures. On disk, triangle meshes are stored in a binary file format to allow for rapid loading of large scenes; appropriate files will be generated automatically by the obj converter.
There is also an interactive editor written in Qt and OpenGL, which features easy tweaking and merging of scenes as well as an incremental version of the renderer to allow for fast previews.
Tungsten Scene Editor
Nearly all of the features in Tungsten have been verified with the free and open source renderer Mitsuba.
For BSDFs, there is a compatibility layer
MitsubaUtil.hpp, which allows developers to easily drop Mitsuba BSDF classes into the Tungsten code to programmatically create RMSE values and comparison plots over the entire 4D+ input domain. This is immensely useful for debugging and verification of subtle features. For BSDFs, this way of verificaton is preferrable to comparing rendered images, since unlike image comparisons, it is not a matter of opinion whether two plots are the same.
For all other features of the renderer, there is a utility called
json2xml, which can convert nearly all Tungsten scene files into Mitsuba compatible XML scene files. This allows for exact verification of more complex scenes and, apart from being convenient, also rules out human error in writing a Mitsuba XML matching the Tungsten setup.
For BSDFs and media, this report includes comparison images between Tungsten and Mitsuba wherever both of them implement the same functionality. Since the default BRDF renders in Tungsten use a tonemapping operator Mitsuba doesn't support, a separate Tungsten render without tonemapping is included in the comparison.