Write a shader declaration file
 
 
 

For an example of how to write shader header and source code, see Maya2010/devkit/mentalray. Maya2010/mentalray/include contains base.mi, contour.mi and physics.mi that declares basic shaders.

As a part of devkit, Microsoft Visual Studio project files are shipped. You can open base.dsw, contour.dsw, physics.dsw and compile them yourself.

If apply is not provided in the shader declaration, you will find the shader node in Miscellaneous section of the Create Render Node window (or bar in the Hypershade).

To place the node into a different category, use the apply keyword in the shader declaration. For example, for mib_texture_vector (base.mi). mib_texture_vector node is under Textures section:

 declare shader
 vector "mib_texture_vector" (
 integer "select",
 integer "selspace",
 integer "vertex",
 integer "project"
 )
 version 2
 *apply texture*
 end declare
NoteFor some categories not supported by the apply flag (contour, for example), we provide a mel script: mentalrayCustomNodeClass.mel

Please refer to the comment in the file for further detail.

Click your shader node. The shader has blank icon and the Script Editor will have a warning message, unless you provided render_myshader.xpm.

Check out the Attribute Editor of the shader. If the shader had any parameters, you should be able to see corresponding fields in the Attribute Editor.

You can create your own Attribute Editor Template file to provide better look of the attribute editor.

If the shader is called myShader, create a file called AEmyShaderTemplate.mel, and place it in Maya2010/scripts/AETemplates.