Before you can create a CgFX shader, you must first load the CgFX plug-in. See Work with CgFX shaders for more information.
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: