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

"full" material binding not working with USDIMAGINGGL_ENGINE_ENABLE_SCENE_INDEX=1 #3320

Open
robpieke opened this issue Sep 27, 2024 · 2 comments · May be fixed by #3352
Open

"full" material binding not working with USDIMAGINGGL_ENGINE_ENABLE_SCENE_INDEX=1 #3320

robpieke opened this issue Sep 27, 2024 · 2 comments · May be fixed by #3352

Comments

@robpieke
Copy link
Contributor

Previously, the following USD would render blue in Storm and red in RenderMan (as-expected). With USDIMAGINGGL_ENGINE_ENABLE_SCENE_INDEX=1 it renders blue in both cases.

I see there's a HdMaterialBindingsSchema::GetMaterialBinding(TfToken const &purpose) function, but it doesn't look like anything actually calls this. HdSceneIndexAdapterSceneDelegate::GetMaterialId() goes through the default (i.e., no explicit purpose).

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

def Xform "sphere" (
    prepend apiSchemas = ["MaterialBindingAPI"]
)
{
    rel material:binding:full = </materials/red>
    rel material:binding = </materials/blue>

    def Sphere "sphere"
    {
        double radius = 1
    }
}

def Scope "materials"
{
    def Material "red" 
    {
        token outputs:mtlx:surface.connect = </materials/red/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 Material "blue" 
    {
        token outputs:mtlx:surface.connect = </materials/blue/mtlxstandard_surface.outputs:out>
        def Shader "mtlxstandard_surface"
        {
            uniform token info:id = "ND_standard_surface_surfaceshader"
            color3f inputs:base_color = (0, 0, 1) 
            token outputs:out
        }
    }
}

full

@jesschimein
Copy link

Filed as internal issue #USD-10198

@robpieke
Copy link
Contributor Author

robpieke commented Oct 3, 2024

It's easy enough to change HdSceneIndexAdapterSceneDelegate to leverage GetRenderIndex().GetRenderDelegate()->GetMaterialBindingPurpose() and call HdMaterialBindingsSchema::GetMaterialBinding(TfToken const &purpose), which makes the reported test case pass, but I worry this is insufficient as there seem to be other calls to HdMaterialBindingsSchema::GetMaterialBinding() (i.e., the purpose-less version) scattered throughout the codebase. And by "insufficient", that might actually be "best-case" and it is possibly even worse if there is inconsistency where different codepaths are generating different material bindings.

@robpieke robpieke linked a pull request Oct 8, 2024 that will close this issue
2 tasks
robp-sidefx added a commit to sideeffects/USD that referenced this issue Oct 16, 2024
…red) material binding.

Note there still remain calls to the generic GetMaterialBinding() in:
* collectionPredicateLibrary - hd
* materialPrimvarTransferSceneIndex - hdSi
* dependencySceneIndexPlugin - hdSt
* retesselationSceneIndexPlugin - hdPrman

This is to address issue PixarAnimationStudios#3320 (with the above unsolved bits mentioned above)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants