<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\section{Miscellaneous topics}
\label{sec:miscellaneous}
\subsection{A word about color spaces}
\label{sec:colorspaces}
When using one of the downloadable release builds of Mitsuba, or a version
that was compiled with the default settings, the renderer internally
operates in \emph{RGB mode}: all computations are performed using a representation
that is based on the three colors red, green, and blue.

More specifically, these are the intensities of the red, green, and blue primaries
defined by the sRGB standard (ITU-R Rec. BT. 709-3 primaries with a D65 white point).
Mitsuba transparently converts all input data (e.g. textures) into this space before
rendering. This is an intuitive default which yields fast computations and
satisfactory results for most applications.

Low dynamic range images exported using the \pluginref{ldrfilm} will be stored in a
sRGB-compatible format that accounts for the custom gamma curves mandated by this
standard. They should display as intended across a wide range of display devices.

When saving high dynamic range output (e.g. OpenEXR, RGBE, or PFM), the computed radiance
values are exported in a linear form (i.e. without having the sRGB gamma curve applied to it),
which is the most common way of storing high dynamic range data.
It is important to keep in mind that other applications may not support this
``linearized sRGB'' space---in particular, the Mac OS preview currently
does not display images with this encoding correctly.

\subsubsection{Spectral rendering}
Some predictive rendering applications will require a more realistic space for
interreflection computations. In such cases, Mitsuba can be switched to \emph{spectral mode}.
This can be done by compiling it with the \code{SPECTRUM\_SAMPLES=}$n$ parameter
(\secref{compiling}), where $n$ is usually between 15 and 30.

Now, all input parameters are converted into color spectra with the specified
number of discretizations, and the computation then proceeds using this space.
The process of writing an output image works differently: when spectral output
is desired (\pluginref{hdrfilm}, \pluginref{tiledhdrfilm}, and \pluginref{mfilm}
support this), Mitsuba creates special image files with many color channels (one
per spectral band).
Generally, other applications will not be able to display these images. The Mitsuba GUI
can be used to view them, however (simply drag \&amp; drop an image onto the application).

It is also possible to write out XYZ tristimulus values, in which case the spectral
data is convolved with the CIE 1931 color matching curves. This is most useful to users
who want to do their own color processing in a space with a wide gamut.

Finally, sRGB output is still possible. However, the color processing used in this case
is fairly na\"ive: out-of-gamut values are simply clipped. This is something that may
be improved in the future (e.g. by making use of a color management library like \code{lcms2})

\subsection{Using Mitsuba from Makefiles}
Sometimes it is useful to run \code{mitsuba} from a standard Unix Makefile. This is a bit inconvenient because  shell commands in Makefiles are executed using the
classic \code{sh} shell, which is incompatible with the \code{setpath.sh} script.
A simple workaround in this case is to explicitly call \code{bash} or \code{zsh}, e.g.
\begin{shell}
MITSUBA_HOME=$\langle$..$\rangle$
%.exr: %.xml
    bash -c ". $\texttt{\$}$(MITSUBA_HOME)/setpath.sh; mitsuba -o $\texttt{\$}$@ $\texttt{\$}$&lt;"
\end{shell}

</pre></body></html>