OpenUSD icon indicating copy to clipboard operation
OpenUSD copied to clipboard

Autodesk: Fix MaterialX shader generation for simple surface shaders like "ND_convert_color3_surfaceshader"

Open erikaharrison-adsk opened this issue 1 year ago • 4 comments

Description of Change(s)

"ND_convert_color3_surfaceshader" MaterialX node fails shader generation in HdStorm

The usda file with a material fixed by this code change:

#usda 1.0

def Capsule "Capsule1" (
    prepend apiSchemas = ["MaterialBindingAPI"]
)
{
    rel material:binding = </mtl/standard_surface1>
}

def Scope "mtl"
{
    def Material "standard_surface1" (
        prepend apiSchemas = ["NodeGraphNodeAPI"]
        customData = {
            dictionary Autodesk = {
                string ldx_inputPos = "177 300.5"
                string ldx_outputPos = "955 301"
            }
        }
    )
    {
        token outputs:mtlx:surface (
            sdrMetadata = {
                string uiorder = "3"
            }
        )
        token outputs:mtlx:surface.connect = </mtl/standard_surface1/convert1.outputs:out>
        uniform float2 ui:nodegraph:node:pos = (0.055555556, 0.055555556)

        def Shader "convert1" (
            prepend apiSchemas = ["NodeGraphNodeAPI"]
        )
        {
            uniform token info:id = "ND_convert_color3_surfaceshader"
            color3f inputs:in = (1, 0, 0)
            token outputs:out
            uniform float2 ui:nodegraph:node:pos = (2.586111, 1.0666667)
        }
    }
}

Fixes Issue(s)

  • N/A
  • [X] I have verified that all unit tests pass with the proposed changes
  • [X] I have submitted a signed Contributor License Agreement

erikaharrison-adsk avatar Apr 17 '24 19:04 erikaharrison-adsk

This would be great to land in USD. I put up a similar fix here https://github.com/PixarAnimationStudios/OpenUSD/pull/3016 but yours is more thorough.

dgovil avatar Apr 17 '24 21:04 dgovil

Filed as internal issue #USD-9559

jesschimein avatar Apr 18 '24 00:04 jesschimein

/AzurePipelines run

jesschimein avatar Apr 18 '24 00:04 jesschimein

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Apr 18 '24 00:04 azure-pipelines[bot]