Exporting from Maya

Exporting Maya models to Castle Game Engine can be done in various ways.

1. Export to FBX (if necessary) and convert FBX to glTF using FBX2glTF

If you received assets from a graphic designer in both the .ma and .fbx formats, it is easiest to convert files from the FBX format using the FBX2glTF tool to glTF. In this case, there is a high probability that you will get a good conversion result without any additional work, as the graphic designer adjusted the model when (s)he created FBX file.

You can also use built-in export from Maya to FBX, and then convert with FBX2glTF.

The export itself is very simple. Just call FBX2glTF tool in the console with one parameter - FBX model file name:

FBX2glTF model.fbx

After the export, the modelname_out subfolder will appear with the exported model.

The conversion result can be easily compared using view3dcene and FBX Review.

2. Export to glTF with Babylon

If the FBX2glTF conversion effect is unsatisfactory or you are a graphic designer and want a direct solution (without intermediate FBX file) at the cost of some additional setup, a good solution is to use the Babylon glTF plugin. In this case, the model will often need to be adjusted before performing the conversion.

2.1. Plugin installation

Babylon glTF plugin comes with a handy installer, which you can download from Babylon Exporter Github Releases page. The installation itself consists in clicking the install button.

Babylon glTF Installer Babylon glTF plugin installed Open Plug-in Manager Check Load on Maya2Babylon.nkk.dll

2.2. Export overview with screenshots

The steps to be followed depend largely on the model. Screenshots below can be used as an overview.

Open material editor Select material and show input output connections Add aiStandardSurface material (Arnold Renderer) and connect textures. Other materials have glitches in my model case. Run exporter Change format to gltf/glb, select output file and click Export. Result in view3dscene

2.3. Plugin updating

The Babylon glTF exporter is being actively developed. It is worth checking the possibility of updating the plugin from time to time by running the installer. When new plugin version is available the Update button will be showed.

2.4. More info

See Maya to glTF and Babylon Maya resources pages for more info.

3. Export to glTF with Maya2glTF

If you have problems with Babylon glTF, you can try Maya2glTF script. To install run maya2gltfDeploy.bat. After loading the model, just type maya2glTF_UI in the script window to display the export UI.

For more info see Maya2glTF Github page.

4. Old approach: OBJ

To export static meshes to our engine from the latest Maya version you can export as an OBJ format.

  • You may need to enable it first, by going to the Windows -> Settings/Preferences -> Plug-in Manager. Find the objExport.mll on the list, and check Loaded (check Auto load too, to have it active always).
  • Then you can export using the File -> Export All... menu item, and choosing OBJExport as the file type.
  • See the screenshots below for help.
Maya Plug-in Manager menu Maya Plug-in Manager window Maya Export All menu Maya Export All dialog View in view3dscene city model exported from Maya. Model By Keenan Crane | From http://opengameart.org/content/abstract-city

If the exported things seem completely black, fix the material to have non-black diffuse color. (I don't know why Maya sets diffuse color to black on my test models...) You can edit the material in view3dscene: open the OBJ file, select the object with Ctrl + right mouse click, and use Edit -> Edit Material -> Diffuse Color menu item. You can save the resulting file as X3D using view3dscene File -> Save As VRML/X3D menu item.

Bonus points: OBJ format supports normalmaps, so we will read the normalmaps you set in Maya correctly.

To export animations, you can export each keyframe as a still OBJ file, and then create a simple XML file with the .castle-anim-frames extension to define an animation.

Maya Sample Model By Hextraction | Base Player Pod by ComboMash Entertainment Inc -- http://www.hextraction.com/ | From http://opengameart.org/content/hextraction-base-player-pod View in view3dscene Hextraction model exported from Maya