question

fabrice laroche avatar image
fabrice laroche asked

Python AOV's shaders

Hi,

Is there a way to extract shader name from the AOV node with Python? I'd like to get 'cryptomatte' when I know AOV's node name ('crypto_asset' for example). I tried a listAttr on that AOV's node name but couldn't find any one related to the shader name.

Thank you!


mtoapython
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Stephen Blair avatar image
Stephen Blair answered

MtoA automatically adds the cryptomatte aov shader when it sees the cryptomatte node (because the cryptomatte node has the aov_shader TRUE metadata in plug-ins\mtoa.mtd)

The shader name is automatically generated.

10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

fabrice laroche avatar image
fabrice laroche answered

Thank you Stephen. But what I'm trying to do is to find the name of the shader connected to an AOV (and, BTW, not especially cryptomattes). So, I have a node's name ('crypto_asset') and I'd like to find the shader called 'cryptomatte' that is connected to it...

2 comments
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.


For other AOVs, MtoA inserts an aov write node.

So for example, if you create an AOV named "ao" and assign an aiAmbientOcclusion shader to it, then when MtoA translates the scene, MtoA inserts an aov_write_rgba node.

The node is named defaultArnoldRenderOptions/aov_write_rgba_ao

So if you know the type and name of the AOV, you could build the shader name.



0 Likes 0 ·
fabrice laroche avatar image fabrice laroche Stephen Blair ♦♦ ·
Sorry, I made a simple scene with a sphere, an area light and an AO AOV node, but I can't find that aov_write_rgba_ao node... Can we find this in the Outliner? Is it only created during render time and then deleted?
0 Likes 0 ·
Stephen Blair avatar image
Stephen Blair answered

That node never exists in Maya. It exists only in the data that MtoA sends to Arnold.

10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

fabrice laroche avatar image
fabrice laroche answered

Ok. Sorry Stephen but I'm a bit lost then, there's no real documentation about Python commands for managing MtoA... How can we concretely ask aov_write_rgba node to give us its shader's name thanks to Python?

2 comments
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

You cannot get the name from the Maya scene, or from MtoA. MtoA creates the node and names it when MtoA translates the Maya scene to an Arnold scene. And there's no hooks/callbacks for the translation process that would give you the new node names.
0 Likes 0 ·
fabrice laroche avatar image fabrice laroche Stephen Blair ♦♦ ·
Well... Ok thank you, I'll do it the dirty way then... List source connections to aov's defaultValue attribute, this should give me the shader node's name.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.