Fermat
Fermat


Fermat, is a high performance research oriented physically based rendering system, trying to produce beautiful pictures following the mathematician's principle of least time.
It is a CUDA physically based research renderer designed and developed by Jacopo Pantaleoni at NVIDIA. Its purpose is mostly educational: it is primarily intended to teach how to write rendering algorithms, ranging from simple forward path tracing, to bidirectional path tracing, to Metropolis light transport with many of its variants, and do so on massively parallel hardware.
The choice of CUDA C++ has been made for various reasons: the first was to allow the highest level of expression and flexibility in terms of programmability (for example, with template based meta-programming); the second was perhaps historical: when Fermat's development was started, other ray tracing platforms like Microsoft DXR did not exist yet. The ray tracing core employed by Fermat is OptiX - though it is possible that future versions might also offer a DXR or a Vulkan backend.
Fermat is built on top of another library co-developed for this project: CUGAR - CUDA Graphics AcceleratoR. This is a template library of low-level graphics tools, including algorithms for BVH, Kd-tree and octree construction, sphericals harmonics, sampling, and so on and so on. While packaged together, CUGAR can be thought of as a separate educational project by itself. More information can be found in the relevant Doxygen documentation.

Introduction

At the highest level, Fermat is basically a collection of separate renderers. All renderers use Optix as a ray tracing backend, and implement recursive ray / path tracing as an iterative process, in which rays representing new path segments are spawned in wavefronts. This means each renderer is pretty much written like a pipeline of interleaved tracing and shading stages communicating through global memory queues.
Currently, the list of available renderers includes:
All renderers are implemented on top of a single virtual interface, namely the RendererInterface. Among the various methods this class may implement (e.g. for self initialization, registering auxiliary frame-buffer channels, handling mouse and keyboard events, etc), it must implement a single method:
void RendererInterface::render(const uint32 instance, RenderingContext& rendering_context);
which takes a frame instance number, useful for progressive rendering, and a reference to a RenderingContext object: the latter encodes all the information belonging to the current rendering context, including the scene mesh, the output frame-buffer, and so on and so on.
Finally, all unidirectional renderers are based on a common, template-based library for path tracing, described in the PTLib module, while all bidirectional renderers are based on a similar template-based library for bidirectional path tracing, described in the BPTLib module.

Compiling Fermat

Assuming you have Windows 10.0, Visual Studio 2015, CUDA 10.0 and OptiX 6 installed (driver version 418.81 and above), compiling Fermat should be straightforward. It will be sufficient to open the VS solution located in .\vs\fermat\fermat.sln, and press Build -> Build Solution. Note that the solution references three different projects:
  • fermatdll: Fermat's core library
  • fermat: the main executable, linking fermat.dll
  • hellopt: an example plugin renderer

Documentation

Delving into the Pit

If you truly want to know more about Fermat's internals you could certainly just go and look at the code, or skim through the Module List, though admittedly that's something that even the author would hardly ever do with somebody else's codebase. Hopefully, a much better alternative is to follow this link that will guide you through a step by step explanation which, at least in principle, pretends to be written in a more or less logical order:
Fermat: An Overture.

Dependencies

Fermat depends on the following external libraries:
  • CUB : contained in the package
  • a modification of Nathaniel McClatchey's priority_deque : contained in the package
  • FreeGLUT : contained in the package
  • Assimp : contained in the package
  • CUDA 10.0 : not contained - it should be separately downloaded and installed on the system
  • NVIDIA OptiX 6.0 : not contained - it should be separately downloaded and copied in the folder contrib/OptiX
It also needs an NVIDIA Driver 418.81 or newer.

Licensing

Fermat has been developed by NVIDIA Corporation and is licensed under BSD.

Contributors

Fermat is made and mantained by Jacopo Pantaleoni.

Versions and News

4/2/2019
Fermat 2.0
  • New Features:
    • Added an OptiX 6.0 backend with full RTX support.
    • Added a new plugin renderer interface.
    • Added a path-space MLT renderer.
    • Added a novel reinforcement-learning based direct lighting sampler.
    • Added an example plugin renderer.
    • Added a new scene description format and support for more formats with Assimp.
    • Added a pbrt scene importer.
    • Added comprehensive documentation.
20/4/2018
Fermat 1.0
  • First Release

Download

You can download Fermat from GitHub at:
https://github.com/NVlabs/fermat
or directly clone the repository with the command:
git clone https://github.com/NVlabs/fermat