Summary
This is a placeholder parent issue for sub-issues related to improving the interop between MaterialX to USD.
Specifically for the workflow for referencing or loading in MaterialX to create UsdShade shader graphs.
These are observations based on this prototype: https://github.com/kwokcb/materialxusd
Some pre-processing prototype logic is provided here in an attempt to work around issues.
Note: Sub-issues need to be split out.
Sub-Issues
Summary
This is a placeholder parent issue for sub-issues related to improving the interop between MaterialX to USD.
Specifically for the workflow for referencing or loading in MaterialX to create UsdShade shader graphs.
These are observations based on this prototype: https://github.com/kwokcb/materialxusd
Some pre-processing prototype logic is provided here in an attempt to work around issues.
Note: Sub-issues need to be split out.
Sub-Issues
usdMtlxcreatesNodeGraphsfor top level NodesUsdShadecan support such configurations so appears to be an artificial constraint.usdMtlxcan fail if top level nodes found (not in NodeGraphs).NodeGraphsand the import will fail. Seems PBR, BXDF nodes are not. e.g. in this Slack threadusdMtlxwill create nothing if there is a connection failureusdMtlximports nothing if there is no Materials in the MaterialX document.usdMtlxhas no API to get warnings / errors back.Syntax for referencing MaterialX appears to not be documented.
</MaterialX>otherwise "defaultPrim" is looked for which does not exist sinceusdMtlxdoes not create this. The error messaging is not very clear on this as well.usdMtlxforms can form incorrect connections betweenNodeGraphsand downstream nodes.NodeGraphinputs with the same name as internal nodes. It appears to try to connect with the interior node and fails.usdMtlx/UsdShadedoes not allow for BXDF / PBR nodes which have valid typesurfaceshader,volumeshader,displacementshaderoutputs to be connected to downstream materials if they are not: glTF, USDPreview, std surface or OpenPBR.usdMtlxwill fail to import if MaterialX inputs doe not specify an explicit output port qualifier.UsdShaderequires output port specifiers for a valid connection. MaterialX does not always require thisso there appears to be an inconsistent interpretation.
usdMtlxdefaults to "out" as default upstream node / nodegraph output for connectionsHDStorm seems to not considered
defaultgeompropon node definitions and hence requires explicit upstream stream node nodes to be connected. Unsure if this is a general issue for all render delegates but was found here.usdMtlxsupported" graph configurations is not well documented.usdMtlxdoes not create a valid stage onStage.Load(). Could not find any documentation on this but would be useful to have it noted somewhere. This could affect support for real world units when this is supoprted asmetresPerUnitis never defined causing a validation failure. Unsure ifdefaultPrimshould be specified -- assume not.usdMtlxgives no indication as to what meta-data is not transferred. e.g. real world units which can greatly affect the computation is not transferred but no indication is provided.