New video up on generating masks (mattes) in Renderman for Maya.
Here’s a quick script to connect up a single PxrMatteID node to many PxrMaterial nodes.
import pymel.core as pym
mynodes = pym.ls (sl=True, fl=True, dag=False, ni=True)
mybxdfs = []
myhairs = []
mymatteid = []
for x in mynodes:
if isinstance(x , (pym.nodetypes.PxrSurface, pym.nodetypes.PxrLayerSurface)):
mybxdfs.append(x)
if isinstance(x , ( pym.nodetypes.PxrMarschnerHair)):
myhairs.append(x)
if isinstance(x , (pym.nodetypes.PxrMatteID)):
mymatteid.append(x)
if len(mymatteid) == 1:
for b in mybxdfs:
mymatteid[0].resultAOV.connect(b.utilityPattern[0], force=True)
for h in myhairs:
mymatteid[0].resultAOV.connect(h.inputAOV, force=True)
elif len(mymatteid) != 1:
print 'too many PxrMatteID nodes selected, just try one'
Enjoy
Hi!
Is there any way to automatically assign a color for each object? I have a scene with a couple hundred of objects and I would like them to have a different color in the matteID.
Regards,
João Martins
Hi João,
Check out the video at 7 minute mark, I show how to do this with PxrVary. No scripting required.