To locate the shaders that mental ray will load at runtime, you can
create an optional “run control” file that mental ray will load when it
begins to render. You may be familiar with a similar mechanism from
Unix shells, for example, the .bashrc file that is read when the Bash
shell begins execution. In mental ray, this file is called “rayrc”.
The rayrc file
To load shader libraries at the time of rendering, mental ray must
determine where each compiled shader file, referenced by the link
statement, is located. When rendering begins, mental ray looks for a
file called “.rayrc” in Unix-based systems or “rayrc” in Windows.
The rayrc file typically contains a description of the directories in
which mental ray should search for shader files.
The rayrc file is written in the .mi scene file language. This means
that anything you can do in a scene file, you also do every time mental
ray begins rendering by inserting the appropriate .mi statements in
the rayrc file. For example, the rayrc files included as part of the
book’s software environment also link the shader library “newblocks,”
which contains geometry shaders for some of the simple objects in the
example scenes.
Linux and Mac OS X
In Linux and Mac OS X, you can copy the appropriate file to the
directory which contains the scene files you are rendering. Rename
the file “.rayrc” (with an initial period character).
These rayrc files also contain documentation that further describes
how they are interpreted by mental ray.
You can also copy the rayrc file to your home directory; mental ray
will look there next after it searches in the current directory. (If
you already have a rayrc file there, save it with a different name
first so you can restore it later if necessary. Remember that by
default in most Unix shells, an initial period character in the
filename will prevent it from being listed with the plain “ls”
command. Use “ls -a” instead.)
Microsoft “Windows”
For the various Microsoft Windows versions, the “rayrc.windows” file can be
copied to the directory containing the scene files you are rendering;
mental ray will search there first for a rayrc file. The file should
be called “rayrc”. (Note that, in Windows, the rayrc filename does
not begin with an initial period character.)
The rayrc files listed above contain additional information
about the rayrc mechanism. The rayrc search order is described on
page 412 of Rendering with mental ray (3rd edition).
(See [Driemeyer 05a] in the Bibliography
page.)