Getting started with CryENGINE3 SDK


1. Installing the SDK and necessary Plugins

Go to http://www.crydev.net and download the Free CryENGINE3 SDK. Extract if to a folder of your choice. I have chosen CryEngine 3 SDK on my "E" drive for this tutorial.
Go to this folder, open the Tools directory and run the SettingsMgr.exe file.
getting started with CryEngine 3

In the popup, specify the Root directory of your CryEngine 3 SDK. If you set the correct directory the "Engine State" button will turn from red to green. In order to be able to work with the SDK you now need to install plugins for 3d Studio Max and Adobe Photoshop.

1.1 Installing the 3d Studio Max Plugin

In the tools folder of the CryENGINE 3 SDK you will find the plugin files for 3d Studio Max.
getting started with CryEngine 3

Select the plugin .dlu file that matches your version and copy it into your "plugins" folder of your 3d Studio Max directory. Next you should install the Crytek 3d Studio Max Scripts. You can do that manually or install it using a batch file. A detailed guide on how to do this can be found here

1.2 Installing the Adobe Photoshop plugin

The latest release of CryENGINE3 SDK is missing Cryteks internal photoshop plugin so you have to download it manually here. It will be included in the next release of CryENGINE3 SDK. Even though you can work with regular tif files I recommend using the Crytif plugin. Once you have the file go ahead and extract it to your Photoshop folder into the "Plug-Ins" directory.

You need to copy the files zlib1.dll, jpeg62.dll and libtiff3.dll from the Bin32 folder of your CryENGINE3 SDK to your Photoshop root directory as well.
More information regarding the Crytif plugin can be found here. A detailed explanation of how to use it can be found here. getting started with CryEngine 3

2. Exporting your mesh from 3d Studio Max to Cryengine

2.1 Folder setup

You need to store all of your custom meshes in subfolders of the Game\Objects folder of the SDK. By default, the object folder does not exist since all of the meshes are stored in the objects.pak file.
If you open this pak file with Winzip or Winrar you will notice that it contains the Objects folder and all the files that can be accessed in the editor. You could extract the Objects.pak file to your Game folder (thus creating the Objects folder) but for this tutorial I will go ahead and manually create an Objects folder in the Game directory of my local CryENGINE3 SDK directory. Keep in mind that the engine will load files from this folder first and then load all of the assets in the Objects.pak. The folder name is case sensitive so make sure to call it "Objects" and not "objects". Create an additional directory for storing all of the tutorial files called "myfirstobject" in the "Objects" folder.
getting started with CryEngine 3

2.2 Adding the CryEngine exporter tab in 3D Studio Max

Start 3d Studio Max. To be able to access the CryEngine object exporter, select the "Utilities" tab in your main toolbar, click on "Configure Button Sets" and add the "CryENGINE3 Exporter" to your button list by dragging it over.
getting started with CryEngine 3

2.3 Importing your object into 3d Studio Max

Please download the sample obj mesh and textures here and extract it to your local CryENGINE3 SDK folder into "\Game\Objects\myfirstobject".
In 3d Studio Max go to "Customize" and then click "Units setup". Make sure to enter the same settings as in the following screenshot. getting started with CryEngine 3

The next step is to import the obj mesh into your scene. Make sure to enable "Texture coordinates", "Smoothing groups" and "Import from file" in the Normals category. Do not import any materials. Depending on your max version and obj importer plugin the dialog can vary but you should be able to find the same option.
The separator object should now be imported into your scene and displayed with a grey material. getting started with CryEngine 3

2.4 Material Setup in 3d Studio Max

To create a material for the object, open the material editor, click on "Get material" and then select a "Multi-Sub Object" material in the Material/Map Browser.
getting started with CryEngine 3

This will create a new Multi/Sub-Object Material with 10 material slots. For our object we only need two materials so click on "Set Number" and select 2 in the "Number of Materials" tab. The first material ID will be the proxy material that is used for the collision geometry, the second material will be used for the texture of the model itself. Name the first submaterial "proxy" and the second submaterial "colormap". Make sure to give the material itself a name, in our case we will call it "separator". Everything besides the name of the material is not mandatory for the engine but I always name my files correctly from the start so that its easier for me to make changes later on or for other people to work with my files.
getting started with CryEngine 3

Let´s go ahead and set the material attributes for the collision geometry first. Enter the first ID of your Multi/Sub-Object and set the following attributes:

- Change the Shader from "Blinn" to "Crytek Shader".
- Activate Physicalize in the Physicalization tab and set it to Physical Proxy (NoDraw). This makes sure that your collision mesh is used exclusively for collision detection   and is not rendered. More info on the settings of physicalized materials can be found here
- Set the opacity to 50 and give it a red color.
- Click the "Show Standard Map in Viewport" button to make the material display in your Max viewport.
- Name your submaterial "proxy"
getting started with CryEngine 3

To load the diffuse map, go to submaterial ID#2 in your Multi/Sub-object and set the following attributes:

- Change the Shader from "Blinn" to "Crytek Shader"
- Load the diffuse map into the "Diffuse Color" Slot by selecting the "separators_DIFF.tif" file in "X:\CryEngine 3 SDK\Game\Objects\myfirstobject\"
- Click the "Show Standard Map in Viewport" button to make the material display in your Max viewport.
- Name your submaterial "colormap"
getting started with CryEngine 3

Go to your max viewport next and assign the created material to your imported object. Convert the imported object into an "Editable Poly" Object and assign material ID#2 to all visible polygons. The object should now be displayed with a texture in the viewport. getting started with CryEngine 3

2.5 Exporting the material to sandbox

If you haven´t saved your scene yet, save it in "X:\Your SDK Folder\Game\Objects\myfirstobject\separator.max". Proceed with the following steps:
- Select the material in the material editor
- Go to the "Utilities" tab and select "CryENGINE3 Exporter".
- In the Material tab, select "Create Material"
getting started with CryEngine 3
- Wait for CryEngine to start and login (If you get an error message read this)
- The material editor will pop up. In the dialog, save your material as "separator.mtl" in "X:\Your SDK Folder\Game\Objects\myfirstobject\"
getting started with CryEngine 3
- Your separator.mtl material file has now been created. We will adjust it later when the mesh has been exported.

2.6 Creating physics geometry

In order for your mesh to have collision, you will need to create collision geometry for it. Go ahead and create a box and an 8 sided cylinder.

- Assign the "separator" material that we´ve just created to those two objects and give all of the faces material ID#1.
- Make sure that all faces of your physics geometry use only one smoothing group.
- Move the box and the cylinder on top of your object and make sure they encapsulate the mesh. Make sure the geometry is as simple as possible since it will be used     to calculate collision
getting started with CryEngine 3
- Name the box "$physics_proxy_01" and the cylinder "$physics_proxy_02". The number at the end does not matter as long as both have a unique name starting with     "$physics_proxy_"
- Open the Object Properties of the box. To do this, select it in the viewport, right click and choose "Object Properties..." In the object properties, go to user defined and   enter "box". Do the same for the cylinder but enter "cylinder" instead of "box"
getting started with CryEngine 3
- You can assign various different user defined object properties to physics geometry. Adding "box" and "cylinder" is telling the engine that we are using physics
   primitives instead of custom physics geometry which makes calculation the collision a lot cheaper. An overview can be found here

2.7 Object hierarchy

Go ahead and create a dummy helper by selecting it from the menu. Move it to the base of your object (In our scene 0,0,0). After you have created the helper, do not scale or rotate it at all. getting started with CryEngine 3

Proceed with the following steps:

- Name the dummy helper "separator". This name will be the name of your model in Sandbox.
- Select all objects in your scene and reset x-form on them (except the dummy helper)
- Call the rendergeometry separator_rendermesh and link it as child to the dummy helper.
- Link your physics geometry objects as children to the rendermesh.
- Set all of the pivots of your objects to the location of your dummy helper.

Here is what the setup looks like in the Outliner (I highly recommend getting that plugin for max here) and in the scene explorer
getting started with CryEngine 3


2.8 Exporting the geometry to sandbox

Proceed with the following steps:

- Select only the dummy helper, go to your "Utilities" tab and open the "CryENGINE3 Exporter".
- Add the dummy to the exporter list by clicking "Add Selected"
- Make sure that "Export File per Node" is turned on and "Merge All Nodes" is turned off.
- Click "Export Nodes".

The resource compiler will now create a cgf file from your selected node and display any errors that appeared in the process. If you have set up everything correctly, the window will close again immediately without any error messages. Here is a list with possible error messages and how to fix them. getting started with CryEngine 3

3. Finishing touches in CryEngine

Load the 64-bit version of the Editor and open the forest level by loading the "Forest.cry" file.

3.1 Adding the mesh to the level

- In the "Objects" tab of your Rollup Bar, selet "Brush" and select the separator.cgf file.
- In case you have had the editor open before adding your mtl or cgf file to the objects folder, make sure to press the reload button for the folder to show up.
- Drag and drop it into the viewport. By holding ctrl+shift and left clicking on a surface it will automatically align the object to the underlying physics geometry.
- If you want to check or debug your physics geometry, open the console and enable "p_draw helpers 1". Follow this guide for more information on the topic getting started with CryEngine 3

3.2 Material setup

Once your object is placed in the level, open the material editor by pressing "m" on the keyboard.

- With your object still selected, press the "Get Item from Selected Object" button. The material editor will now select your separator.mtl file. If it doesn´t,
  assign it to it manually by selecting the seperator.mtl material file, the object in the viewport and clicking the "Assign Items to Selected Objects" button.
- Select submaterial ID "[2] colormap"
- In the "Texture Maps" column, load in the specular, normal and detail bumpmap. You can find various detail bumpmaps in "Game\textures\detail\..."
- Enable "Glow in diffuse alpha" and "Detail bump mapping" in the "Shader Generation Params"
- Set the Detail bump scale to "1". Since we are using a texture with a resolution of 256x512, set "Detail tiling U" to 1 and "Detail tiling V" to 2.
- In the lighting settings, Set the "Diffuse Color" to 128,128,128, "Specular Color" to 171,166,187, Glossiness to 60 and "Glow Amount" to 3. Since we enabled "Glow in   Diffuse alpha" the shader will use the alpha map in the diffuse texture to mask the glow effect on the surface.
- In the "Material Settings" change the "Surface Type" to metal. Do this for submaterial id "[1] proxy" as well.
- Feel free to play around with the shader settings and see how they change the look of the object.
- In case you run into any problems, feel free to download the final object with material file and cgf here getting started with CryEngine 3

getting started with CryEngine 3


-back-