MaterialX Python Utilities

The Python package mtlxutils contains a collection of the utilities

This package is used in Python command line utilities which can be of general use. A number of these are used in the Github actions workflow used to build this site as outlined in the Implementation page.

  • genMaterialsFromDefs.py : For creation of nodegraphs based on definitions (nodedefs). "Sampling" of node outputs is accomplished by using new "convert" nodes introduced in 1.38.7 and forward.
  • renderDocuments.py : For rendering of renderable nodes in documents. This is used to render the graphs created by genMaterialsFromDefs. The renderer is the same as used for render unit testing for GLSL code generated shaders. The content can be found in the resources folder
  • generateMermaidGraph.py : For creation Mermaid graphs from MaterialX node graphs. A variant of this (which includes additional node coloring) is used to generate the node reference documentation.
  • createDefinitions.py : For creation of definitions from node graphs.
  • usd2Mtlx.py : For converting to and from Usd / MaterialX node graphs.

Note: Additional package enhancements and command like utilities will be exposed over time once they are factored out into reusable modules. This includes the Python script used to generate all the node reference documentation.

The minimum MaterialX package version is 1.38.8.

The package and utilities are used (and explained) within the various Python tutorials

Core Utilities

  • mxbase : Utility for minimum version checking.
  • mxfile : File utilities including: creating "working" documents, loading in default libraries, library write filter predicate, and write to file / string wrappers. Used by various notebooks. Logic described in the Basics notebook
  • mxodegraph : Node and nodegraph creation as explained in the Nodegraph notebook
  • mxtraversal : Nodegraph connectivity and sample usage to create Mermaid graphs as explained in the Traversal noetbook
  • mxshadergen : Utilities for shader generation as explained in the Shader Generation Notebook
  • mxrenderer : Utilities for rendering with a default GLSL renderer as covered in the Rendering Notebook

Supplemental Utilities

  • mxusd : MaterialX / Usd graphing mapping utilities as explained in the MaterialX / Usd notebook. Note that
    the Usd / MaterialX conversion logic is not included here as UsdMtlx from the the official Usd release should be used.