-
Notifications
You must be signed in to change notification settings - Fork 18
IMPORT: Maya
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 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:
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.
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:
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;
}
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
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;
}
}
The default Maya COLLADA importer apparently cannot handle multiple animations. You can either:
- Use the Autodesk FBX Converter to convert the DAE to an FBX file, and import animations from the FBX.
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.