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

Materials under an instancer's Prototypes are dropped in the Scene Index pipeline #3483

Open
robp-sidefx opened this issue Jan 9, 2025 · 1 comment

Comments

@robp-sidefx
Copy link

The UsdImagingPiPrototypePropagatingSceneIndex seems to type-erase all the Hydra prims under an instancer except for the meshes that are actually instanced. This includes materials (i.e., the renderer never gets access to them), which wasn't the case previously.

The following USD renders a blue sphere in "Hydra 1" and a grey sphere in "Hydra 2"

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

def PointInstancer "instancer"
{
    point3f[] positions = [(0, 0, 0)]
    int[] protoIndices = [0]
    rel prototypes = [</instancer/Prototypes/sphere_USED>]

    def Scope "Prototypes"
    {
        def Xform "sphere_USED" (
            prepend apiSchemas = ["MaterialBindingAPI"]
        )
        {
            rel material:binding = </instancer/Prototypes/materials/blue>
            def Sphere "sphere"
            {
                double radius = 1
            }
        }

        def Xform "sphere_UNUSED" (
            prepend apiSchemas = ["MaterialBindingAPI"]
        )
        {
            rel material:binding = </instancer/Prototypes/materials/blue>
            def Sphere "sphere"
            {
                double radius = 1
            }
        }

        def Scope "materials"
        {
            def Material "blue" 
            {
                token outputs:mtlx:surface.connect = </instancer/Prototypes/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
                }
            }
        }
    }
}

I definitely don't mean to go so far as to say "the old way was right, the new way is wrong", but I do flag there being a change (which, unfortunately, got noticed by one of our users).

@jesschimein
Copy link
Collaborator

Filed as internal issue #USD-10562

(This is an automated message. See here for more information.)

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

No branches or pull requests

2 participants