Maya MaterialX Compound Nodes as X3D Shader Fields
Using Compound Nodes in Maya LookdevX
I've been hard at work this weekend, trying to come up with a workflow that will integrate with MaterialX shader exports into RawKee exports.
After feedback from the community, it became clear that there isn't really anything I can do on the exporter side to export Shader content that will be compatible with existing X3D Browser shader implementations.
So instead, in addition to focusing on PhysicalMaterial export with X_ITE material extensions, I have decided to export MaterialX shader content for a theoretical future browser that does.
The question is, how to export shader fields for X3D shader? While I can't do anything for the built-in fields, I decided that I would leverage the MaterialX Compound convenience node to expose artist fields to the browser.
A good explanation of what a Compound node is can be found on YouTube as part of this Autodesk tutorial.
But essentially, it allows the artist to create a custom shader with limited exposed fields. I've included a screenshot in the banner image for this blog post.
It's a bit difficult to read, but essentially I packaged a PBR shader with a limited set of exposed fields with custom names. These fields are already found in the exported MaterialX document that is referenced in the PackagedShader URL field. However, they need to be injected as definitions '#define' variables into the GLSL of the ComposedShader version of the export.
In the DamagedHelmetFields Compound node seen in the screenshot, I've created 10 X3D fields:
- baseTexture_file
- emissiveTexture_file
- metalRoughnessTexture_file
- normalTexture_file
- occlusionTexture_file
- normalMap_scale
- gltf_pbr1_alpha
- gltf_pbr1_alpha_mode
- gltf_pbr1_alpah_cutoff
- gltf_pbr1_transmission
This setup allows me to test the code I've been writing to search the LookupDevX shader graph.
I don't know, doesn't seem exciting, especially when there is nothing yet that can't properly display the shaders.
In some ways, it's really just a mechanism for the artist to use the LookupDevX to design an X3D shader, and then export. It's also a handy mechanism for me to organize the shader export.
I still have quite a bit of work ahead of me to get all of this to work properly. This code now uses:
- Maya Python 2.0 API
- Maya Python 1.0 API
- MEL Scripts
- UFE Python API
- MaterialX Python API
Here's another image of what the internal shading graph of the compound looks like:


