Using the attr token in the texture file name attribute of a File node

In this blog post, I’ll quickly step through an example of how to use the <attr> token in the Maya File node.

Add a "mtoa_constant_" attribute to the shape node.

Put the name of the texture file in the extra attribute:

Use the token in the Image Name. Note that I have a relative path, so I have to make sure that I’ve set a project.

Now I’ve got something that will render in Maya. If I want to export this to an ASS file and render it with kick, I need to add a Texture Search Path (and optionally, a shader search path if I don’t want to use kick -l).

Here’s the texture-related parts of the exported ASS file:

 texture_searchpath "[MY_PROJECT_PATH]"

 name pPlaneShape1
 declare myFileName constant STRING
 myFileName "noicon.png"

 name aiStandard1
 Kd_color file1

 name file1
 filename "/sourceimages/<attr:myFileName>"

Notice how MtoA exported a relative path instead of an absolute. This happens only if you have a token in the filename; otherwise, you always get an absolute path.

And here’s a screenshot to show all this working, both in Maya and in Arnold:

6 thoughts on “Using the attr token in the texture file name attribute of a File node

  1. Apologies for the ignorance, What would be the benefit of utilizing something like this? Thank you for the great articles on Arnold by the way. I’d like to see you cover maybe some of the recent workflow methods with textures via .tx. that part of the workflow seems to be most confusing for me…

    • Yes, this is a bit of an artificial example. I don’t have a real-life example; it was hard enough to dig up this info.

      I don’t think you would use ATTR to specify the whole name. More likely, you would use attributes on Maya shape nodes to specify just some part of the actual texture name. I imagine if you had some scene that you built up procedurally there might be a reason to use ATTR like this.


      • yeah i love your xsisupport blog🙂
        What is dcc? probably not digital compact cassette.
        It just suprised me that most things you show with arnold are in maya.

      • Oops, sorry about that acronym. We used it a lot at Autodesk. DCC = Digital Content Creation.

        I have more to learn about Maya, so that makes it easier, in a way, to come up with blog content.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s