The Maya scene is available here.
- Create a sphere and add an extra attribute to the shape node (not the transform node). Use the down key (
pickWalkDown) to select the shape node.
- Add the Long name - 'mtoa_constant_Texture' ('Texture' is the prefix that we will use for the Ai User Data String node, but you can call it what you want (do not use 'name', it will not work). Set the 'Data Type' to 'String'.
String Maya attribute
- Select the shape node for the sphere. Under 'Extra Attributes' you should find the newly created Attribute - 'mtoa_constant_Texture'. In the text field next to this, type the full path name of the texture (must be the absolute pathname).
- Assign a Standard Surface shader to the sphere. Connect a file texture to the Base Colorattribute. Create an Ai User Data String node.
- Open the connection editor for both of them. Connect the outValue attribute of the Ai User Data String node to the fileTextureName attribute of the 'file texture' node:
The shader network should look like this:
Ai User Data String connected to file texture node
- Select the Ai User Data String node and type in the prefix that was added to the attribute for the sphere (in this case 'Texture').
- Render the scene. The sphere should render using the texture path that was added to the sphere's attribute.
- Duplicate the sphere. Under 'Extra Attributes' for the second sphere, type the full path name (absolute) of a second texture map.
- Render the scene. Both spheres are now using the same Standard Surface shader but have separate textures assigned to them.