Revisiting this implementation, I’m not totally sure if this was the proper way to go. Every material that is added to the scene gets their own additional node to store our material properties, which may cause confusion as to which material has which settings applied to it. In addition, its somewhat strange to have our settings node take the material node as in input as well.
Alternatively I can see us being able to move these export settings to the Material properties, but they are only editable via the Attribute editor, but to me this feels like a simpler solution:
Does anyone have any thoughts on migrating the babylon export settings to the material attributes? I’d like to get some input on this change before I move forward with it in the coming weeks.
I have been using this implementation and haven’t been too keen on some of the trade-offs we needed to make. Ideally, we would have been able to hook into the Hypershade Graph with a custom node to keep parity with the Maya workflow, but without some internal help from Autodesk with the implementation we had to settle on a few work arounds that made the system feel fragile.
The most notable trade off is one that @Drigax alluded to where we needed to store our settings in an additional material node that was linked to the original material. This meant that using the “Delete Unused Nodes” command would remove all of the Babylon settings nodes as they weren’t assigned to a mesh in the scene and the internal reference wasn’t enough to tell Maya that the Babylon material node was in use.
This is the kind of thing that we need internal Autodesk assistance with as I still think a custom node in the Hypergraph is the best way to go because it gives the artist complete control over what materials get extra parameters for export to glTF/Babylon and what materials don’t need those extra inputs.
I would also be interested to hear perspectives about the glTF/Babylon export options being under the Extra Attributes section as in the screen shot above.
Our current implementation created new “extension nodes” for the Arnold, Standard and Stingray PBR nodes. These are not new materials, just shader utility nodes hijacked to be used as attribute containers. The objects in your Maya scene only need the Arnold material applied, but the in the hypergraph, the node just needs to be linked to the Arnold material as an output.
If we were to move to the extra attribute implementation, I’d most likely add some callbacks on material creation and scene load to auto-add our custom properties instead, and propagate any existing extension nodes to attributes instead.