-
Notifications
You must be signed in to change notification settings - Fork 2
Building Renderers
RenderToolbox3 uses sampled spectra instead of RGB colors. This improves rendering accuracy, but requires the renderers to be build from source with a few modifications.
If you use OS X 10.6 or higher, you can get pre-built renderers from the RenderToolbox3 downloads page.
Or you can read on and try to build the renderers from source.
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.
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
The pbrt-v2-spectral source code has been modified from the official PBRT source code in a few ways:
- 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.
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 in teh Makefile
. We, the developers of RenderToolbox3, haven't tried method.
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 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 open-source 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.
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.
Setion 4.1.1 has you choose a platform-specific configuration script, and copy with the name setup.py
. In setup.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
andLINKFLAGS
, 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
.
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.
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.