Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
themeConfluence
titleMatteID OpScript
Interface.SetAttr("prmanStatements.attributes.user.MatteID1", gb:build())

Part 2: Associate the ID in two ways

  1. To associate an object or a shader to a MatteIDx, you need to add a special attribute to that object:
    Set the prmanStatements.attributes.user.MatteIDx attribute on each location to assign a color for that object in the MatteIDx AOV.
    Each MatteIDx aov can have 3 sets of objects, one for each RGB channel. In this example, there are 4 objects, so the first three are on the MatteID0 aov, and the last plane is on the MatteID1 aov.

  2. If you find it easier to assign MatteID user attributes via the material location rather than on the objects, you can make use of the material.underlayAttrs attribute.
    Set the material.underlayAttrs.prmanStatements.attributes.user.MatteIDx attribute on each location to assign a color for that object in the MatteIDx AOV.

Part 3: Connect PxrMatteID to your material

If you were to render at this point, even if you added the correct render pass, it would not work. You need to connect a PxrMatteID pattern to the material. You do this by connecting the resultAOV output of PxrMatteID to the Utility Pattern connection of the PxrSurface material. You can connect the same PxrMatteID pattern to the PxrSurface on each object:

 

Part

...

4: Create the MatteID AOVs

Now add the appropriate MatteID AOVs. The name in the PrmanOutputChannelDefine node should match the user attribute name (MatteID0, MatteID1, etc):

...

And the resulting MatteID1 pass looks like this:

Part

...

5: Separate materials with MatteID Textures

If each of the objects in our scene had a different material, or if we just wanted to isolate each object in the scene, we could stop at Part 3.  But since the sphere has two materials, and we are trying to isolate different materials, we need to use the Matte Texture parameter of PxrMatteID. The Matte Texture parameters let you assign colors or patterns as the output for each matte. The goal is to get a matte AOV where the purple parts of the sphere are green, and the gold parts are blue to match the cube's matte.

...