Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Contents

Setting User Attributes

User attributes are a convenient way to vary shading across multiple objects without changing a shading network.  They are especially useful as they can vary across instances, unlike primvars.  Here is an example of how to set a color user attribute with an OpScript:

gb = GroupBuilder()
gb:set("value", FloatAttribute({0.01.00.0}, 3))
gb:set("type", StringAttribute("color"))
Interface.SetAttr("prmanStatements.attributes.user.myColor", gb:build())


Color attributes are the only type that require a group attribute.  Int, float, and string user attributes can be set directly, with their type inferred from the Katana attribute type:

Interface.SetAttr("prmanStatements.attributes.user.myFloat", FloatAttribute(3))

Using User Attributes

RenderMan ships with several plugins that make use of user attributes.  PxrAttribute, PxrVary(?), PxrVariable(?), PxrCryptomatte (string attribtues used by the sample filter).  When using these plugins, use the prefix user: followed by the attribute name.