...
The current MaterialX import in Hydra is handled by USD Scene Delegate using the UsdMtlx pluginlibrary. MaterialX document can be imported into Usd /Hydra by:
- Attaching a MaterialX file e.g. usd_mtlx_example.usda.txt
...
(see MaterialX in Hydra slides https://www.materialx.org/assets/ASWF_OSD2021_MaterialX_slides_final.pdf)
There is no support for exporting Shader networks to MaterialX.
1. MaterialX as UsdShade
(transport, composition, file format plugin, interop, shader definition)
...
- Shader Definition: Treat MaterialX nodedef attributes (units, color space, fallbacks value, limits) as Shader data attributes instead of metadata.
- Shader Discovery: Standardize on nodedef/nodegraph name mapping for better discovery of node variants. Improve versioning and nodedef namespace.
- User Shader libraries: Simplify transport of Custom nodedef (for modeling and viewport workflow)
- Interop Integrity: For lossless synchronization, ensure validation mechanism / tests for Mtlx → UsdShade → Mtlx
2. MaterialX in Hydra
(visualization, viewport, runtime, rendering)
For HdStorm, a UsdShade Network is translated into HdMaterial Network. A MaterialX document is reconstructed from UsdShade HdMaterial Network to create glslfx via using MaterialX CodeGen.
The missing features in the UsdMtlx plugin makes HdStorm hard to use and extend for other Viewport work-flows.
2.
...
a HdMaterialNetwork from USD Scene Delegate (UsdShade)
There are (at least) two possible rendering workflows.
- The translation process to UsdShade and back to MaterialX is undesired. UsdShade allow allows for resolving of inputs only. That is optimally rendering can occur from
- the source MaterialX reference or
- shader code can be independently (pre)-generated from MaterialX (or other source) but is associated with USDShade nodes (e.g. code references per node in OSL).
- A translation process is required for UsdShade.
If MaterialX is required then CodeGen (or ShaderGen) functionality is available.
...
Ideally this would be outside of Hydra (which is not the current case)
Therefore an application may be required to maintain MaterialX for rich material authoring workflows and translate to UsdShade networks for rich runtime visualization workflows. Often, an application might need to revert back to MaterialX for rich transport of material assets.
This dual mode operation requires unnecessary Shader Code regen such as during:
- MaterialX topology updates require complete UsdShade regen.
- MaterialX input updates require complete UsdShade regen.
We For USD Scene Delegate we want to continue to use USDShade - HdMaterialNetwork as the native runtime in Hydra but we want MaterialX as the ground truth and not have static snapshots in Usd form as they are duplicates that can get out of sync.
Goal: Goals:
Improve MaterialX - UsdShade updates (both topology and inputs), USDShade with MaterialX source code, Hydra independence
Improve HdMaterialNetwork to MaterialX update.
Improve Translation / ShaderGen independent from Hydra.
This includes improving performance issues due to shader recompilation, handling updates to materials, material topology changes. We may also need to introduce Hydra and/or MaterialX APIs to report material input and network updates.
2.b HdMaterialNetwork from Custom Scene Delegate
A custom Scene delegate that uses MaterialX needs to build a custom plugin to convert MaterialX Network to HdMaterial Network, By refactoring the UsdMtlx code, we will be able to reuse this for Custom Scene Delegates. We will also benefit from improvements suggested earlier.
Miscellaneous items (for further discussion)
...
Expand | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
Reference:
Metadata discussions
- Sdr can not differentiate between vector4 and color4 MaterialX inputs
https://groups.google.com/g/usd-interest/c/G8BSo8jzfyY/m/eCYFEWhrBQAJ
- Associate unit information on value types
https://groups.google.com/g/usd-interest/c/uqCk8_TQ5uI/m/AWQArwGmAwAJ
Hydra discussions
- Transport MaterialX using custom scene delegate
https://groups.google.com/g/usd-interest/c/tlID9vK210g/m/Kft8l3CeAgAJ
- Dirty bits for HdMaterial
https://groups.google.com/g/usd-interest/c/xytT2azlJec/m/22Tnw4yXAAAJ