Maya Material Names

If I create a material in Maya and rename it, Collada seems to pick up the original name, not the new name-

eg. if I create a Phong material and rename to “AndyPhong”, I still get

<material id="phong1SG" name="phong1SG">

in the output. Is this intended?

I’ve observed this behavior as well. It seems the Maya exporter writes out the name of the “shadingEngine” node as the material name, rather than the “shader” node. Here’s some lines snipped from an ASCII Maya file:

createNode shadingEngine -n "phong1SG";
createNode phong -n "phong1";
connectAttr "phong1.oc" "";
connectAttr "phong1SG.mwc" "objShape.iog.og[9].gco";

The “output color” (oc) of the “phong1” shader node connects to the “surface shader” (ss) of the “phong1SG” node. The “member wireframe color” (mwc) is then connected to the “object group color” (gco) of some group of polygons in a mesh. The name the artist sees in “Hypershade” is “phong1”. The corresponding line in the Collada file:

<material id="phong1SG" name="phong1SG">

If you changed the node name of “phong1” (the phong shader), it wouldn’t have any effect on the shading engine node that actually determines the material name. The “shadingEngine” node can have a “surface shader” (ss) and a “displacement shader” (ds) connected to it (in other words, multiple shader nodes could feed into one “shadingEngine” node), so it probably doesn’t make sense to refer to the shader name if you might have a scene with displacement shaders, since the shader name might not be unique. I’m not sure what the Maya reader does to generate both the name of the “shadingEngine” and “shader” nodes given the single material name.

There are a couple options if you want to “fix” this problem. You could tell the artist to name the “phong1SG” node something meaningful instead of the “phong1” node if you care about material names. Or you could change the exporter to generate the material name as a concatenation of the “surface shader” and “displacement shader” node names (potentially leaving out the latter name if it wasn’t necessary to uniquely name a material).