You can import a custom shader library in the following ways:
These methods are explained in more detail below.
To import a custom shader library
mental ray for Maya is able to load and render with your custom shader library. Placing the declaration file in the include directory also uses mental ray for Maya to parse the file and create new Maya node types that correspond to the shaders declared in the library.
The Shader Manager lets you interactively load and unload mental ray shader libraries and work with them during a Maya session. (You do not need to shut down first, and you do not need to set the environment variable MI_CUSTOM_SHADER_PATH.)
You can select from a list of.mi library files that contain the mental ray shader declarations. The shaders contained in the selected.mi library files automatically appear in Hypershade, just like the Maya and mental ray for Maya base shader nodes. mental ray for Maya base shaders are now fully integrated into Hypershade and Create Render Node panel.
This environment variable should be set prior to loading the plug-in. mental ray for Maya interprets this variable in different ways. If it is not empty but does not point to an existing file or directory, a file dialog opens up as the mental ray for Maya plug-in is (auto-)loaded. A .mi file should be selected that contains mental ray shader/phenomenon declarations which the Factory should create Maya node types for. The file dialog comes up again in a loop to allow more than one .mi file to be loaded. It stops when the Cancel button has been pressed.
If the Factory should load all required files automatically, then a file or a directory containing .mi files should be given in the environment variable. For loading a single file, set MI_CUSTOM_SHADER_PATH as follows:
Same for your shader. If the .mi file is in MI_CUSTOM_SHADER_PATH, you should be able to find your shader name in the Script Editor. For example, my Script Editor has following lines (if optionVar miFactoryVerbosity is set to 4 or higher. ( myshader1 and myshader2 are declared in myshader.mi )
// generating nodes ...
// parsing C:/myshader/include/myshader.mi