You can use FX files containing HLSL (High Level Shading Language) and GLSL (SGI® OpenGL® Shading Language) shaders in Maya, with the ASHLI plug-in. The ASHLI plug-in is now available as part of the Maya Bonus Tools. Bonus Tools is a free collection of useful Maya scripts and plug-ins that are available from the Autodesk Web site (www.autodesk.com/maya-bonustools).
You can load this plug-in from Maya’s Plug-in Manager. ASHLI is available for Microsoft® Windows® and Linux® operating systems only.
The ASHLI plug-in makes a shading material available in Hypershade which contains an attribute that you can connect to an FX file. The plug-in then loads this FX file and displays any settings as attributes in Maya’s Attribute Editor. In the scene view, you’ll see the ASHLI shader when you enable Hardware Texturing.
Currently, the ASHLI plug-in supports file textures, 2D textures, and cube maps. To use the ASHLI plug-in, you’ll need a graphics card that supports fragment and vertex shaders under OpenGL. One of the following graphics cards are required:
For more information, see About hardware shaders.
For more information on the Plug-in Manager, see Plug-in Manager.
To create an ASHLI Shader material
The new shading material appears in the Hypershade, and the AshliShader material node appears in the Attribute Editor.
Once the FX file is connected to the AshliShader node, the plug-in automatically loads attributes (if any exist) into the Extra Attributes section in the Attribute Editor.
Reloading, Editing and Viewing FX files
In the Attribute Editor of the AshliShader node, you can use the Reload, Edit and View buttons to work on the FX file you’ve specified.
Opens the specified FX file in Microsoft® Notepad on Windows, and vi on Linux, for editing. Edit the file as required, and save it. Maya automatically reloads the FX file.
If you want to use a different application for editing, see Setting viewing and editing preferences.
Opens the specified FX file in Notepad in read-only format on Windows, and vi on Linux.
If you want to use a different application for viewing, see Setting viewing and editing preferences.
Setting viewing and editing preferences
If you want to use an application other than Notepad (on Windows), and VI (on Linux) for viewing or editing FX files, you can set the appropriate Maya option variables in the Script Editor.
For more information on variables, see Variables. For more information on the Script Editor, see Script Editor.
optionVar -stringValue ashliViewCommandOptionVar "<application_name>";
where <application_name> is the name of the application you want to use for viewing FX files.
Tips for working with ASHLI shaders
If you’re using GLSL and you want to use Maya lights in your scene, you can take advantage of built-in keywords for the language. Using keywords makes it easier to track numerous lights in your scene.
The usage of keywords is described in OpenGL® Shading Language by Randi Rost (Published by Addison Wesley Professional; ISBN:0321197895). You can also see the OpenGL Shading Language specification documents on the 3Dlabs website (developer.3dlabs.com/documents/index.htm).
Rendering the same scene with Maya Software and Maya Hardware
You may have some scenes which you’d like to render in Maya Software and Maya Hardware. For such scenes, you can connect your ASHLI shader to your software shader. This way, you’ll have one shader on the mesh for each of the renderers.
You can use ATI’s RenderMonkey™ to develop FX files to use with Maya’s ASHLI plug-in. The effects must be saved with the RenderMonkey FX Exporter plug-in in order to be used with Maya’s ASHLI plug-in.
Currently the RenderMonkey FX Exporter does not support GLSL, so you can only use HLSL shaders. In addition, RenderMonkey uses an identity world transformation, so some effects may need to be modified to display properly in Maya. To avoid this, change the ViewProjection semantic to WorldViewProjection.
Important information about the limitations of ASHLI are available on the ATI website (www.ati.com).