This intermediate tutorial shows you how to access SOP attributes in stage, and how to control built-in Arnold parameters. We'll be using Houdini 18.5.499 and HtoA 126.96.36.199.
A scene file can be downloaded here.
Accessing Attributes in shading networks
First, let's take a quick look at accessing attributes created in a shader network. In our example scene, we add two vector attributes to our polymesh, Cd and customColor.
When importing SOPs to Solaris, Cd is a special attribute, it'll be converted to the displayColor built-in USD attribute, while customColor will be converted to a primvar. Both attributes can be accessed via user_data_rgb. Other types of attributes can be accessed via user_data_rgba, user_data_int, user_data_float, and user_data_string.
See stage/materiallibrary1/arnold_materialbuilder1/user_data_rgb1 on how to access Cd.
See stage/materiallibrary2/arnold_materialbuilder1/user_data_rgb1 on how to access customColor.
Controlling Arnold built-in attributes via SOP attributes
A useful feature when importing SOPs to stage is able to control Arnold parameters. This allows flexible ways to change the behavior of Arnold primitives, like controlling subdivision, matte, etc. Both the Arnold Render Delegate and the Procedural converts USD primvars prefixed with arnold: to Arnold node attributes if the name matches a built-in parameter. For example, the USD attribute int primvars:arnold:subdiv_iterations = 3 will change the Arnold node's subdivision iterations to 3. Due to the special character in the USD attribute's name, we need to use the encode function to encode the parameter name. For example set the attribute's name to
See stage/sopcreate1/sopnet/create/attributecreate1 to set subdiv_type on the prim:
See stage/sopcreate1/sopnet/create/attribcreate2 to set subdiv_iterations on the prim:
When viewing the object in stage, it'll be subdivided using a 4 iteration catmull-clark subdivision:
- Access the Cd attribute by reading displayColor using a user_data_rgb shader.
- Access object attributes in a shader network by creating the appropriate User Data Shader.
- You can control built-in Arnold node parameters by prefixing the attribute name with arnold: and using the encode function.