Keywords: main

Next: 5.3 Stack Size Up: 5. Usage and Command Previous: 5.1 Command Line Options

# 5.2 Startup File

When mental ray starts up, it automatically checks the following list of startup files:

Unix: |
| `.rayrc`
| `$HOME/.rayrc`
| `$MI_ROOT/rayrc`
| `/usr/local/mi/rayrc`
Windows NT: |
| `rayrc`
| `%MI_ROOT%rayrc`
| `%SystemDrive%rayrc`
| `%SystemDrive%Program Files mental imagesrayrc`

If the startup file is found, it is read and parsed like a regular .mi scene file. After one such file was read, the search is terminated without searching in the remaining locations. `HOME`, `MI_ROOT`, and `SystemDrive` are environment variables.

The purpose of the startup file is portable initialization. For example, it may contain `link` statements that load commonly used shader libraries, or `$include` statement to load shader declarations (after the corresponding `link` statement). One important point is that different systems with different directory structures can be handled with different local startup files, such that paths built into scene files that could cause incompatibilities are no longer necessary. On Windows NT systems, for example, paths and library names are generally different than on Unix systems, and startup files can be used to hide the differences.

Remote rendering servers on other hosts also read the startup file, but they ignore all `link` and `code` statements. (It is not a good idea to put `code` statements into a startup file because running the compiler can make mental ray startup time unacceptable.) This is done to make sure that the shader library list on the server is consistent with the shader library list on the client host.

Although startup files support the full .mi language, they should only be used for initialization and not to preload geometry or other scene database elements because this could cause conflicts with scenes that are loaded later. In particular, `render` statements may not be used in a startup file; mental ray will abort parsing the startup file at a `render` statement.

Next: 5.3 Stack Size Up: 5. Usage and Command Previous: 5.1 Command Line Options