User guide
22 PRMan Technical Notes
Use of the "id" Identifier Attribute
The id pass that Katana uses in the Monitor for picking objects makes use of an identifier attribute called "id". This
makes use of a special feature in PRMan where if an identifier attribute is called "id", it is automatically available as an
AOV without the need for any explicit code in shaders to write the value into an AOV.
This can cause potential issues if you want to make use of the "id" identifier attribute for other custom purposes,
such as to write out your own id pass during renders. The "id" attribute is only used by Katana in Preview Render
mode so the "id" identifier attribute can be safely set for Disk Renders. To avoid conflict with Katana's internal use
of the "id" attribute, an Interactive Render Filter can be used to remove the "id" attribute in Preview Render mode.
Custom id passes can also be created with other names by means of explicit writeaov calls added to shader's code.
The following code snippets show two versions of a very simple surface shader that use the writeaov function to tag
objects with a "material_id" identifier. materialId_v1 relies on a shader parameter to assign an id to a location, while
materialId_v2 uses the attribute function to read a user:myId attribute (the user attribute can be assigned to a
location using an AttributeSet node or an AttributeScript node).
surface materialId_v1(uniform float _id = 0;)
{
writeaov("material_id", _id);
Ci = Os * Cs * normalize(N).-normalize(I);
Oi = Os;
}
surface materialId_v2()
{
uniform float myId = 1;
attribute("user:myId", myId);
writeaov("material_id", myId);