Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sdr node discovery results should be consistent across renderers #1214

Closed
JGamache-autodesk opened this issue Jul 13, 2022 · 0 comments · Fixed by #1342
Closed

Sdr node discovery results should be consistent across renderers #1214

JGamache-autodesk opened this issue Jul 13, 2022 · 0 comments · Fixed by #1342
Assignees
Labels
bug Something isn't working

Comments

@JGamache-autodesk
Copy link

JGamache-autodesk commented Jul 13, 2022

Describe the bug

We are looking for consistency in the way shader nodes are registered. This will allow a node editor to build a nicer node picker by grouping nodes according to hints provided in the registration. Having a consistent registration scheme will allow all renderer nodes to be sorted without needing custom per-renderer coding in the DCC.

To Reproduce

  1. In a USD python session, with the arnold-usd binaries added to PXR_PLUGINPATH_NAME, run the following script:
for id1,id2,id3 in (("arnold:standard_surface", "ND_standard_surface_surfaceshader", "UsdPreviewSurface"),
                    ("arnold:rgb_to_float",  "ND_mix_color3", "UsdPrimvarReader_float2")):
    n1 = Sdr.Registry().GetShaderNodeByIdentifier(id1)
    n2 = Sdr.Registry().GetShaderNodeByIdentifier(id2)
    n3 = Sdr.Registry().GetShaderNodeByIdentifier(id3)
    print("Identifier", n1.GetIdentifier(), n2.GetIdentifier(), n3.GetIdentifier())
    print("Name", n1.GetName(), n2.GetName(), n3.GetName())
    print("Family", n1.GetFamily(), n2.GetFamily(), n3.GetFamily())
    print("Role", n1.GetRole(), n2.GetRole(), n3.GetRole())
    print("Context", n1.GetContext(), n2.GetContext(), n3.GetContext())
    print("SourceType", n1.GetSourceType(), n2.GetSourceType(), n3.GetSourceType())
    print()

You will get the following output:

Identifier arnold:standard_surface ND_standard_surface_surfaceshader UsdPreviewSurface
Name       standard_surface        ND_standard_surface_surfaceshader UsdPreviewSurface
Family     shader                  standard_surface                  UsdPreviewSurface
Role       standard_surface        pbr                               UsdPreviewSurface
Context    arnold                  surface                           usda
SourceType arnold                  mtlx                              glslfx

Identifier arnold:rgb_to_float ND_mix_color3 UsdPrimvarReader_float2
Name       rgb_to_float        ND_mix_color3 UsdPrimvarReader_float2
Family     shader              mix           UsdPrimvarReader
Role       rgb_to_float        compositing   primvar
Context    arnold              pattern       usda
SourceType arnold              mtlx          glslfx

Expected behavior

We would expect the family to be the same as the name. The specifications are vague, but the USD and NdrFsHelpersSplitShaderIdentifier() implementations allow us to deduce that shaders that differ only by output type should be in the same family.

Role is less strictly defined, it groups nodes by "nodegroup" in MaterialX and seems to also get a generic category for USD native shaders. Maybe it could be something similar to the classification used to build the shader nodes documentation page in Arnoldopedia.

We might want to leave Context untouched. For MaterialX everything is a pattern, except surface/displacement/volume shaders where the context reflects the expected terminal node to connect on the material.

Screenshots

Used Software Versions

  • Arnold: 7.1.3.0
  • USD: 22.5

Additional context

@JGamache-autodesk JGamache-autodesk added the bug Something isn't working label Jul 13, 2022
@JGamache-autodesk JGamache-autodesk changed the title Sdr parser registration should be consistent across renderers Sdr node discovery results should be consistent across renderers Jul 13, 2022
JGamache-autodesk added a commit to Autodesk/maya-usd that referenced this issue Jul 13, 2022
@compso compso moved this to Todo in Arnold USD Sep 23, 2022
@compso compso moved this from Todo to In Progress in Arnold USD Oct 14, 2022
Repository owner moved this from In Progress to Done in Arnold USD Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants