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

Maya crashes when enabling "Hardware Texturing" after selecting material variant #3416

Open
jufrantz opened this issue Oct 26, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@jufrantz
Copy link
Contributor

jufrantz commented Oct 26, 2023

Describe the bug

When selecting a material variant and subsequently enabling viewport "Hardware Texturing", maya crashes with some of our assets. The problem seems to arise if the variantSet is changed on an instance prim (w/ instanced materials) and if the chosen variant alters the material network topology. I've managed to replicate this issue on a relatively simple setup.

Steps to reproduce

  1. Ensure viewport's Hardware Texturing option is disabled, e.g. using modelEditor command:
maya.cmds.modelEditor("modelPanel4", e=True, displayTextures=False)
maya.cmds.refresh()
  1. Create a mayaUsd proxyShape with this setup
import maya.cmds
import mayaUsd.ufe
import mayaUsd_createStageWithNewLayer
maya.cmds.loadPlugin("mayaUsdPlugin", quiet=True)

proxyShape = mayaUsd_createStageWithNewLayer.createStageWithNewLayer()
shapeStage = mayaUsd.ufe.getStage(proxyShape)

shapeStage.GetRootLayer().ImportFromString('''#sdf 1
def Xform "Asset" (
    prepend variantSets = "materialVariant"
)
{
    def Sphere "Geo" (
        prepend apiSchemas = ["MaterialBindingAPI"]
    )
    {
        rel material:binding = </Asset/Mtl>
        float3[] primvars:myColor = [(0, 1, 0)]
    }

    def Material "Mtl"
    {
        token outputs:surface.connect = </Asset/Mtl/Surf.outputs:surface>

        def Shader "SurfBase"
        {
            uniform token info:id = "UsdPreviewSurface"
        }

        def "Surf" (
            references = </Asset/Mtl/SurfBase>
        )
        {
            token outputs:surface
        }

        def Shader "PrimColor"
        {
            uniform token info:id = "UsdPrimvarReader_float3"
            string inputs:varname = "myColor"
            float3 outputs:result
        }
    }
    variantSet "materialVariant" = {
        "PrimColor" {
            over "Mtl"
            {
                over "Surf"
                {
                    color3f inputs:diffuseColor.connect = </Asset/Mtl/PrimColor.outputs:result>
                }
            }

        }
    }
}

def "Instance" (
    instanceable = true
    references = </Asset>
)
{
}
''')
  1. Select the PrimColor variant on the instance prim. This will bring a connection on terminal node's inputs:diffuseColor
shapeStage.GetPrimAtPath("/Instance").GetVariantSet("materialVariant").SetVariantSelection("PrimColor")
maya.cmds.refresh()
  1. Enable Hardware Texturing in the viewport
maya.cmds.modelEditor("modelPanel4", e=True, displayTextures=True)
maya.cmds.refresh()
  1. It should crash, we get this fatal error:
----------------------------- maya.bin terminated ------------------------------
maya.bin crashed. FATAL ERROR: Failed axiom: ' _primIndex '
in GetSourcePrimIndex at line 104 of build/sources/USD-22.11/pxr/usd/usd/primData.cpp
writing crash report to [ host:/usr/tmp/st_maya.bin.6890 ] ... done.
--------------------------------------------------------------------------------

Specs (if applicable):

  • CentOS 7.8
  • Maya 2023.3
  • maya-usd 0.25
  • USD 22.11
@jufrantz jufrantz added the bug Something isn't working label Oct 26, 2023
@github-project-automation github-project-automation bot moved this to Needs triage in maya-usd Nov 8, 2023
@Autodesk Autodesk deleted a comment from maya-usd-git-sync bot Nov 16, 2023
@neilrubie
Copy link

Just adding that we are frequently getting crashes with this same error, to do with toggling hardware texturing. Would be nice to get this sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Needs triage
Development

No branches or pull requests

3 participants