PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
5.45k stars 1.13k forks source link

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

Closed erikaharrison-adsk closed 2 weeks ago

erikaharrison-adsk commented 4 weeks ago

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)

dgovil commented 4 weeks ago

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.

jesschimein commented 4 weeks ago

Filed as internal issue #USD-9559

jesschimein commented 4 weeks ago

/AzurePipelines run

azure-pipelines[bot] commented 4 weeks ago
Azure Pipelines successfully started running 1 pipeline(s).