Skip to content
Ben Heasly edited this page Feb 3, 2016 · 35 revisions

RenderToolbox3 requires renderers that render in multi-spectral fashion (that is, on a wavelength-by-wavelength basis). This improves rendering accuracy, but requires the renderers to be built from source with a few modifications.

We have a few Pre-Built-Renderers available which you might wish to use instead of building from source. So far, we are focused on OS X, but may add more in the future.

Below, you can read an overview of building each renderer from source.

PBRT

PBRT is a physically-based renderer. By default, PBRT can't write multi-spectral outuput files, so RenderToolbox3 uses a special variation on PBRT called pbrt-v2-spectral. Thanks to Andy Lin and others at Stanford University for making pbrt-v2-spectral available.

Get pbrt-v2-spectral

pbrt-v2-spectral is hosted at GitHub. You can download the source in .zip format here.

You can also use the version control tool Git to clone the pbrt-v2-spectral repository from like so:

git clone https://github.com/ydnality/pbrt-v2-spectral.git

The pbrt-v2-spectral source code has been modified from the official PBRT source code in several ways. These modifications directly affect RenderToolbox3:

  • It samples the spectrum in the range 395-705nm.
  • It uses 31 spectrum samples instead of RGB colors.
  • It writes output files in a custom, multi-spectral .dat format.
  • It defines an "anisoward" material, which implements the anisotropic Ward distribution.

See Spectrum Bands for more about spectrum sampling ranges.

Get GSL and OpenEXR

pbrt-v2-spectral depends on the GSL framework and the OpenEXR} image library. You must install these dependencies before you can build or use pbrt-v2-spectral.

On OS X the best way to get GSL and OpenEXR is probably to use the Homebrew package manager. Once you have Homebrew installed, you should open a terminal and type

brew install gsl openexr

On Linux, you should install GSL and OpenEXR using your distribution's package manager. For example, on Ubuntu, open a terminal and type

sudo apt-get install gsl-bin libgsl0-dev libilmbase-dev libopenexr-dev

Build pbrt-v2-spectral

Once you have the source code, there are a few ways to build pbrt-v2-spectral. README_BUILDING.txt describes a few, including make, SCons and XCode. It is located with the source code here:

(path-to-pbrt/pbrt-v2-spectral)/src/README_BUILDING.txt

On OS X and Linux, the easiest way to build is with probably with the make tool.

OS X, you may need to override the name used for the "flex" library. By default on Linux the library is named lfl. But on OS X it's named ll. To build with this name on OS X use

cd pbrt-v2-spectral/src
make "LEXLIB=-ll"

On Linux, you should be able to use plain old

cd pbrt-v2-spectral/src
make

Output

When you succeed in building pbrt-v2-spectral, you should end up with a pbrt executable in some folder such as

(path-to-pbrt/pbrt-v2-spectral)/src/build/Products/pbrt

Remember this location when you go to install RenderToolbox3.

Mitsuba

Mitsuba is another physically based renderer. The Mitsuba documentation is excellent, and includes detailed instructions for building the renderer from source. Here is a link to the Mitsuba reference manual.

Note that Mitsuba is distributed with the version control tool Mercurial, and built with the build tool SCons.

Also note that as of Mitsuba 0.4, Mitsuba can write multi-spectral output files! So it works with RenderToolbox3 almost off-the-shelf.

Build Modifications

Section 4 of the Mitsuba reference manual contains detailed instructions for building Mitsuba, on various platforms. RenderToolbox3 makes a few minor modifications to the build process.

config.py

Setion 4.1.1 has you choose a platform-specific configuration script from the build/ folder, and copy it to the main folder with the name config.py. In config.py:

  • In the definition of CCFLAGS, find the flag -DSPECTRUM_SAMPLES. Edit it to read -DSPECTRUM_SAMPLES=31. This enables rendering with sampled spectra instead of RGB colors.
  • In the definitions of CCFLAGS and LINKFLAGS, make sure any system paths point to the correct locations. On OS X, this might mean changing /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk to something like /Developer/SDKs/MacOSX10.6.sdk.
spectrum.h (optional)

By default, Mitusba samples the spectrum in the 360-830nm range . This should work fine. But you may wish to use a smaller range, to get a different tradeoff between rendering time and sample resolution. The pre-built Mitsuba on the downloads page uses the range 395-705nm. To do the same, edit spectrum.h, which you can find in

(path-to-mitsuba)/include/mitsuba/core/spectrum.h

Near the top, find SPECTRUM_MIN_WAVELENGTH and SPECTRUM_MAX_WAVELENGTH, and edit them to read

#define SPECTRUM_MIN_WAVELENGTH   395
#define SPECTRUM_MAX_WAVELENGTH   705

That should do it.

See Spectrum Bands for more about spectrum sampling ranges.

Output

Once you've been through the steps in Section 4 of the reference manual, you should be able to build Mitsuba. In a terminal, you can type

cd (path-to-mitsuba)
scons

or

cd (path-to-mitsuba)
scons -j n

where n is the number of processor cores you want to use for the build process.

Scons works well, but it's notoriously slow. So go make some tea or compose an opera.

When SCons is finished, you should see

scons: done building targets.

This should result in a new Mitsuba executable or app bundle. On OS X, it would be

(path-to-mitsuba)/Mitsuba.app

Remember this location when you go to install RenderToolbox3.

Adventures on CentOS

If you have the nerve, you can also read our detailed descriptions of building renderers on one specific CentOS Linux system. These are somewhat gory because we were building the renderers without root privileges, and the system had out of date RPM packages. These steps might be useful for reference, but they are not good guides for general use:

Clone this wiki locally