PixarAnimationStudios / OpenUSD

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

Assignment of materials which are instanceable references doesn't seem to work with USDIMAGINGGL_ENGINE_ENABLE_SCENE_INDEX=1 #3307

Open robpieke opened 1 week ago

robpieke commented 1 week ago

Using USD 24.08 and both the RenderMan delegate and our Karma delegate, we're observing that material assignment fails when the material being assigned is an instanceable reference.

instmat

#usda 1.0
(
    endTimeCode = 1
    framesPerSecond = 24
    metersPerUnit = 1
    startTimeCode = 1
    timeCodesPerSecond = 24
    upAxis = "Y"
)

def Xform "sphere1" (
    prepend apiSchemas = ["MaterialBindingAPI"]
)
{
    rel material:binding = </materials/mtlxmaterial>

    def Sphere "sphere"
    {
        double radius = 1
        matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (-1, 0, 0, 1) )
        uniform token[] xformOpOrder = ["xformOp:transform"]
    }
}

def Xform "sphere2" (
    prepend apiSchemas = ["MaterialBindingAPI"]
)
{
    rel material:binding = </materials/i_mtlxmaterial>

    def Sphere "sphere"
    {
        double radius = 1
        matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (1, 0, 0, 1) )
        uniform token[] xformOpOrder = ["xformOp:transform"]
    }
}

def Scope "materials"
{
    def Material "mtlxmaterial" (
        prepend inherits = </__class_mtl__/mtlxmaterial>
    )
    {
        token outputs:mtlx:displacement.connect = </materials/mtlxmaterial/mtlxdisplacement.outputs:out>
        token outputs:mtlx:surface.connect = </materials/mtlxmaterial/mtlxstandard_surface.outputs:out>

        def Shader "mtlxstandard_surface"
        {
            uniform token info:id = "ND_standard_surface_surfaceshader"
            color3f inputs:base_color = (1, 0, 0) 
            token outputs:out
        }

        def Shader "mtlxdisplacement"
        {
            uniform token info:id = "ND_displacement_float"
            token outputs:out
        }
    }

    def "i_mtlxmaterial" (
        instanceable = true
        prepend references = </materials/mtlxmaterial>
    )
    {
    }
}
jesschimein commented 1 week ago

Filed as internal issue #USD-10163