Before you can create a CgFX shader, you must first load the CgFX plug-in. See Work with CgFX shaders for more information.
CgFX examples are shipped with the Maya software. You can find these examples at:
You can pack multiple mesh inputs into a single varying parameter register. For example, you can pack two sets of UV coordinates into a single float4 register.
The following is a sample workflow:
struct appdata { float3 Position: POSITION; float4 UVs: TEXCOORD0; };
In this example, this auxiliary structure informs Maya that the original float4 parameter should be assembled on the fly from two float2 inputs: one named UV1, and one named UV2. This structure is not used by the shader itself - it simply tells Maya how to assemble the data for this input.
struct UVs { float2 UV1; float2 UV2; };
For more information, see UVPacking.cgfx as an example.
Select a Maya_*.cgh code example; for example, maya_blends.cgh, the code that Maya uses for blending of the layered texture:
Known limitations for the CgFX shader include: