Exporting Maya models to Castle Game Engine can be done in various ways.
If you received assets from a graphic designer in both the
.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:
After the export, the
modelname_out subfolder will appear with the exported model.
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.
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.
The steps to be followed depend largely on the model. Screenshots below can be used as an overview.
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.
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.
To export static meshes to our engine from the latest Maya version you can export as an OBJ format.
objExport.mllon the list, and check Loaded (check Auto load too, to have it active always).
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.
Copyright Michalis Kamburelis and Castle Game Engine Contributors.