Create a CgFX shader

The use of the CgFx shader is no longer recommended as it is based on legacy technology. Use the GLSL shader instead.

CgFX shaders are only supported in the OpenGL - Legacy and OpenGL - Core Profile (Compatibility) display modes. See Viewport 2.0 Rendering engine.

To load the CgFX plug-in

  1. Select Window > Settings/Preferences > Plug-in Manager.
  2. In the Plug-in Manager, load the plug-in, then click Close.

To create a CgFX Shader material

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

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

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

    Once the .cgfx file is connected to the CgFXShader node, the plug-in automatically loads attributes (if any exist) into the Extra Attributes section in the Attribute Editor.

  3. Open the Extra Attributes section, and adjust any attributes as necessary.
  4. Assign your new CgFX 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: Shading menu.

Adding placement into CgFx shaders

Cgfx shaders do not automatically support texture placement which is found inside Maya (place2DTexture or place3DTexture node) because CgFx is a node which uses a programmable shading language. Using this language means that the texture transform cannot be set from outside. Instead, it needs to be explicitly coded into the shader. If such parameters are in the shader, then the automatic UI generation creates the UI elements. You should then connect the appropriate attributes from the texture placement node(s) to the attributes on the shader.

Reloading, Editing and Viewing CgFx files

In the Attribute Editor of the cgfxShader node, you can use the Reload, Edit and Open buttons to work on the FX file you’ve specified.

Reload

Reloads the specified CgFx file from the disk.

Edit

Opens the specified CgFx file in Microsoft® Notepad on Windows, and vi on Linux, for editing. Edit the file as required, and save it. Maya automatically reloads the CgFx file.

Open

Opens the specified CgFx file in Notepad in read-only format on Windows, and vi on Linux.