Sunday, January 2, 2011

materialInfo

Quite often, unintentionally, mesh will only display in wireframe. More than often it is from accidentally deleting the connection from the mesh to the shading group. However, if you are scripting a file translator or shader exporter you might have ignored the materialInfo node. Almost invisible to the user it is necessary for hardware rendering of any shader.

A: Correct Connections, B: MaterialInfo Error, C: Deleted ShadingGroup
As you can see the problem is indistinguishable in the hypershade.  The only way to tell if you've got this problem is to view B's material in the Attribute Editor.  If most of it's Hardware Texturing features are disabled try the following.
miNode=cmds.createNode("materialInfo")
cmds.connectAttr("phong1SG.message", "%s.shadingGroup"%miNode)
cmds.connectAttr("phong1.message", "%s.material"%miNode)