# Write Preview Materials to USD

It is possible to write per-shape material information so that Hydra delegates (such as Storm and NSI) can render materials in the viewport. This is commonly referred as “Preview Materials”.

This information can be written to USDZ as well, in such case the asset will be “packed” and portable.

Application able to read display color information and use for display are:

  • Multiverse for Maya
  • macOS Quick Look
  • iOS for AR
  • Unity 3D
  • Unreal Engine
  • Houdini Solaris

Multiverse allows you to easily write Preview Materials by using Maya’s StingrayPBS material with a PBR shading network using the metallic/specular principled logic. Make sure you have the shaderFXPlugin plugin loaded (this plugin is included with Maya by default).

Load the ShaderFX plugin which provides the StingrayPBS node

Multiverse is workflow agnostic, depending on your needs lets you either:

  1. Separate rendering material shading networks and preview shading networks
  2. Keep both material shading networks unified.

TIP

One major benefit in using the StingrayPBS is that you will be able to Preview your “Preview Materials” directly in the Maya Viewport before writing the USD file.

Now let’s explore both cases:

# Separate rendering & preview materials

In case your workflow allows for having two shading networks that are completely separate, you can directly assign StingrayPBS materials to your Maya geometries. The supported textures for StingrayPBS textures are:

- Color
- Metallic
- Roughness
- Emission
- Normal
- Occlusion
- Opacity (for transparency effect)
1
2
3
4
5
6
7

WARNING

Textures must be located in the same folder as the USD file that you will write out.

Maya Attribute Editor


Maya Shading Network using the StingrayPBS material

About Opacity

If your asset requires (semi-)transparent objects, in order to correctly you must make sure to set the Preset Material to Standard Transparent in the StingrayPBS property editor and then enable both Use Color Map and Use Opacity Map (because the default preset does not provide opacity support and settings from the material). Then, the opacity map must be used in Alpha channel of the Base Color texture. The material should now be able to pick it up and preview it in the viewport.

The opacity attribute will be ignored, always use the alpha channel on the base color texture instead.

Settings for enabling opacity support in StingrayPBS

You can Preview the look in the Maya Viewport 2.0 before writing out to USD. This can be very helpful in iterating your work so, make sure you have enabled hardware texturing in the viewport:

Preview StingrayPBS assignments Enable texturing

If you are pleased with the look, then its time to write the asset with Preview Materials, we call this “Hardware Shader” also because in the next section you will see we are leveraging the hardwareShader parameter of any Maya material:

You can now Read this UD asset back in Maya or open in on any other application that supports Preview Materials such as Houdini or Unity or Unreal Engine.

Important

Make sure the textures are in the same folder as the asset.

# Unified rendering & preview materials

When your workflow requires a single shading network, you can indirectly assign StingrayPBS to the .hardwareShader parameter that exists on any Maya material, including 3rd party materials, such as Arnold aiStandardSurface.

This method will allow you to use one single shading network where you can both have your final lookdev shading network as well as you can pipe StingrayPBS to the .hardwareShader input connection of Maya materials.

This attribute is usually hidden, and if not present it can be created by e.g. scripting: once created it will be recognized automagically by Maya. We provide two examples with Arnold and 3Delight, but all other renderers will work.

  1. Arnold — Example with aiStandardSurface
from maya import cmds
materialNode = 'aiStandardSurface1'
cmds.addAttr(materialNode, longName='hardwareShader', usedAsColor=True, hidden=False, attributeType='float3')
cmds.addAttr(materialNode, longName='hardwareShaderColorR', attributeType='float', parent='hardwareShader')
cmds.addAttr(materialNode, longName='hardwareShaderColorG', attributeType='float', parent='hardwareShader')
cmds.addAttr(materialNode, longName='hardwareShaderColorB', attributeType='float', parent='hardwareShader')
1
2
3
4
5
6
  1. 3Delight NSI — Example with dlPrincipled
from maya import cmds
materialNode = 'dlPrincipled1'
cmds.addAttr(materialNode, longName='hardwareShader', usedAsColor=True, hidden=False, attributeType='float3')
cmds.addAttr(materialNode, longName='hardwareShaderColorR', attributeType='float', parent='hardwareShader')
cmds.addAttr(materialNode, longName='hardwareShaderColorG', attributeType='float', parent='hardwareShader')
cmds.addAttr(materialNode, longName='hardwareShaderColorB', attributeType='float', parent='hardwareShader')
1
2
3
4
5
6

the hardwareShader has been added to aiStandardSurface


hardwareShader in aiStandard


hardwareShader in dlPrincipled

Again, using this method you can Preview the look in the Maya Viewport 2.0 before writing out to USD. This can be very helpful in iterating your work, so make sure you have enabled hardware texturing in the viewport:

Preview StingrayPBS assignments


Enable texturing

If you are pleased with the look, then its time to write the asset with Preview Materials: make sure to turn on the “Hardware Shader” when writing:

# Preview Materials in DCC Apps

You can now Multiverse Read this asset back in Maya or open in on any other application that supports Preview Materials such as macOS Quick Look, iOS, Houdini, Unity3D or Unreal Engine.

Important

Make sure the textures are in the same folder as the asset.

macOS (put screenshot here)

iOS (put screenshot here)

Houdini

Unity

Maneki, generated by Multiverse, in Unity3D

Unreal Engine

Maneki, generated by Multiverse, in Unreal Engine

Last Updated: 8/3/2020, 2:04:11 PM