AAM exporter for Maya

From VRwiki
Jump to: navigation, search

This page explain how to installation and use the AAM exporter for Maya.

Installation

Get the exporter here:

Actually the version 0.2 is avaiable only as code.

Download the file and extract the Maya2AAM.mll file in the ($MAYA_DIRECTORY)\bin\plug-ins directory and the Maya2AAMOpt.mel file in one of the maya scripts directory, in windows this directory is ($DOCUMENT)\maya\scripts or ($DOCUMENT)\maya\8.5\scripts.

Actually the only available version is for Maya 8.5 32-bit for windows. But you can download the source code and compile your own version.

Note: This is still an early release of the exporter and sometime can crash, I suggest to save before use this library. I don't take any responsibility if you loose your work using my exporter.

Running the exporter

Plug-in manager

Restart Maya and open the plug-in manager (Window->Settings/preferences->Plug-in Manager) and check Loaded box near the Maya2AAM. Check the Auto load box if you want the exporter to be loaded when Maya start.

If the exporter starts without problem you can export your mesh from the command menu File->Export all... or File->Export selected...

In the export window you can change the export option with the button Option.

Features

Actually the exporter can export the following things:

  • mesh and set of mesh without animation
  • character without animation
  • diffuse texture
  • light map texture

You will find the reflection map option in the export option, but actually are not supported.

Supported material

Supported material are:

  • Lambert, diffusive material with no specular reflection. The color attribute controls the diffusive color, and if you plug a file texture here it will be exported as main texture. Procedural texture are not supported. Light maps must be connected to the Incandescence attribute in order to be exported.
  • Blinn, is a material with specular reflection. This material behave like the lambert but also have a control over the shininess and specular color. There is no direct connection between the eccentricity attribute, Specular roll off attribute and the openGL shininess value so I decide that you can control the shininess with the reflectivity attribute. Valid value are only between 0.0 and 1.0.
  • Phong, work exacly as the blin.

In next version I'll try to improve the shininess support for material with a WYSIWYG behavior.

Note: The path of the texture is not exported, all the texture must be in the same directory of the model. Otherwise you can add a path manually editing the aam file with a text editor.

Help

Options

Options window

File->Export all... will export every mesh in the scene into a single aam mesh or character, while File->Export selection... will export only the selected mesh. Chicking in the box on the menu you will open the options window.

Type: choose to export a mesh, or a character

Up axis: select the up axis. Z up is used in 3DStudio/DirectX and works fine with meshes. Y up is used in OpenGL/Maya and work fine with character. When you select character the Y axis is selected automatically.

Vertex coordinate space: Select the vertex space.

  • World: Meshes vertex are in world coordinate, when you import them in XVR the pivot will be in the origin.
  • Local: Meshes vertex are the same as in Maya.
  • Pivot: The vertex position is relative to the rotate pivot.

Add children automatically: When checked you can select the root of a hierarchy and all the children will be exported. When not checked only the selected object will be exported. This work only with the 'Export selected...' option.

Use white material: When checked force a white material if a texture is connected to the plug.

Export secondary texture: Allow to export a secondary texture.

Secondary texture: Select the type of secondary texture will be exported. Actually only lightMaps are supported.

Lightmap on ambient color: Let to exports lightmap connected on ambient the color plug.

How to export light map

To generate lightmap add your object to a baking set. Set the color mode to Only light, this will create a texture with light and global illumination. If you want to export only global illumination set color mode to Only global illumination, or Occlusion if you want to an occlusion map.

Change the file format to jpg or png. XVR don't read iff or other Maya formats. If you want to work in your scene with other image format select your preferred format but you have to convert the image before export the texture in XVR. Maya also read the dds format but in this stage you can't create a dds light map. Select texture resolution and texture name. To improve texture quality and remove aliasing artifact you can increment the Number of sample value. Be carefull high sample occlusion map can take a very long time to render.

After you have set all the attribute in the baking set go in the Lighting/Shading menu and select Batch bake, if you want to keep your original shaders go in the Batch bake option and check the Keep original shading network. If you use mental ray as rendering engine the light map will be create in your project directory .\renderData\mentalray\lightMap.

Maya usually give to light maps very long name, but you can rename it if you like.

Note: Maya connect light maps to incandescence attribute by default but you can connect it to ambient color and select LightMap on ambient color.

Compile your own version

Maya is distributed in a lot of version and plug-in library of different version are incompatible. It's very hard to support all Maya version (Windows/Linux/Mac version, 64/32 bit for every version of Maya). I post the code of the exporter so you can compile your personal version.

Get the source code from this SVN server: http://svn2.assembla.com/svn/Maya2AAM

Just go in the directory you like an type: svn checkout http://svn2.assembla.com/svn/Maya2AAM or use an SVN client interface like tortoise.

Download the source, the project is setup for Visual studio 2005 (SP1).

Go in the window system properties and in the advanced tab click the Environment variable button. And add an environment variable called MAYA_DIR, with the Maya installation directory. It's used to get the right include directory and to generate the library in the plug-in directory. If you don't want or you can't create an environment variable just change the include and the output directory from the properties of the project.

The code is free, you can change it an you can redistribute it as you like, but if you made some improvement that you want to share with the XVR community you can send me a mail and I'll publish it in this page or if you want to collaborate I'll grant you the write access to the SVN server.

Known bug

  • Sometimes object with history don't get exported. Delete the history and try again.
  • Hard edge are not visible in XVR. XVR work with smoothing groups like 3D Studio Max. I create an algorithm that compute the right smoothing groups but it works only with the XVR engine 147 and above, but this engine have some trouble to visualize the smoothing groups correctly.

Please if you find other bug post a bug reports in the XVR user forums.

Changelog

Ver. 0.2

Added support for character

Now it's possible to choose the export space coordinate.

It's possible to export lightMap from ambientColor.

It's possible to force white material on textured material.

Fixed some bugs

Ver. 0.1

Basic support for standard material, texture and light map.

Maya and 3D Studio max are trade mark registered by Autodesk, Mental ray is registered by Mental image