1. Load the CGFX Plug-In

This illustration shows how and where to set the CGFX Plug-in for Maya 2011.
  • Make sure to select “Auto load” from the “Plug-In Manager.” This ensures that the CGFX plug-in will load even if Maya restarts (save your preferences before a crash, or close Maya normally, to remember this setting)
  • Window → Settings/Preferences → Plug-In Manager

2. Create a CGFX Shader

Through the Hypershade window you create new CGFXShader materials. Now that the plug-in is loaded you will see a button to create CGFX in the Hypershade

3. Assign the shader program to the Maya CGFX Shader

When viewing the selected shader in the Attribute Editor
  1. click the yellow manilla envelope icon
  2. Select your desired *.CGFX shader file from the Open menu and accept
  3. The *.cgfx file is now loaded into the CGFXShader material in Maya

4. Assign the Material to an Object

  1. Select the object to which the new shader belongs.
  2. RMB+Hold on the object: do not let go of RMB+Hold until all steps below are complete
  3. Navigate to Assign Existing Material
  4. Drag mouse over desired material
  5. Let go of RMB+Hold over the desired material

5. Assign the appropriate UV sets and Color sets to the shader

This step is important because this section describes how to assign UV sets and Color sets to assigned CGFX shaders. If the wrong UV or Color sets are assigned you will see unexpected results or a solid color over the whole object
  1. In the Attribute editor for the desired shader
  2. RMB+Hold over the Color attribute in the Vertex Data section and select the appropriate Color Set (provided this object has a color set assigned)
  3. ::NOTE:: Not all CGFX shaders use color sets so this attribute may be missing in some shaders
  4. This is the same process for assigning UV sets

6. Assign desired textures & 7. Modify Attributes

Using the CGFX shader now is just like using a Maya material. Each shader has a different use and set of functions, just like the various Maya materials. Both shaders and materials have different render times based on shader complexity

Vertex Data

When Passing Data Using Structs in your Shaders

This is an example of CGFX shaders that use structs to pass data between the internal vertex and fragment programs. The benefit of using structs in your shaders is attribute types are only listed once. In this example, as contrasted from the one below, you’ll notice that “UV” is mentioned only once

When Passing Data Using Individual, Local Semantics in your Shaders

 

Duplicate UV and Color set Names

What you see below is one of the most common errors with CGFX shader use in Maya. The below illustration shows what happens during the following conditions
  1. When a CGFX Shader is assigned and is looking for a UV set name that is not located on an object, even when the shader is assigned to the object
  2. When two objects are assigned to the one shader but have different UV Sets names

 

Troubleshooting CGFX Shaders

Q: My Textures Aren’t Showing Up!

  1. This is most often caused by the CGFX shader looking for a UV set name that is not found on the affected mesh.
  2. CGFX shaders are only viewable in Hardware Texture mode.
    1. To enter Hardware Texture mode press the hotkey 6 when the persp window is active.

Q: My objects are Pink!

  1. Make sure you have a valid .cgfx file and path loaded into the material attribute editor.
  2. Make sure the CGFX plug-in is loaded.
  3. Make sure your project folder is set to the right directory, otherwise a newly opened file may look like it doesn’t have shaders  attached. File > Set Project…

Q: My Objects are Green!

  1. Make sure you’re viewing in Hardware Texture Mode.

Q: Transparent objects have weird, blocky artifacts!

  1. This shows up on some Fermi level cards. Update your nVidia driver to the most recent version.

Last Modified: August 6, 2014