Skip to content
Ben Heasly edited this page Feb 19, 2015 · 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.

If you use OS X 10.6 or higher, you might be able to use renderers pre-built by the RenderToolbox3 team. Here is PBRT, and here is Mitsuba.

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

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.

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 here:

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

pbrt-v2-spectral depends on the GSL framework, so you must install GSL before you can build or use pbrt-v2-spectral. You can find an OS X installer for GSL at the Kyng Chaos Wiki. You can also install GSL using MacPorts.

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.

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, the easiest way to build is with the XCode project, located in the same folder.

(path-to-pbrt/pbrt-v2-spectral)/src/pbrt.xcodeproj

On Linux and OS X, the make utility should work, but may require some system configuration.

For example, on 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

make "LEXLIB=-ll"

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.

Clone this wiki locally