Using maya light linking inside mental ray shader A source file mayaLightlink_baselambert.c modifies the existing shader mib_illum_lambert so that maya light linking is respected. mayaLightlink_baselambert.mi is the shader declaration. mentalray for maya 6.0 and later versions connect lights to the light array of the shader based on the light-object relationship on rendering time. ( You can check this in The exported .mi file. ) If you want to handle the light linking in the shader level, not using this feature, a few more extra steps should be done besides modifying the shader code. 1. Disable the feature by adding a dynamic attribute to your shader. For example, addAttr -ln "miLightLink" -at bool mayaLightlink_mib_illum_lambert1; If the value of this attribute is 0, mentalray for maya will not connect lights to the light array for this shader. 2. Set light mode to 2 so that all the lights in the scene are checked against the light linking. 3. Connect lightLinker node(s) to the shader. For example, connectAttr lightLinker1.message mib_illum_lambert_mayaLightlink1.lightLink;