Create an HLSL shader

dx11Shader.mll is the preferred plug-in for creating Direct X shaders. Therefore, the HLSL plug-in is no longer provided with the standard Maya install.

For backwards compatibility, you can download the hlslShader.mll from the Autodesk Maya Bonus Tools package (select Help > Maya Resources and Tools > Download Bonus Tools from the Maya menu) or the hlslShader plug-in example from the Developer Kit download on the Autodesk Developer Network.

To load the HLSL plug-in

  1. Select Window > Settings/Preferences > Plug-in Manager.

    The Plug-in Manager appears.

  2. Load the hlslShader.mll plug-in.

    For more information on the Plug-in Manager, see Plug-in Manager.

  3. Click Close.

To create an HLSL Shader material

  1. In Hypershade, select the HLSL Shader material from the Maya > Surface list.

    The new shading material appears in the Hypershade, and the HLSLShader material node appears in the Attribute Editor.

  2. In the Shader section, type in the path to the .fx file you want to use, or browse to the .fx file.

    Once the .fx file is configured on the hlslShader node, the plug-in automatically loads attributes (if any exist) into the Attribute Editor.

  3. Open the Attribute Editor, and adjust any attributes as necessary.
  4. Assign your new HLSL Shader material to an object in your scene. For more information, see Assign existing materials to surfaces.
  5. In the scene view, turn on Hardware Texturing in the Panel menu: Shading settings.

Supporting texture placement into HLSL shaders

Because texture lookup is performed by the hardware shading code itself, Maya cannot provide automatic support for its native texture placement nodes.

If you wish to use Maya’s texture placement nodes with your hardware shaders, you have to implement the texture placement calculations within your shader code and then expose the placement parameters as uniforms on the shader. The attributes representing these texture placement uniform parameters can then be connected to the corresponding attributes on Maya’s texture placement node, allowing artists to use the node as they would for a native Maya shader.