Renderman + Masks

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 = (sl=True, fl=True, dag=False, ni=True)

mybxdfs = []
myhairs = []
mymatteid = []

for x in mynodes:
    if isinstance(x , (pym.nodetypes.PxrSurface, pym.nodetypes.PxrLayerSurface)):
    if isinstance(x , ( pym.nodetypes.PxrMarschnerHair)):
    if isinstance(x , (pym.nodetypes.PxrMatteID)):

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'


2 thoughts on “Renderman + Masks”

  1. 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.

    João Martins

Leave a Reply

Your email address will not be published. Required fields are marked *