3ds Max

Overview

This tutorial assumes that users understand the basics of 3ds Max, such as the user interface and the creation of simple geometry, and can place objects in the Sandbox Editor.

Sample File

An example of a 3ds Max scene with the hierarchy setup for the static geometry exporting can be downloaded PhysicsProxy.max.

Preparation

All objects/folders containing objects must be placed under the root game folder, in the GameSDK\Objects folder. Objects placed outside of the Game folder won't work in the engine.

Create an example object in GameSDK\Objects\Testbox. Create a simple box, a meter or two (3-6 feet) in each dimension. CRYENGINE uses the metric system for measuring distances so this should be adopted in your software as well.

There are several important things that users should pay attention to as they create objects.

  • The pivot of the object in 3ds Max corresponds to the pivot of the object in the engine.
  • Make sure that the object has smoothing groups assigned to it. The engine will assign a smoothing group for any polygons that lack one, which will usually result in undesirable visual results.
  • Make sure that the object has UVW mapping.
  • You are free to keep any modifier stacks on the object as they won't affect exporting and the object will appear in the engine as you see it in 3ds Max.
  • The more polygons the object has, the longer it will take to be exported; although, the exporting time is generally very quick.
  • The object should either be an editable mesh or an editable poly.

Material Setup

To use textures and shader effects, the object needs a material. Materials are stored as .mtl files.

In this tutorial, you will learn how to create a material in 3ds Max and transfer that information into an MTL file, where it can later be edited by using Sandbox's Material Editor.

1. Open the Material Editor in 3ds Max.
2. Select a fresh material, click the Standards slot, and then change the material type to Multi/Sub-Object.

3. Set the sub-material count to three. The engine supports up to 32 sub-materials. The more sub-materials the object uses, the more drawcalls it will use, reducing performance. Therefore, it's best to find ways to keep the sub-material count as low as possible.
4. Give the material and all sub-materials a name. When you create the material file, these names will be transferred. The name of the material that you assign to an object in 3ds Max must be the same as the name of the actual material file. Name the material "Testbox" and then create a material file with the name Testbox.mtl.

5. Open each sub-material and in the Shader Basic Parameters section change the shader type to Crytek Shader. You should only use the Crytek Shader for the objects. The other shader types will not work correctly when exported. If you get an error message, please check that all the plugins have been correctly installed.

You'll notice a new drop-down list under Physicalization. This list contains presets for the way the material acts in the engine. For now, you only need to worry about two of these: Default and Physical Proxy.

  • Default is a normal material. You'll use this for most of the materials. It has no special properties.
  • Physical proxy is a special material that you can use for physicalized geometry. It collides with physicalized geometry but isn't rendered; it's invisible.

6. The third sub-material should be a physics proxy. Go to this sub+material and change the physicalization type to Physical Proxy (NoDraw). Select the Physicalize checkbox. This will physicalize the material in the engine. If this box is not checked, the object will not be physicalized and it will not physically interact with anything in the game world. If the object has a separate physics proxy, the rendered geometry should not be physicalized.

7. Assign a texture to each sub-material, except for the Physical Proxy (NoDraw) sub-material, which will be invisible and is used only for collision. Go to the first sub-material and under the Maps section, change the Diffuse Color Map to Bitmap.

Search for the texture that you want to use. All textures (except for Flash textures) should be in either the CRYENGINE TIF format or in the DDS format.

Now, select a bitmap for the Bump Normals Map. Be sure to pick one with a _ddn suffix; other textures won't work as normalmaps. This will be the normalmap. Using normalmaps is optional. Repeat these steps for the second sub-material. Choose different textures.

Assigning the Material to the Object

Assign the multi-material to the object. Change the material ID of some polygons to 1 and some polygons to 2. Make sure that the object does not have material IDs beyond the number of sub-materials that the multi-material has. If present, they will be displayed as "Replace Me" textures.

Generating the Material File

Open the CRYENGINE Exporter Utility. It's a good idea to add a button for the exporter to the utility button list, as this is a function that will be frequently used. At the bottom of the utility window, you'll find the Material section.

Make sure that you're currently in the parent level of the material in 3ds Max. This means that you should not be viewing any of the sub-materials, just the parent multi-material. If you're in any of the sub-materials while creating the MTL file, the file will contain only that sub-material.

Click Create Material. This displays the Sandbox Material Editor window. Now, click Create Material in 3ds Max again. You will be asked to enter a filename for the new MTL file. Make sure that this name is the same as the name of the material in 3ds Max.

Click Save when done.

The material will now be generated. You can expand the parent, revealing the sub-materials. All the textures that you chose in 3ds Max will be used by the material.

Close the Material Editor window.

Exporting the Geometry

In the Object Export section, select the object and click Add Selected. You can also select multiple objects at one time.

Click the blue Export Nodes button. This will export the object. It will be generated in the same folder as the 3ds Max file. You can view this folder by clicking the Explore button.

The object will have the same name as the 3ds Max filename (Testbox.cgf). You can name the object something else by selecting the Export File per Node check box under Geometry Export Options, and then giving the object a different name.