This repository contains the cheap-then-expensive implementation of Delayed Rejection Metropolis Light Transport based on the differentiable path tracer DPT which implements Anisotropic Gaussian Mutations for Metropolis Light Transport through Hessian-Hamiltonian Dynamics.
If you want to understand the algorithm by looking at the code, you should start with:
- Delayed Rejection MLT
src/integrators/delayed/delayed.*
- H2MC
src/integrators/h2mc.*
In case of problems/questions/comments, do not hesitate to contact the authors directly.
Note that the original code was refactored a bit in order to facilitate our experiments. Among the most important changes are:
- The program now uses CMake as a build system instead of tup
- We removed the dependency on ispc to compile the derivative code it generates, it now uses gcc.
- The dynamic library compilation is now done in parallel.
- We removed the need to set the environment variable
DPT\_LIBPATH
to specify the path to the generated dynamic library. It is now assumed to be in the same directory as the one where the program is executed from. - The original
dpt/src/[mlt.* & h2mc.*]
files where split into different integrators found insrc/integrator/*
and mutations type / Markov states found insrc/mutation.*
- A minor mistake in the original
dpt/src/h2mc/ComputeGaussian(...)
function was fixed. - Minor tweaks to statistics and outputs were added.
- We did not implement the motion blur and lens mutations functionalities in the delayed rejection integrator.
For more information, you can refer to the original DPT repository.
- Eigen3, already in external
- glog, already in external
- embree, already in external
- OpenImageIO v2
- zlib
- pugixml, already in src
- PCG, already in src
We provided installation instructions for ArchLinux only, but the installation procedure is similar on Ubuntu using apt install
. Configure and build the project using Cmake:
mkdir build && cd "$_"
cmake ../
make -j
To install the tooling dependencies, run:
pacman -Sy python3 python-pip
pip3 install numpy matplotlib pyexr
To create/compile the dynamic library of path derivatives, add the argument --compile-bidirpathlib
when running the program.
Below is an example using 10 threads:
cd <PATH_TO_DPT_EXECUTABLE>
./dpt --p=10 --compile-bidirpathlib
Doing so will save the dynamic library pathlibbidir.so
in the <PATH_TO_DPT_BIN>
directory. Note that this will need to be built from scratch the first time the program is compiled, when changes in code have an impact on the path structure (e.g. adding a BRDF) or when deeper paths are needed.
We modified and added the following integrators:
src/integrator/mcmc
: A variation of MMLT using isotropic Gaussian mutations.src/integrator/h2mc
: A variation of MMLT using H2MC aniotropic Gaussian mutations (H2MC).src/integrator/delayed/delayed
: This is the core of our DRMLT algorithm.
You can select between them by setting the integrator=[mcmc, h2mc,drmlt]
parameters in the scene .xml
.
Parameter | Description | Requirement |
---|---|---|
type |
Delayed rejection framework | Optional (Default: green ) (Options: mira, green ) |
acceptanceMap |
Output acceptance map | Optional (Default: false ) |
anisoperturbprob |
Probability of doing an isotropic or anisotropic move at the second stage | Optional (Default: 0.5 ) |
anisoperturbstddev |
Standard deviation of second stage isotropic proposal | Optional (Default: 0.0025 ) |
This implementation of delayed rejection support two types of frameworks:
- Original Framework: Proposed by Tierney & Mira [1999]. Suffers from vanishing acceptance at the second stage.
- Generalized Framework: Proposed by Green & Mira [2001]. Uses reversible jump to solve the vanishing acceptance problematic by sampling an expensive intermediate state.
You can select between them by setting the type=[green, mira]
parameters in the scene .xml
.
When using the drmlt
integrator, you can generate an acceptance map by setting the acceptanceMap=true
parameters in the scene .xml
. Doing so will generate an RGB image such that the R-channel corresponds to the number of accepted samples at the first stage and the G-channel is the same for the second stage. To convert this image to a heatmap, use the standalone script ./tools/stages_heatmap.py
. For example, the following command saves the acceptance map during rendering:
python <PATH_TO_DPT__ROOT>/tools/stages_heatmap.py \
-t <PATH_TO_ACCEPTANCE_MAP>/acceptance_map.exr \
-c [0.2,0.8]
Parameter | Description | Requirement |
---|---|---|
t |
Acceptance map | Required |
c |
Pixel range (clip) for heatmap images | Optional (Default: [0,1] ) |
With each scene, we provide the following preset parameters used to generate the renders in our paper:
scene_h2mc.xml
: run with theh2mc
integrator.scene_mcmc.xml
: run with themcmc
integrator.scene_drmlt.xml
: run with thedrmlt
integrator usinggreen
framework.scene_drmlt_map.xml
: Output the acceptance map usingdrmlt
andgreen
.
- 2020/07/29: Initial code release
This code is released under the The MIT License (MIT).