This tutorial explains on how to setup assets, and export them from Maya into the CRYENGINE using the Crytools that are available. Before getting started, you should familiarize yourself with the Installing the Maya Tools and
Source Maya scene with exported CRYENGINE files:
Before you continue with this tutorial, make sure to have read and understood the following topics:
Make sure to keep the following things in mind while create the minimum elements in a Maya to CRYENGINE scene:
After having finished modeling and texturing our geometry and assigned our shaders, proxy geometry are needed for collision detection. Right now the proxy geometry has just a standard Lambert assigned. We have also created LODs (LOD1 and LOD2), those are the same asset with lower polygon counts, which then will be swapped out automatically by the CRYENGINE based on how far the asset are placed with respect to the camera in order to save performance.
Any Maya shader can be assigned to your CRYENGINE asset. They only work in Maya, and you must replace it by a CRYENGINE material in Sandbox later. The Phong shader is arguably the best choice at the moment.
It is very important that you name your geometry correctly. Maya identifies all scene nodes by its case-sensitive name string. CRYENGINE will auto-convert the names to lowercase. Thus, it is not recommended to use same name for two objects with different cases, For example, Propeller for the geometry and propeller for its shader.
CRYENGINE assets uses lower-case naming. But Maya identifies its nodes by case-sensitive name strings. So, please avoid case-sensitive distinction of objects in your Maya scene. Also, do not name any world level nodes as cryExportNode, since this is the entry identifier for the Maya to CRYENGINE exporter.
The below image shows a shaderball example geometry (LOD0 or render mesh) with two LODs and the physics/collision proxy. In the below image, we have intentionally moved the LOD 1 and 2, and the proxy to the left and right for better distinction. We have to align them back to the LOD0 of the shaderball before advancing the tutorial.
A sample shaderball geometry with LOD and proxy distinguished
The current scene in Outliner. Notice everything is still in a flat hierarchy in world space. We use a *_MSH suffix for polygonal geometry as naming convention. Name of the objects does matter, when we start making the cryExportNode groups.
Pic3: An example of naming convention for polygonal geometry.
To create the CryExportNode within Maya, we need to select the geometry first, and then select the Crytek tool shelf and click on the Tools shelf icon. That will open up the Cry Tools window.
Selecting the LOD0 / render mesh of the shaderball and starting the Tools option from Crytek shelf
Now click on Create CryExportNode, this will create the CrytekExportNode and open the window Create CrytekExportNode. Now, name our asset to create a *.cgf file. We make sure that the file type is set to Geometry (.CGF) and then click on the Create button in that window.
The Create CryExportNode button will create an empty transform node and an empty group with the suffix of the name of the selected object.
By default, it will also create the next subgroup which prefixes with shaderball geometry name string. The CRYENGINE default export format is a *.CGF file, a geometry format.
If we look in the Outliner, we'll see that a cryExportNode_<name_of_file> has been created. By expanding the cryExportNode, we see that there's another group below. We may select the asset and move it (by using Middle-Mouse-Button and dragging) into the group that is parented under the "cryExportNode" if you forgot to have the geometry selected in the first place.
To have the LOD0/render mesh geometry to interact with Physics events in CRYENGINE, we need a collision proxy. The proxy geometry should be built with great care to approximate and encompass the shape of your render mesh. Its intention is to be a replacement geometry to reduce physics calculations needed between the render mesh and the environment. Thus, keeping the complexity of your proxy geometry as low as possible. As an option, CRYENGINE provides you with the means to use proxy primitives to improve physics performance.
The most common way to set up proxy mesh is:
We have already included a proxy mesh for the shaderball in this tutorial. To correctly set up our collision proxy geometry, first we need to select it in the Outliner, move it into the same group under the cryExportNode since our main geometry is parented.
cryExportNode hierarchy including a proxy mesh.
As a next step, we open up the Hypershade and create a Phong shader. We name the shader as proxy_SUB. Now open the shader attributes and set the color to red and its transparency to perhaps 80%. Once this is done, we can assign this shader to our Proxy geometry.
Note: Any shading parameter changes here is only meant for your Maya scene. The CRYENGINE Exporter translates only the setups with shader assignments to your geometry (objects or faces), and they ignore any other material setups created using Maya.
Using red transparent proxy shader for better distinction in Maya
Assigning a material to a geometry selection (individual faces or the whole geometry object)
The proxy material still needs to be tagged as such for CRYENGINE. This is done by adding an Extra Attribute to a Maya shader.
To add an extra attribute to the shader.
Using Attribute Editor tab to tag the proxy material
For better performance, you should only use CRYENGINE (collision/physics) proxy primitives. You need to create your own custom proxy objects if you really need them. All non-primitives/custom physics proxies should have a reasonably amount of polygons. To declare our Proxy geometry as a primitive (only primitive geometry like cubes, cylinders ,capsules and spheres can be used for that, and we can have as much geometry primitives as we need to):
Below is a video showing you how to set up collision proxies in Maya:
To export the asset successfully from Maya into CRYENGINE, we need to set up a Material Group. A material group contains all the materials assigned to the geometry and the materials are numbered. Since the legacy of CRYENGINE is strongly linked to 3ds Max, we see the material group as a Multi/SubMaterial and the shaders grouped under it as SubMaterials. This affects the proxy material setup too as we have to include it to the material group.
To setup the material group:
Final view of the newly created material group.
To create the LOD groups, first create an empty group under the node that is parented to the cryExportNode and name it as _lod1_assetName_group. For subsequent LODs , you can name them as _lod2_assetName_group, _lod3_assetName_group, and etc. In Maya, you can create an empty group by going to the menu Create -> Empty Group and rename it afterwards.
Once we have our LOD groups, parent the LOD geometry under their respective group. As you can see, only the name of the parent group node is important to be marked as an LOD, not the mesh node itself.
Placing empty LOD1 and LOD2 parent groups under world space
Selecting LOD1 and LOD2 groups and the parented LOD mesh nodes under them
Placing the LOD groups under the cryExportNode Sub-Group
Now that we have all set up, we're going to export the asset from Maya. To do that go to Crytek shelf, and then click on the Export shelf icon to open the Crytek Export window. The Exporter will automatically look for any root level groups named cryExportNode_* and display the groups in the list. You have more functions when you right click on the list, like refresh manually the list after changes.
Click on the Export Selected button. Now the geometry asset will be exported into the same location as our saved Maya scene file.
Exporting the shaderball cryExportNode to a *.CGF file.
In the Exporter, click on Generate Material Files button, this will save the CRYENGINE *.MTL file in the same location as you have saved your Maya scene file. It's recommended to keep the name of the material similar to your asset, for example, a shaderball.cgf geometry should be accompanied by a shaderball.mtl material file.
Exporting the shaderball material to a *.MTL file.
Open Sandbox.exe from the installed CRYENGINE folder, and create an empty level or open a level that you have worked on before.
To load the asset into Sandbox:
Viewing the exported shaderball asset
To check if everything is exported correctly, open up the Material Editor. In the editor, the main Material (Shading Group) and all the sub-materials (the materials that were assigned to our geometry) should be visible. The Proxy Material should be in the first slot.
You won't see the material since it was set to noDraw so it's invisible. Select each sub-material and load the correct textures into the right slots. As you can see the proxy is also present and defined as a CRYENGINE primitive.
True CRYENGINE proxy primitives are displayed in gray shading with no triangulated face edges. Non-primitives/custom proxy object have a wireframe displayed on top of the gray shading.
Displaying the collision proxies in the viewport
Proxy geometry are usually shaded in grey. However, if you see the proxies slowly blinking between red and grey, you are advised to reduce the polycount or rebuild your proxy geometry (made of several elements) into one continuous piece. Although this is not mandatory, you might encounter some cases where Physics events do not behave correctly.