Exporting from Maya
This page explains how to export a static model from Maya into Sandbox2, the editor for Crysis. It will be updated as MayaCGF evolves…
First of course, you need a polygonal mesh. And I’ll assume you have already installed MayaCGF.
Step 1: Prepare the model
(The model I use for this tutorial is the head of Laurence Barnes from Crysis). First you need to create a folder in the Crysis folder hierarchy specifically for your model. For example: /Crysis/Game/Objects/my_objects/headTest.
Shader: The way I usually work is: I’ll assign a rough material in Maya to each mesh, making sure to name the shaders properly (so that I can recognize them later on in Sandbox2’s material editor).
Important: You should always leave the “Overwrite .mtl file” check box unchecked when exporting the same model over and over again. If you don’t, the material for your model (which usually has the same name as the model file, except .mtl instead of .cgf) will get overwritten with the default (gray) one. And you probably do not want that!
Note: It seems the specific image format used by Crytek (a .dds file) is unfortunately not supported by Maya. If you try to import a Crysis normal map and the Hypershade window is open, you’ll probably see a succession of warnings and errors looking like this:
// Error: Image conversion (to IFF) failed //
// Warning: Failed to open texture file ....... _ddn.dds //
Step 2: Export the model using MayaCGF
In MayaCGF’s window, make sure you indicate the proper path to where you want to export your model (in our example E:/Crysis/Game/Objects/my_objects/headTest). That’s where the .mtl file will be created as well. After that, choose the name for the .cgf file itself (the “.cgf” at the end is optional).
Play with the “Scale Compensate Factor” if you find the imported models to be too big in Maya.
Finally, select your model by clicking in the outliner on the group where the mesh(es) reside(s). And click on Export Model. Note that you can either select all the meshes individually by clicking on them, or you can put all the meshes in a group (or multiple groups) and just select the top group. MayaCGF will export every visible mesh included in the groups.
Then you can go into Sandbox2’s material editor and start tweaking each sub-material for your model. Since you named them clearly in Maya, you know exactly what they’re supposed to be and which part of your model they relate to.
Important: I advise you to do make copies of your material files from time to time. You’ll probably spend a lot of time tweaking them, so make sure to do backups regularly.
Rules to remember when exporting a model
- Make sure the topology on your mesh is sound (no collapsed faces, isolated vertices…).
- Your model needs to have valid UVs. If some vertices have UVs and some other don’t, MayaCGF will probably crash.
- MayaCGF and Crysis only work with polygons, so no Nurbs nor SubDs.
- Freeze the transformations on the meshes before exporting. If you don’t, your models won’t appear in the right place and/or at the right size in Sandbox2.
- Delete the history on the meshes before exporting (this one may be optional, but better safe than sorry).
- Sometimes, when exporting the same model over and over (for testing purpose), just hitting the “Reload” button in Sandbox2 may not be sufficient to see the changes (especially the materials); in this case, just close and restart Sandbox2 and your model should appear the way you exported it.