arnold-usd icon indicating copy to clipboard operation
arnold-usd copied to clipboard

Multiple output support for shaders (Procedural)

Open compso opened this issue 3 years ago • 4 comments

We'd like to support connections between shaders using multiple outputs, currently we just have a default output and its component connections.

Here's an example of a usd file generated with multiple outputs for colors Q,R and component float outputs Q:r, Q:g, Q:b, R:r, R:g, R:b.

usda.zip

The usda file is generated representing components with the : separator since the . separator isn't supported in usd:

"/Applications/Houdini/Houdini18.5.499/Frameworks/Houdini.framework/Versions/Current/Resources/houdini/python2.7libs/husdshadertranslators/default.py", line 1350, in createUsdShaderOutput return usd_shader.CreateOutput( usd_shader_output_name, usd_type ) ErrorException: Error in 'pxrInternal_v0_20_pxrReserved_::SdfAttributeSpec::New' at line 73 in file src/usd/usd-20.08/USD-py2.7/pxr/usd/sdf/attributeSpec.cpp : 'Cannot create attribute spec on </materials/materiallibrary1/probablity1> with invalid name 'outputs:Q.g''

so we'll probably have to usd a : separator and map between Q:g and Q.g to support the component linking in Arnold in our usd writer.

compso avatar Nov 05 '21 10:11 compso

see #714 for usda file

compso avatar Nov 05 '21 10:11 compso

With regards to the separator character, there probably isn't need to change it from ':' to '.' for arnold to understand component and output specifications.

With the multiple outputs update the link parsers were changed and now any combination of non-alphanumeric characters should do when declaring shader parameter links through the arnold API, so I'd first try it without any mappings. Please let me know if this gives you any trouble.

kkingaa avatar Nov 05 '21 12:11 kkingaa

In any case we need to change our usd writer (the module that authors usd files from arnold data). Here the problem is that we create usd files with outputs like Q.r , and usd doesn't like that when we read it back. So we'd need to change it to some format that usd accepts. Then, based on what Alan commented, if we manage to find a character that arnold accepts, then we wouldn't need to do the mapping in both the procedural and render delegate when we read the usd files

sebastienblor avatar Nov 08 '21 10:11 sebastienblor

Issue synced internally to ARNOLD-13292