Tutorial: Exporting static mesh (Max) This tutorial walks you through the steps needed to get a static mesh exported from Max and ready for importing into Lumberyard, including how to export the static mesh and its material. Placement of the static mesh and setup of the material will be covered in different tutorials. At the end of the tutorial you will have exported the static mesh and material. You will learn how to do the following: •
Exporting static mesh and materials from Max to Lumberyard
Prerequisites You must have the following before starting this tutorial: • • • •
Lumberyard 1.6.0.0 installed or later Autodesk 3ds Max 2014 or later versions Lumberyard Max plugin and exporter installed through SetupAssistant Sample asset is included with Lumberyard. It can be found where you installed Lumberyard under: ...\dev\SamplesProject\Objects\Tutorials\Tree\tree_large_01.fbx
Step 1: Exporting static mesh and materials from Max To get a static mesh and its material from Max to Lumberyard, we have to export it using the Max Lumberyard Exporter. To export a static mesh and material from Max 1. Run the version of Max that you have installed on your system and for which you have installed the Lumberyard tools and plug-in. Open the Max file or import the file for the static mesh asset you want to export. If you are importing an asset, make sure you save the scene as a Max file, otherwise during the export process you will be given a warning to save the scene first.
2. If you are importing the FBX asset, you will also want to make sure you reset the Xforms so the asset has the correct transforms in Max, otherwise you could potentially have assets that get exported sideways.
3. To prepare the mesh for export, you will need to set up a material. If you have multiple materials assigned to your mesh, they will need to be part of a Multi/Sub-Object material. You will also want to convert any of your individual materials to Crytek Shader materials to avoid any warnings on export. If you imported an asset, you will have to add the material to the Material Editor in Max by using the eyedropper. For this tutorial, I named the Multi/Sub-Object material to tree_mat.
4. Open the Lumberyard Exporter from the Utilities Panel and select the static mesh that you want to export. Then, click on the Add Selected button under the Geometry Export section in the Lumberyard Exporter.
5. The static mesh will be added to the Geometry Export list, which you will want to make sure the .CGF extension for static objects is assigned. You will have the option to rename the exported version of the static mesh, but the default will inherit the same name as the Max file.
You may want to change the name of your asset or choose a custom export path if you do not want your exported mesh to default to the same location as your Max file. If you are setting a custom filename or path, be sure to enable the checkbox for Custom Filename. In this case, we will export this mesh under the Objects\Tutorials\Tree directory under the game project for Lumberyard. Note: You will also have to type in the name of the asset if you are assigning a custom export path, otherwise you will be unable to assign a custom path.
6. To export the static mesh, click on the Export Nodes button.
If you get any errors, be sure to read them to help indicate what may be wrong. If you are successful, you should see the Lumberyard Exporter log window disappear. If you are successful with warnings, the Lumberyard Exporter log window will remain to inform you of the warnings.
7. Now that the static mesh has been exported, you will want to export out the materials. You should have already prepared your material(s) back on step 4. You will want to have the Lumberyard Editor running before exporting a material from Max. To launch the Editor, open Setup Assistant and click Launch Lumberyard or run the Editor from your Start menu. Note: You may want to make a shortcut to the Editor on your desktop or pin the program to your taskbar.
8. You must close the Welcome to Lumberyard Editor window in order for the material editor in Lumberyard to generate your material when you export it from Max.
9. In Max, open the Material Editor and select the material you want to export.
10. In the Lumberyard Exporter, go to the Material section and click on the Create Material button.
11. The Save As window will pop up for you to choose a location to save your material and name the material file. In this case, I will choose the same location that I saved my exported static mesh (.CGF). I will also give the material the same name as my Multi/Sub-Object material that is assigned to the static mesh in Max, which in this case is named tree_mat. Note: It is important that the name you assign to your material you’re saving in Lumberyard be the same as the name that was assigned in Max for the material to map correctly to the mesh. 12. You should now see your material loaded up in the Material Editor in Lumberyard, which means you have successfully exported the material.
You should now have a .CGF and an .MTL file in the location you specified. As a reminder, we will not be covering the static mesh placement or material setup in Lumberyard in this tutorial because it is covered in a separate tutorial series. You have now successfully exported your static mesh and material to be used in the Lumberyard Editor. Please refer to other tutorials in the related section for next steps.
Related tasks and tutorials Now that you have exported a static mesh and its material, you should learn how to place your asset and set up materials in Lumberyard, or continue learning how to export: • • •
Tutorial: Getting started – Object placement Tutorial: Getting started – Materials Tutorial: Exporting characters (Max)
We’d love to hear from you! Head to our Tutorial Discussion forum to share any feedback you have, including what you do or don’t like about our tutorials or new content you’d like to see in the near future.