-
Notifications
You must be signed in to change notification settings - Fork 2
Spectrum Bands
RenderToolbox3 uses renderers that render in multi-spectra (wavelength-by-wavelength) fashion. This improves rendering accuracy and allows users to specify multi-spectral reflectances and illuminant spectra, but requires a little bookkeeping to keep track of spectrum bands.
This page describes spectrum bands as seen from renderers, RenderToolbox3, and the Psychophysics toolbox.
The renderers PBRT and Mitsuba must be [built from source](Building Renderers) in order to use sampled spectra. We have pre-built versions of PBRT, and Mitsuba which sample the spectrum with 31 bands, in the range 395-705nm. These should work with OS X 10.6.
Note that spectrum values specified at renderer build time refer to spectrum band edges. So 395nm is the low edge of the first band, and 705nm is the high edge the last band. This gives each band a width of 10nm.
Each renderer outputs images with multiple color channels, one for each spectrum band. Mitsuba saves a band description along with each color channel, so RenderToolbox3 is able to read band descriptions along with image data. pbrt-v2-spectral doesn't save band descriptions, so RenderToolbox3 keeps track of PBRT spectrum bands using a different mechanism (see Determining "S", below).
Unlike the renderers, RenderToolbox3 describes spectrum bands using band centers. This allows RenderToolbox3 to use lots of colorimetric tools from Psychtoolbox.
Specifically, RenderToolbox3 uses the Psychtoolbox "S" format, which is a compact description of the spectrum bands in an image. It is matrix with 3 elements:
S = [start delta n]
where start
is the center of the lowest band, delta
is the width of each band, and n
is the total number of bands. start
and delta
are wavelengths in nanometers.
The RenderToolbox3 pre-built renderers use an "S" description like this:
S = [400 10 31]
with the start
value falling half way along the first spectrum band, at 395nm + 10nm/2 = 400nm.
For Mitsuba, RenderToolbox3 determines the "S" of each multi-sprectral image by reading band descriptions saved in the image file. The ReadMultispectralEXR()
function returns an "S" along with multi-spectral image data.
For PBRT, RenderToolbox3 always uses the same "S". The InitializeRenderToolbox()
function stores a default "S", which can be accessed later with Matlab's built-in getpref() and setpref() functions. Try:
InitializeRenderToolbox();
S = getpref('PBRT', 'S')
You might want to build the renderers with a different spectrum sampling. For example, the official Mitsuba distribution samples the spectrum in the range 368-830nm. If you build PBRT to use this range, you must tell RenderToolbox3 about your new "S".
The range 368-830nm spans 462mn. If you sampled it with 77 bands, the width of each band would be 6nm. The first band center would fall half way along the first band, at 368nm + 3nm = 371nm. So the "S" description for this sampling would be:
S = [371 6 77]
You would need to tell RenderToolbox3 about this "S", using setpref():
InitializeRenderToolbox();
S = [371 6 77];
setpref('PBRT', 'S', S);
RenderToolbox3 interprets spectral power distributions as having units of Power per Unit Wavelength. In RadianceTest, we determined that Mitsuba and PBRT obey the same convention.
Psychtoolbox colorimetric functions use a different convention, interpreting spectral power distributions as having units of Power per Wavelength Band.
In order for RenderToolbox to make use of Psychtoolbox colorimetric functions, it must keep track of the different conventions:
- When getting spectral power distributions from Psychtoolbox, RenderTooblox3 uses the functions
ImportPsychColorimetricMatFile()
andSpdPowerPerWlBandToPowerPerNm()
. - When sending spectral power distributions to Psychtoolbox, RenderTooblox3 uses the function
SpdPowerPerNmToPowerPerWlBand()
.
These functions scale spectral power distributions up or down, by the width of a spectrum band, in order to accommodate one convention or the other.
When invoking RenderToolbox3 functions, users should always assume that spectral power distributions are in units of Power per Unit Wavelength. Users should not need to worry about Power per Wavelength Band, unless invoking Psychtoolbox colorimetric functions directly.