# Write Preview Materials to USD

With Multiverse it is possible to write into USD files PBR material shading networks (opens new window) using usdPreviewSurface materials (opens new window), so that Hydra delegates (such as Hydra VP2, Storm and others) can display materials with textures in the viewport.

This is commonly referred as "Preview Materials", and as the name suggest, they are mostly useful for viewport preview purposes, though they can also be rendered (in Multiverse with the 3DelightNSI renderer) and by Karma in Solaris.

The same information can be written to USDZ as well, in such case the asset will be packed and portable and can be consumed by many devices.

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-roughness logic. Make sure you have the shaderFXPlugin plugin loaded (this plugin is included with Maya by default).

Why Stingray PBS?

Because it is the only renderer-agnostic material that is available in all Maya versions, from 2018 to 2023, which has a parametrization compatible with the USD preview materials. Another 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. Last but not least it can be used as a hardware shader input on Maya material and allows for the unified workflow outlined below.

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.

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 output 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 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" in the Multiverse Asset Write options. We label it as such because in the next section you will see we are leveraging the hardwareShader parameter of any Maya material:

You can now Read the USD 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 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

# iOS

# Houdini

# Unity

Maneki, generated by Multiverse, in Unity3D

# Unreal Engine

Maneki, generated by Multiverse, in Unreal Engine

Last Updated: 1/25/2023, 9:34:11 AM