Interoperability of shader graphs between Maya and Stingray

Parent and child materials

When creating your shading network, you can save the graph as a preset and re-use it next time you create a new Stingray PBS node. This allows you to avoid repeatedly creating identical shader graphs, which makes it harder to manage your materials and could lower the performance of your game.

A material that contains a preset shader graph is called a parent material.

You can create child materials based on a parent material. A child material inherits the shader graph, and thus the material attributes, from the parent material.

Export a StingrayPBS from Maya to Stingray and reuse an existing parent material

When you export a material from Maya to Stingray, Stingray will not create a new parent material if your StingrayPBS node points to an existing Stingray resource (that is, a .material in your Stingray project folder).

To point to this Stingray resource, set the Parent Material field in the StingrayPBS Attribute Editor in Maya.

You can only edit this field if you first do the following:

  1. Select the Custom preset from the Preset Material drop-down list, or click Make Unique (which then creates a custom preset) in the StingrayPBS Attribute Editor.
  2. Click Open ShaderFX and select the Standard Base node.

This prevents you from inadvertently changing your Parent Material path.

If this field is empty, the shader graph is considered a parent material. After you export this shader to Stingray, a new parent material is created.

If you, on the other hand, provide a path and resource name, for example: /content/materials/my_stingray_material; then upon export, the shader graph points to the parent graph at /content/materials/my_stingray_material. When it is imported in Stingray, Stingray will not re-create a parent graph. However, you must ensure that the graph in your ShaderFX editor in Maya be the same as the parent graph in the Stingray game engine; that is, the one set in your path.

If you enter a path or a name in this field, but the parent material does not exist in your Stingray project folder, then a new parent material is created based on the graph you built.

Import a material from Stingray to Maya and use it as a preset

You can also create the parent graph in Stingray, then import it in the ShaderFX editor. To do this, select File > Import Graph, then select .material from the file type drop-down list.

To save this graph as a preset in Maya, select File > Export Graph, and save it as a .sfx at renderData\shaders (to make it available for the current project) or \Documents\maya\ShaderFX\Scenes\StingrayPBS (to make it available globally). It is now available as a preset under the Preset Material drop-down in the StingrayPBS Attribute Editor.