Volume 3 of the mental images® reference books is accompanied by a CD that contains demo versions of mental ray suitable for Windows, Linux and MacOSX (32 & 64bit). Because the demo version of mental ray (mr) on the CD is "fully featured" these notes refer to it as Demo Complete. The CD contains an installer that assists users to get started with mental ray with the minimum of inconvenience. This tutorial addresses issues of,
Readers who have installed the version of mental ray (Demo Limited) that comes on the CD that accompanies volumes 1 and 2 of mental images reference books should refer to the tutorial "Mental Ray: Setup for CD vol I & II". For information about installing and setting up the Cutter text editor refer to the tutorial "Cutter: Installation".
The Users Directory Structure
When writing and testing shaders, users will create at least three types of documents, namely,
This section recommends the adoption of a simple directory structure that will help the reader keep their files organized. It is suggested that directories named,
The full paths to these directories are given in the tutorial "mental ray: Cutter Preferences". If Cutter's mental ray preferences are set correctly, mi interface description files will be automatically generated and saved in both the users shader_src and shaders directories.
The rayrc File
A rayrc file defines a series of search paths that enables mental ray to find compiled shaders, their accompanying .mi interface descriptions and other resources needed by the renderer.
During the installation of mental ray, users are given the opportunity to specify the location of the renderer and other resources. The default location used by the installer is,
C:\Program Files\mental images\mental ray Demo 32-Bit Edition
These notes assume the user did not use the default location but, instead, specified the following path,
Within the mi directory the reader will find mental rays primary rayrc file. Rather than editing the primary rayrc file it is better for the reader to save a custom rayrc in their scenes directory ie.
A sample custom rayrc file is given below. Edit the paths shown in bold blue text so that they conform to the location of the readers custom shaders.
rayrc for Windows
Linux & MacOSX
On Linux and MacOSX the primary .rayrc document, note the leading period, is located in,
Rather than editing its contents it is better for the user to create a custom .rayrc file in the root directory of their user account. Sample .rayrc files are given below. Their text can be copied and pasted into the users custom file. However, take to edit the text shown in bold blue so that it conforms to the readers account name.
.rayrc for Linux
.rayrc for MacOSX
Windows Library "shader.lib"
This section is specific to users of Windows. A library file named "shader.lib" must be copied from,
Customizing the Compilation of Shaders
As explained in the tutorial,
"Cutter: Integration with mental ray", Cutter uses
copies of operating specific templates to compile and link a shader. Its default templates
are located in,
The default templates work with fully licensed versions of mental ray as well as the demo version (Demo Limited) that comes with volumes I and II of the mental images reference books. However, readers who use the Demo Complete version of mental ray, from volume III, must create a customized version of a template. This section provides step-by-step instructions on how customization is achieved.
Step 1 - Open the Default Template
Windows users should open a copy of a template named Build_mishader.bat - figure 1.
Linux and MacOSX users should open their operating specific makefile template. They are named, respectively, Makefile.mishader_LINUX and Makefile.mishader_OSX - figure 2.
An untitled copy of the default template will open on Cutter's desktop.
Step 2 - Editing the Default Template
Windows users must search the untitled (.bat) template document for the following quoted text.
"C:\Program Files\mental images\mental ray\include" "C:\Program Files\mental images\mental ray\lib\shader.lib"
Both strings must be edited so that the paths to the include and lib directories
match the path to the directory in which they installed mental ray. For example,
if the installation directory is
"C:\Program Files\mi\include" "C:\Program Files\mi\lib\shader.lib"
Linux and MacOSX users must, likewise, search their untitled (makefile) template document for the following text.
It must be changed to
Step 3 - Saving the Custom Template
The edited template must be saved in the custom_templates directory that is located in the same directory as the cutter.jar file. The easiest way to do this is to choose the Save As a Template... menu item - figure 3.
On Windows the template should saved in the
On Linux and MacOSX the template must be saved in the
Testing the Setup
The reader can check if their "settings" are correct by following the notes in the tutorial, "Cutter: Getting Started with mental ray"
© 2002- Malcolm Kesson. All rights reserved.