This sample package shows the basic components required to connect MaterialX running in Python to a Web client running Javascript in order to run conversion or rendering applications.
Server-side rendering using MaterialXView | Server-side conversion from MaterialX to USD and glTF (top and bottom respectively) |
The following packages are installed by default as part of the pip
installation.
-
flask
andflask-socketio
: Python packages for Flask support -
socket-io
: For Javascript WebSocket support -
usd-core
: for OpenUSD conversion. Different versions can be downloaded explicitly from PyPi. The assumed minimum version is 24.11. -
MaterialX
: Different versions can be downloaded explicitly from PyPi. The assumed minimum version is 1.38.10. -
gltf_materialx_converter
:MaterialX glTF Convertor
Python library. Note that this is not available onPyPi
currently so the Github repository must be cloned and the packagelocally installed.
Rendering depends on the environment variable: MATERIALX_DEFAULT_VIEWER
being set to the location of the MaterialXView binary. This is part of the MaterialX release distribution as found here
Either install the package from PyPi
:
pip install materialx_conversion_app
or clone the materialXWeb repository and install from the root folder:
pip install .
or
pip install -e .
if planning to perform edits on the repository.
Run the main package using:
materialx_conversion_app
or directly with Python:
python MaterialXConversionApp.py
By default the application is running a local server. To access the client page open the following in a Web browser:
http://127.0.0.1:8000