Multiple UVs in CGFX Shaders

I am trying to expose Multiple UV Sets to my CGFX Shader, but when the Shader is initialized, it is not auto-populating the Vertex Data correctly.

Here is what I get:

position is mapped to ‘position’
uv0 is mapped to ‘uv:map1’
uv1 is mapped to ‘tangent:map1’
uv2 is mapped to ‘binormal:map1’

normal is mapped to ‘normal’
binormal is mapped to ‘binormal:map1’
tangent is mapped to ‘tangent:map1’
vertexcolor is mapped to ‘color:colorSet1’

What i really want is:
uv0, uv1, and uv2 to all be assigned to ‘uv:map1’ by default.

I tried re-arranging the structs with no luck…

Anyone know why the CGFX Shader insists on assigning additional UV inputs to the binormal and tangent? I can retrofit the strings afterwards, so it’s only a minor annoyance…

I’m not the best to answer this question (see ben cloward) but, I believe it’s a hardware issue. The GFX card has “registers” that are mapped to specific memory parts of the graphics card memory. In order to have quick access, they are pre-defined. I’m pretty sure I did the same thing your doing when working on a vertex morphing shader. I think it’s just a “how you have to do it” kind of thing.

fyi, it’s been a few years since I worked with shaders, so maybe someone can help me out/correct me.

This behaviour has nothing to do with the CgFX shaders but the way it’s implemented in Maya at a plug-in level.

I think I saw the source at the SDK folder, can’t say for 100% though.
If it’s there you can dwelve down to it and check it out for further clarifications about this behaviour and if it can be resolved.

[QUOTE=rgkovach123;14749]I am trying to expose Multiple UV Sets to my CGFX Shader, but when the Shader is initialized, it is not auto-populating the Vertex Data correctly.

Here is what I get:

position is mapped to ‘position’
uv0 is mapped to ‘uv:map1’
uv1 is mapped to ‘tangent:map1’
uv2 is mapped to ‘binormal:map1’

normal is mapped to ‘normal’
binormal is mapped to ‘binormal:map1’
tangent is mapped to ‘tangent:map1’
vertexcolor is mapped to ‘color:colorSet1’

What i really want is:
uv0, uv1, and uv2 to all be assigned to ‘uv:map1’ by default.

I tried re-arranging the structs with no luck…[/QUOTE]

I found the easiest way around this problem was to have a script that initialises the shader and sets up the uv assignments (you can do it with something like ‘getAttr myShader.UV0_Source’ I think).