Skip to content

IMPORT: Maya

scurest edited this page Sep 20, 2019 · 9 revisions

Importing: Maya common issues

All of the MEL scripts provided on this page (and more) are available in this custom button shelf, which you may find to be a useful time-saver if you are going to be importing models often.


The model is partially/fully transparent

The default Maya COLLADA importer (DAE_FBX) does not correctly support transparent textures (ie: textures with alpha channels).

It mistakenly sets the 'alpha is luminance' flag for the texture, making the assumption that it is a black & white 'alpha map' image.

The following image shows how to modify this 'Alpha is luminance' flag: Alpha channel example

Alternatively, you can use this MEL script to do it for all the textures in the current scene:

string $temp;
string $files[] = `ls -type file`;
for ($temp in $files)
{
    setAttr ($temp + ".alphaIsLuminance") 0;
}
setAttr "hardwareRenderingGlobals.transparencyAlgorithm" 3;

Furthermore, the Maya viewport might render transparent objects incorrectly, to fix this you need to go to the viewport settings and select "Depth Peeling" as the transparency algorithm, rather than the approximative "Object Sorting" algorithm. This is what the last line of the MEL script above does.


Textures don't mirror/wrap properly

The default Maya COLLADA importer does not correctly handle the MIRROR wrapping mode.

You can set this manually from the Hypershade window, by selecting the "place2dTexture" node for that texture, and checking the appropriate "Wrap U/V" and "Mirror U/V" checkboxes:

UV Mirroring example

Alternatively, you can use this MEL script to mirror all texture UVs in the current scene:

string $temp;
string $textures[] = `ls -type place2dTexture`;
for ($temp in $textures)
{
    setAttr ($temp + ".mirrorU") 1;
    setAttr ($temp + ".mirrorV") 1;
}

Vertex colors don't work

This is more of a COLLADA issue. The vertex colors are there but there's no (good) way to describe how the vertex colors should affect rendering. The output color should be the component-wise product of the vertex color and the color sampled from the texture (ie. the same as old-school GL).

As such, the way to get this look in Maya is to select the mesh(es) in question, and then:

  • set Mesh Display > Material Blend Setting to "Multiply"
  • set Mesh Display > Color Material Channel to "Ambient"
  • click on Mesh Display > Toggle Display Colors Attribute

Maya vertex colors example

Alternatively, you can use this MEL script to do this for every mesh in the scene:

string $temp;
string $shapes[] = `ls -type shape`;
for ($temp in $shapes)
{
    if (`attributeQuery -node $temp -exists displayColors`)
    {
        setAttr ($temp + ".displayColors") 1;
        select -r $temp;
        polyOptions -colorMaterialChannel ambient;
        polyOptions -materialBlend multiply;
    }
}

Animations aren't imported properly/at all

The default Maya COLLADA importer apparently cannot handle multiple animations. You can either:

See this page from the autodesk website

  • Work around this by using this Python script to split a DAE file with multiple animations into multiple DAEs with one animation each. Call it like splitter.py FILE.dae.

See #9.