Exporting Maya assets for Lens

In Maya, how you export content so it is viewable in Lens depends on several factors. Below we’ll cover the most common cases and workflows. We’re only covering exporting an FBX because that’s what is built into Maya.

Metal/Rough FBX in Lens

Recommended FBX Settings

Before diving into specific issues, make sure your FBX export settings are correct. Below are some import settings to keep in mind.

Format

The FBX file format type should be set to Binary and the version should be the latest version, or at least a version newer than FBX 2006.

Embedded Media

You’ll want to have this box checked as this is how your textures will be preserved and displayed in Lens or any other real-time viewer.

Axis Conversion

Make sure you’re exporting Y up as Lens is a Y up system.

Importing your FBX into Lens

If you’re confident you’ve followed the workflow(s) detailed below, you’re ready to import your FBX into Lens!
You can import the model into Kraken and view it in Lens by following these steps:

  1. Import the model:
    – To add the model file to an existing Kraken asset, select the asset, go to the Files tab of the Preview panel, and add the model.
    – To add the model file to a new asset, click the + New button and import the model.
  2. Select the asset, and under its thumbnail image click View this model in 3D.

For more information about Lens, see Lens Real-Time 3D Viewer.


Supported Material Workflows

Depending on your model’s desired look you may have to mix and match using StingrayPBS and Phong materials. Below is an image comparison of the four most common use cases, note that that cut-out is not the same as transparency.

Lens
Maya Viewport 2.0

Metal/Roughness PBR

If you’re working with a Metal/Roughness workflow you will need to use the StingrayPBS material as it supports the M/R map types and can be embedded in an FBX.
Note: If part or all of your model is glass or otherwise translucent (not cut-out), you will need to use a Phong material. For details on how to add maps and set up a Phong material, see the Spec/Gloss or the Glass section below.

For all the nontranslucent parts of your model, use the StingrayPBS shader as shown here:

Applying the StingrayPBS shader to a model
  1. If the object that has this material applied contains an opacity map (sometimes called a cut-out map), change the StingrayPBS shader type to Standard_Masked. If no opacity map is used, simply leave the preset set to Standard.
  1. Twirl down the StingrayPBS texture properties and plug in your Metal/Rough textures into their appropriate slots (you can middle drag a texture node into the texture channels).
    If you select the preset Standard_Masked, the Mask Map texture slot parameter will become visible.

Other notes for StingrayPBS Metal/Roughness workflows:

  • If you are using cut-out or transparency values or maps, you must separate the meshes from fully opaque meshes. So if you were modeling sunglasses, you’d want the lenses to be a separate mesh from the frame.
  • When texture maps are applied, make sure to select the texture checkbox for each map that is being used. These checkboxes are in the Attributes drop down menu within the StingrayPBS shader, as shown in this picture:
Selecting the texture check box for each map that is being used
  • If you’re using a metal/rough texture set and you have glass in your model, first make a Phong material for the glass. Then to get accurate results from your maps do the following:
    • Base Color can be used as Diffuse
    • Omit Metallic map
    • Invert Roughness map
    • Manually apply specular color value for desired look. Map must be grayscale.

Spec/Gloss PBR

If you’re using a specular/gloss PBR workflow or your model requires a glass shader you will need to use the Phong material. Set up the Phong network like this:

Using the Phong shader with a specular/gloss workflow

Other notes for Specular/Gloss workflows:

  • If the model uses an Opacity or Transmission map, plug it into the Transparency attribute of the Phong material.
  • If the model uses a Transmission map, invert the Transmission map and relabel it as an Opacity map. This new Opacity map drives the original transmission value within Lens.

Glass and other transparency

Regardless of your workflow, metal/rough or spec/gloss, there are special setups for glass objects and objects with transparent parts (alpha cut-out).
As mentioned in other sections, you must separate objects with any kind of transparency from fully opaque objects. Below we’ll cover a few of the most common transparency scenarios.


Glass

Glass requires the Phong material node. If your glass requires maps and they’re from the metal/rough workflow you’ll need to adjust them slightly to work. If your glass does not use maps then the setup is very simple. This section only covers smooth glass or glass with glossiness maps.  Decals (stickers, text, etc.) are covered below.

The cosine (glossiness) and specular maps here are not necessary unless you need to alter the glossiness of the glass surface.

The exact color and transparency settings from the above images are shown below. You can tint the glass using the color property and control the overall transparency via the transparency property.

Glass settings from example

Below are samples of each map, cropped for simplicity. Since cosine power (glossiness) is not a color (RGB) channel it is easier to represent it with alpha. So you would plug the alpha of the texture into the cosign power attribute of the Phong material.

How to use metal/rough maps for Phong glass:

  1. Base Color map can be used as Color
  2. Omit Metallic map
  3. Invert Roughness map and use as Gloss map
  4. Manually apply Specular Color value for desired look. Values and/or map must be grayscale.

Glass with Decals

In some cases you may want to place some texture on the glass surface, for example a sticker on a window. The setup for this is slightly different than simply modifying the glossiness of the glass. The Maya viewport will mislead you, so we’ve listed a few important steps below to avoid confusion once you import into Lens.
Again we’ll be using the Phong material and spec/gloss textures. Metal/rough textures are possible, if you follow the steps listed at the end of the previous section.

Other than the maps mentioned below in this section, the Phong material’s properties have not been changed. Here’s how the network is setup:

Below are samples of each map, cropped for simplicity. Keep in mind that black is fully transparent, i.e. cut-out. Fully white values are opaque. The glass parts should be some grayscale value and the decal should be pure white.


Transparency / Alpha / Opacity / Cut-out

If you’re working in metal/rough, your object is not glass, and it requires an alpha cut-out; this section is for you.

You can plug in your metal/rough maps as shown and then plug your cutout texture into the Mask Map property.

Make sure you do not check the Opacity Map box in this case.

Below is a sample of the maps used, cropped for simplicity.


Common Issues and Maya Errors

Unsupported Nodes

Some nodes like cameras, lights, nurbs, constraints, ramps, hair, among others will not be exported correctly or be available in Lens. These are generally fine to have in your scene, but know they can cause issues in Lens depending on how you’re using them. Even if there are no errors on export, Lens may not support the node. For example, we currently do not support embedded lights and cameras in Lens, even though FBX supports them.

Procedural Textures

If you’re not using a texture based shading system, i.e. image texture for albedo/base color, your texturing will likely be lost when exported as FBX. To work around this you can either switch to using texture maps or bake your procedural system to a texture and plug it in before exporting. Converting to a texture map does however require your model to have UVs. Read more details in the Maya documentation. If you do not convert to a map and attempt to export unsupported texture networks you’ll get an error message like this:

The plug-in does not support the following maps and will not export them. To learn how to convert them so they export correctly, see Edit > Convert to File Texture in the Maya documentation.
	my_ramp_tex
Unsupported Materials

Because FBX is a general purpose transfer format, not every material type will be supported. If your model is coming in gray or white it is probably because of an unsupported material. When this happens you usually will see a warning like this in the FBX message popup:

[WARNING] Unable to export some material(s) - The plug-in does not support the following material types:
 Material my_orange_vraymtl will be exported as a grey Lambert material.
Rigging

Rigging is currently not fully supported in FBX or Lens. For example if you have constraints in your scene and try to export them they will be lost and the functionality will not transfer to Lens or other real-time viewers. You’ll see an error like this during export:

[WARNING] Constraints export failed - The scene contains constraints. Activate the Export constraints or Bake Animation options before exporting.
Lights

Some default lights are supported in FBX, however not all, regardless Lens does not support FBX lights. You’ll see a warning like this if you’re trying to export unsupported lights:

[WARNING] Unable to export some light(s) - The plug-in does not support the following light types:
 Ambient light(my_ambient_light)  will be exported as an inactive point light with the Visibility value set to off.
Embedded Textures

When exporting with embedded media (textures and materials) you must export a binary FBX otherwise some data may be lost and you’ll get an error message like this one:

[ERROR  ] Cannot embed media - The plug-in cannot embed media in ASCII-formatted FBX files. To embed media, export to Binary file type instead.