This site is not endorsed by or affiliated with Crytek or Electronic Arts. Trademarks are the property of their respective owners. Game content copyright Crytek.

Asset Creation Manual

this is a rewrite / adaption of the original Asset Creation Manual for CryENGINE®2 which used to live at:
crymod.com/AssetCreation
you can see the archived version here: Asset Creation Manual

Index

Getting Started

Installing the 3ds Max Exporter

backtoIndex

The tool installation process should take care of an automatic installation. However, if for some reason the plugin needs to be installed manually, follow the instructions below.

Plugin files

Installing the SOFTIMAGE|XSI Exporter

backtoIndex
Introduction

The CryExporter is a XSI Addon, which not only contains the Export functionality, but also provides custom objects and a custom shader to make maximum use of the CryENGINE®2 features. The CryExporter prepares assets created in Softimage XSI for the CryENGINE® 2 Resource Compiler (RC). The assets are stored in the Collada format and within the RC converted to the final game asset.

Installation

Requirements- In order to work with the CryExporter, you need the following software installed and working:

You also need the Crytek_XSI_vX.X.zip archive. This archive contains:

Installation procedure

Installing the CryTIF Plugin

backtoIndex
Installation on a 32 - Bit OS

The installer does take care of the correct plugin setup. However, if for some reason you need to install manually, follow the instructions below:

  1. Copy the files below into the Photoshop root directory:
    Bin32\ zlib1.dll
    Bin32\ jpeg62.dll,
    Bin32\ libtiff3.dll
  2. Copy the file Tools\CryTIFPlugin.8bi into the folder \Plugins
  3. Inside Photoshop, you can modify the path to the RC by choosing
    Help\About Plugins\CryTIFPlugin.

This will show the options menu for the ResourceCompiler. There you can set the correct root path to your CryENGINE®2 installation.

Installation on a 64 - Bit OS

not available

Copyright © 2008 Crytek GmbH, All rights reserved


General Info

Creating Objects in 3dsMax and exporting them

backtoIndex

Overview

In this tutorial you will create a simple object and export it as a CGF from 3d Studio MAX.

This tutorial assumes the user understands the basics of 3d Studio MAX, such as the user interface and the creation of simple geometry.

Preparing your object

Folder structure

All objects/folders containing objects must be placed under the root game folder, under the Game\Objects folder. For this tutorial, I'll create my example object in Game\Objects\Testbox. Objects placed outside the Game folder won't work in the engine.

The Object

For this tutorial, create a simple box in max, a metre or two (3-6 feet) in each dimension. As the Sandbox uses the metric system for measuring distances, you may wish to use centimetres in MAX too.

Creating a material for the object

To use textures and shader effects your object needs a material. Materials are stored in MTL-files. In this tutorial we'll create a material in MAX and transfer that information into an MTL file, where it can be edited later on with the Sandbox's material editor.

  1. Open the material editor in 3ds Studio Max
  2. Select a fresh material, click on the "Standard" slot and change the material type to "Multi/Sub-Object"
  3. Set the submaterial count to 3.
    The engine supports up to 32 submaterials. The more submaterials the object uses, the more drawcalls it uses, reducing performance. Therefore it's best to find ways to keep the submaterial count as low as possible.
  4. Give the material and all submaterials 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 MAX must be same as the name of the actual material file. We name the Material "Testbox" and will create a Material file later with the name "Testbox.mtl"
  5. Open each submaterial and in the "Shader Basic Parameters" rollout change the shader type to "Crytek Shader". You should only use Crytek Shader for your objects. The other shader types will not work correctly when exported. If you have troubles here, please check that your plugins are all installed correctly.

    You'll notice a new dropdown list under "Physicalization". This list contains presets for the way the material acts in the engine. For now, we only worry about two of these; Default and Physical Proxy.
    Default is a normal material. You'll use this for most of your materials. It does nothing special.
    Physical Proxy is a special material you want to use for physicalized geometry. It collides with physicalized geometry but isn't rendered, meaning it's invisible.
  6. The third submaterial should be a "physics proxy" (explained later). Go to this submaterial and change the physicalization type to "Physical Proxy (NoDraw)".

    Click on the "Physicalize" checkbox next to the rollout. This will physicalize the material in the engine. If this box is not checked, your object will not be physicalized, meaning it will not physically interact with anything in the gameworld.


    Should your object have a separate physics proxy, the rendered geometry should not be phyisicalised
  7. We need to assign a texture to each submaterial except for the physics proxy submaterial, which will be invisible and is only used for collision.

    Go to the first submaterial and under Maps rollout change the Diffuse Color Map to "Bitmap".

    Search for the texture you want to use. You can use the textures that you created in the texture creation tutorial. All textures (except for Flash textures) should be either CryENGINE® TIF format or DDS format.

    Now, select a bitmap for Bump Normals Map. Be sure to pick one with a "_DDN" suffix, other textures won't work as normalmaps. This will be your normalmap. Using normalmaps is, of course, optional.

    Repeat these steps for the second submaterial. Choose different textures.
Assigning a material to the object
  1. Assign your multimaterial to the object.
  2. change the material ID of some polygons to 1 and some polygons to 2. Make sure the object does not have material IDs beyond the number of submaterials the multimaterial has. They will appear as "Replace Me" textures if present.
Creating a physics proxy

Complex objects with many polygons should normally use a secondary mesh called physics proxy. Physicalised objects in the game world can collide with each other and the more polygons those objects have the more intensive the physics calculations will be. Therefore you want the physics proxy to have as few polygons as possible.

Complicated proxies may also result in abnormal behaviour during collisions. This proxy is also used for player collision.

Physics proxies should always be "closed" meshes, and should not have open edges. Open edges can cause various problems with physical interaction and may also cause performance slowdowns so avoid them when you can.

  1. Make a copy of the box mesh in element level
  2. Assign the "Proxy" sub-material ID to it. It will now act as a physics proxy.
Creating a material file
  1. Open the CryENGINE®2 Exporter Utility. It's a good idea to add a button for the exporter to the utility button list if you're going to use it a lot.
  2. In the bottom of the utility window you'll find "Material" rollout.

    Make sure you're currently in the parent level of your material in MAX. This means that you should not be viewing any of the submaterials, just the parent multimaterial. If you're in any of the submaterials while creating the MTL file, the file will contain only that submaterial, nothing more.
  3. Click on the "Create Material" button. This will open up the Sandbox material editor window. Now, Click on the "Create Material" button in MAX again. You will be asked to enter a filename for the new MTL file. Make sure this name is the same as the name of the material in MAX.

    Click "Save" when done.
  4. Your material is now generated. You can expand the parent, revealing the submaterials. All the textures you chose in MAX are used by the material here. The details on the material editor are covered in a different img.
    Close the material editor window.
Exporting from max
  1. In the Object Export section select your object and click on the "Add Selected" button under the empty list. You may select multiple objects at once.
  2. Click on the blue "Export Nodes" button. This will export your object. It will be generated in the same folder where the MAX file is. You can view this folder by clicking the "Explore..." button.

    Your object will have the same name as the Max-file's name (Testbox.cgf). You can name your object something else by checking "Export File per Node" checkbox under Geometry Export Options and giving the object a different name.
Viewing the object in Sandbox
  1. Start Sandbox and load a level.
  2. Click on the "Brush" button on the toolbar on the right.
  3. Locate your object.
  4. Drag and drop the object into the level.
Additional Information

Fetching/assigning materials

You can view the object's material by opening the material editor (press "M" or click the icon on the toolbar that looks like a blue circle, or use the View menu).

Click on the 3rd button from left on the top of the material editor window, the one with a cyan box. This will fetch the material of the selected object.

You can assign any materials to your object by selecting the material (always select the parent, not a submaterial) and clicking the leftmost button in the material editor toolbar ("Assign material to selection").

Enabling shadows

You may want to enable shadows for the brush. Click the "CastShadowMaps" checkbox in the brush properties.

Testing your object ingame

You can go into gamemode by pressing SHIFT+G when using the perspective viewport, or by using the Game menu.

If you pressed the "Physicalize" button in max on the proxy material (and assuming you created a proxy, though you may of course physicalize any material you want), you and any other characters/physicalized rigidbodies will collide with the object.

The "Reload" button in the brush parameters can be used for reloading the CGF file. This way you can make changes to it in MAX, export it, and quickly see the effects in the editor.

Note: you'll find that the physicalized geometry does not update (if it was changed) after clicking "Reload" button. You can get around this by deleting the object and using Undo (CTRL+Z or undo button). The physicalized geometry is also automatically updated when the level is loaded again.

Console command P_Draw_Helpers 1 will display physicalized geometry. Setting this to 0 will disable this view.

Console command E_Debug_Draw 1 (and other numbers, beyond 10) will display various kinds of useful information about the objects in view, such as polygon count, number of materials etc.

Copyright © 2008 Crytek GmbH, All rights reserved


Using the SOFTIMAGE|XSI Exporter

backtoIndex
Introduction

The CryExporter is a XSI Addon, which not only contains the Export functionality, but also provides custom objects and a custom shader to make maximum use of the CryENGINE®2 features. The CryExporter prepares assets created in Softimage XSI for the CryENGINE® 2 Resource Compiler (RC). The assets are stored in the Collada format and within the RC converted to the final game asset.

Concept

UI

Crytek Menu

After the installation of the Crytek Addon, you will find the Crytek menu in the XSI menu bar.

Crytek Toolbar

The Crytek Toolbar gives you quicker access to all functions of the Crytek Menu. You can place it wherever you like.

Nodes
CryExportNode

After creating a CryExportNode model, you are asked in the CryExportNodeProperties window to specify a name for the final asset. The name will be added to the beginning of the CryexportNode name. i.e. motocycle_CryExportNode.

You can choose the type of asset, i.e. .cgf, .cga or .chr file (refer to CryExport for more details). Additionally you can choose whether this particular asset should be exported during when using the Export all command. Check merge, if the asset has no functionality and is composed of many separate geometry nodes. The exporter will automatically remove the hierarchy and compress the data for the target asset. The values are stored in custom properties called ExportProperties . You can easily access them from the Explorer.

CryJointNode

This node is a box shaped null helper which serves as a joint in your object. The Default name is CryJointNode . Link it to the CryExportNode model.

The joint needs to be placed between two geometry nodes, so that its bounding box is intersecting with the bounding box of the two objects it should keep together. The null has a text property in which you can adjust the physical parameters for the joint, i.e. limit=10000

Joint parameters:

limit
this is a combined parameter from different joint parameters (bend, twist, shift...). A limit of 1000 is a good starting point.
CryObjectProperty

Use this function to add a custom text field to a geometry node. It enables you to add engine properties to a node, like mass/density, LowSpec Settings, etc.

CryObjectProperty settings

Mass
defines the mass in kilograms; do not use together withg density; i.e. mass=50
Density
defines the density of the material, the mass will be calculated based on the volume of the bounding box, i.e density=2
Joint Parameters (see CryJointNode) * Pieces
defines the pieces that are spawned (and replaces the original object) when a physical impulse on a joint exceeds its limits, i.e. pieces=_wall01_piece01,_wall01_piece02,_wall01_part
LowSpecLod0
use this on the lod you want to use as the base lod on a lowspec machine, i.e in the properties of a Lod1 or Lod2
Entity
turns a piece into an entity, which the player can interact with. The
Count
spawns the piece x-times, i.e. count=50 spawns 50 pieces within the volume of the intact object

NOTE: Either use Mass or Density, not both together.

CryShader

The most important info the Cryshader stores within XSI is the physics parameters of polygons the shader is assigned to.

To assign a CryShader to an object, select it use Create CryShader for selections . This creates a new material without Physics settings (NoPhysics). If you want to assign cryshader to single polygons, you need to create a cluster before you can assign a new Cryshader to them.

Second you can select existing materials in the Explorer and use Convert selected materials to Cryshader . As the name suggest, selected materials are converted to the CryShader format.

The plugin automatically adds prefix numbers to the materials to keep the order of the materials consistent. CryENGINE®2 applies the materials in the order of the .mtl file this order will not change creating the .mtl file (CryENGINE®2 Material file).

If you convert an existing set of materials to the Cryshader, make sure there are no other unused Cryshader materials in the same library. This would interfere with the numbering process. Collect all materials of one asset in a Material library and rename it. The name will be used to create an mtl file, or to connect the asset with an existing .mtl.

Physics Parameters:

NoPhysics
Default Value, the polygons are not physicalized
Physics
the polygons are physicalized to block the player and vehicles and can get a shader assigned, i.e a tree trunk
Physics (NoDraw)
the polygons are physicalized to block the player and vehicles but are invisible and can not get a shader assigned
No Collide
use this for very simple proxies that do not block the player, but are used for detecting bullet shots. The calculation will then detect the render mesh below.
Obstruct
the polygons are physicalized in order to block the AI view; player, AI and vehicles can pass through, i.e. used for vegetation cover objects
CryExport

Once ready to export, the artist can open the following UI via the Crytek menu or toolbar:

All the asset and their corresponding Crytek compiler out filename and file type are listed in the CryExportNodes list. If you want to export only some assets of the scene, you can select the assets in the list and use Export Subset . The specified "_Subset.dae" COLLADA file will be exported.

Export All creates a COLLADA file with the name you specify, containing all the assets from the scene. The RC will then create separate files in the target format.

The CryExport exporter takes into account every asset individual property and will only export the required elements for that particular asset/file type in the intermediate COLLADA file.

You can also access a shortcut to the Export All function through the Crytek Menu. This save some time during the testing and learning phase.

Here's what gets exported for the possible file types:

CGF : Triangulated mesh geometry, hierarchy, material and image

CryExport Materials

Similar to the CryExport function, this window let's you select the available material libraries and export them to the export folder. This is useful to create an initial version of the material. The fine tuning needs to happen in the Sandbox Material Editor anyway.

You can choose between exporting the selected materials in the list or exporting all the materials at once.

You also have a shortcut to create a material file for all the available Material libraries.

Here's what gets exported for the possible file types:

MTL : material file, taking into account the diffuse colours and texture paths. They will be created relative to the Game folder.

Others

Diagnostic

Diagnostic is a validation process, which checks settings and properties for the selected assets. It checks for valid filenames, proper material and material library names, whether pieces are available, etc.

CryProperties

Here you need to set the properties of export process:

The properties are saved in the XSICryExport preferences.
(/XSICryExport.xsipref)

Special Nodes

Occlusion objects These are simple geometry objects which are placed inside non see through walls to indicate the renderer that everything behind it does not need to be rendered. This is helpful in busy scenes to ensure high render performance. The name of the geometry object needs to start with "_occlusion". Link it to the geometry object which serves as the "visual barrier" in the game.

You can check them with various console commands:

Pieces for breakable objects Pieces geometry nodes can be placed anywhere in the hierarchy. They can be named to your liking, but need an underscore as the first character. i.e. _piece01, _wall01_part01, _blah

Branches The branches nulls are needed for the setup of bending vegetation leafs. The nulls are used as joint in the engine, through which the physics engine interpolates a rope spline, with which the player can interact. The branches have a special and strict naming convention: branch#_# i.e branch01_01, branch01_02, branch02_01, branch02_02, branch02_03

The system is unconventional, but very efficient. The bounding boxes of the branch nulls needs to enclose vertices which are influenced by the spline. Ideally you choose the vertices lying in the center line of a branch (it works especially well for trees with large leafs, like palm trees). The engine then makes a lookup in the UV coordinates and checks for all vertices, which have connected UVs. All the connected vertices are taken into account when the physics calculates the deformation. The cool thing about it is, that you do not need to create weighting on the vertices and you only need to set up one (!) leaf and all other instances in the asset will automatically work, if they share the same UV coordinates. You can even deform the other leaves and still have the effect applied.

LODs You can make use of the Level of detail functionality of CryENGINE® 2 by linking the LODs to the Base object, add an UNDERSCORE to the name and number themaccordingly. The rule of thumb is to reduce the polycount for every LOD step by 50%. If you only remove 20% of the polygons, the LOD will not load for being insufficient. There is a exception, though. If you use less different materials than on the previous LOD level, the LOD will still work, even if there are not 50% of the polygons saved.

You can also add a postfix with the name of the LOD0 (in this case "sphere") to the name of the LODs, i.e. _lod1_sphere or _lod2_justforfun. Important are only the first 5 characters.

Copyright © 2008 Crytek GmbH, All rights reserved


Material Setup

backtoIndex

To use a model in the engine you always need a mtl file to specifie textures and shader settings.

This mtl file need to be created out of max and can be modified later in the engine.

Sample Files

sample max file: bushes.max

sample mtl file: bush_small_leaf.mtl

sample cgf file: bush_small_leaf.cgf

Setup in 3d applications

To get the mtl file press this button in your export dialog while your material is selected:

You will get an mtl file in the same directory as your max file.

Its very important that the name of the mtl file is the same as the name of the material in MAX. If this is not the case Sandbox can not find the mtl!

Setup in Editor

In the Editor you can open your mtl Editor by pressing "m"

Sample picture of Material Editor

All functions are selfexplaining (mouseover comments)

For more information about The single material slots read Vegetation Shader Settings

Copyright © 2008 Crytek GmbH, All rights reserved


Exporting and Importing Animations

backtoIndex
Overview

In this document we will explain the various types of animation data available in CryENGINE® 2, as well as a few tutorials on how to create your own.

Animation File Types
CGA - Crytek Geometry Animation

CGA files are created by exporting one or more objects which have been animated in a 3d package such as 3dsMAX. When exported, the file stores both the object(s) and a default animation bundled together. These objects do not require any hierarchy or bones with weights assigned to control the mesh.

General Rules

ANM - CGA Animation File

ANM files are animations used specifically with CGA objects. They need to be contained in the same folder as the CGA object they were exported from and require a specific naming convention to work with them. Each additional ANM file added needs to contain the parent CGA's name as a prefix. For example -

Vehicle_b.cga - Vehicle object(s) and default animation. Vehicle_b_door1_exit .anm - Animation keys stored for the door open animation when a character exits the vehicle. Vehicle_b_door1_enter.anm - Animation keys stored for the door open animation when a character enters the vehicle. Vehicle_b_door2_exit.anm etc.

CAF - Crytek Animation File

CAF files store skeletal animation data used together with CHR files and are intended to be used with assets that require a hierarchy of bones and a skinned/weighted mesh. CHR files store the mesh and skeleton, whereas CAF files store the keys that this skeleton uses to animate with.

FSQ - Facial Sequence

FSQ files are created directly in the facial editor and store data related to facial sequences created there. They can also store audio references, lip sync text and even camera paths which have been imported using GRP files containing sequence data created in Track View (a cinematic for example).

Creating a CGA Object

Preparing an Example Scene

In your 3d application, create a few primitives in the scene.

Change the controller types for position and rotation to TCB.

Create an animation for the objects in the scene.

Exporting the Asset

Next, select all the objects and add them to the Object Export list by clicking add selected.

The "Export File per Node" option, located just below the Export Nodes button in the group "Geometry Export Options" allows you to either bundle these 3 objects together in one CGA file or, when the option is checked on, will export 3 files separately. For now uncheck this option so we only have one file exported.

Next make sure that the CGA file type is selected in the Export To drop down box.

Next press the Export Nodes button. This will export the objects to the same folder that the source file is located in (which should be located somewhere in your game directory).

The file will assume the source file's name unless you uncheck "Export File per Node" and check "Custom Filename". This will allow you to select a unique name for the file by pressing the 3 dots (...) and typing in the name. This is not available for exporting multiple objects at once using the "export file per node option" however.

Previewing the Asset

To view the asset you need to open your CryENGINE® 2 Editor. At the top right of the screen you will see a green icon of a human. This opens the Character Editor.

At the top left of the floating window is the file drop down menu. Click File>Open and navigate to the folder you exported your cga file to. After opening the file you should see the object(s) in the 3d view.

Each CGA file contains a default animation which is available from the animation list. Click the name "Default" to play the animation.

Exporting an ANM File

If you have an existing CGA file which you wish to add animations to, or have just completed the example above, this section will explain how to add those additional animations.

Start by creating a second additional animation for your object within your 3d package.

Navigate to the object export section of the exporter and click "Custom Filename".

Click the button below with 3 dots (...) and type in a filename, using the name of the cga object you are adding it to as a prefix in the name.

For example test.cga contains the object you are animating, plus the default animation. In this case you need to name your anm file test_?.anm where the question mark is what you want to call the additional animation.

Press the export nodes button. If the ANM file is located in the same folder as the CGA object, the animation will now be visible in the Character Editor animation list.

Preview the object using the guidelines in the CGA export tutorial above.

Exporting a CAF File
Preparing an Example Scene

A CAF file is a skeletal based animation file that requires a mesh with bones and a weighting modifier applied.

First create a mesh, a skeleton to deform that mesh and apply weights to it with a modifier such as Skin or Physique. Image shows basic mesh and underlying skeleton

Now create an animation for the skeleton - make sure you store your default pose either as a keyed pose at frame 0 or using functions like Set Skin Pose in 3dsMAX for example.

Exporting a Fullbody Animation

Once this is done you are ready to export an animation. You can either export the entire skeleton or a part of the skeleton by selecting different bones as the root(s) to export from. We'll first start by exporting a full body animation.

Make sure Add related bones and Add whole skeleton boxes are checked on. These functions check for the root of the character and automatically add it to the Bones export list. Select the mesh of your object and click Add Selected in the Object Export section of the exporter.

After doing this you will see the root of your hierarchy automatically added to the Export Bones list. This list only needs to store the root(s) of the chain of bones you wish to export.

Scroll down to the Bone Export area of the exporter. Notice the root bone is listed in the bone export list. Press the Export Bones button and choose a location for the animation. This should be within a path in your game folder so that the animation will successfully pass through the resource compiler. This will make sure that any compression settings you define in the CBA file (Crytek Batch Animation) used for batch processing files.

Exporting an Upperbody Animation

Exporting an upperbody animation is much the same as exporting a fullbody animation. You need to select a root of a hierarchy in the skeleton and add that to the Export Bones list manually.

Select the Bip01 Spine bone; click Clear List in the Bone Export options and then Add Selected. This will add the bone "Bip01 Spine" to the node list. You are now ready to export the animation from the Bip01 Spine bone and all of its children in the hierarchy.

Once exported, the animation will only contain the tracks for the Spine and its descendants.

Previewing the Animation

In order to preview the animation you will need to add it to a CAL file (Crytek Animation List). This simple text file defines the animations that your character will use and their location. Below is a basic example.

#filepath animations\human\male=

$Include objects\characters\human\ondemand.cal=

//-------COMBAT------- combat_idle_nw_01 combat\combat_idle_nw_01.caf=

The #filepath command points this particular file to a folder used only for male animations.

The $Include allows your character to read from multiple cal files. In this example we separated the cinematic animations in a list that is only loaded on demand (so these animations are loaded and unloaded from memory.

// simply defines a comment.

The last line is defining the name of the animation and its location in a subfolder of "animations\human\male" called combat. The name given on the left is what will be seen in the editor and does not have to match the actual animation's file name.

For the SDK character we added this example cal file.

#filepath animations\human\male=

run combat\run.caf=

Create an example that is similar to the above and replace the name with the name of the animation you created. The cal file must be located in the same folder as your character and have the same name as this CHR file, except with the cal file extension.

When starting the editor using the above example the animation list will display one animation called run or if you replaced the names should show the name you gave the animation. Click to play it.

Previewing an Upperbody Animation

Repeat the steps above by adding the upperbody animation to the CAL file. Once this is added to the list, start the Editor and open the Character Editor.

Start by first clicking on the fullbody animation in the animation list. You will see the animation looping in the 3d view. Below the Choose Base Character button you will see a dropdown box defining which layer is currently playing.

It should say "Primary". If not, press the "Stop All" button, select the primary layer and start the animation again.

Next, select the Secondary.1 layer and click on the upperbody animation you exported earlier in the animation list. This will begin to play the animation using the tracks that were exported from the Spine down through its hierarchy. You should still see the legs moving in the same way as the fullbody animation, with the upperbody completely overwritten by the second animation.

Creating a FSQ

This section is detailed in the Facial Editor documentation.

Copyright © 2008 Crytek GmbH, All rights reserved


Physics Proxy Setup

Physics proxies are setup in the 3d application exclusively - the only setup needed in Sandbox Editor is the surface_type.

General Setup in 3d applications

backtoIndex
3dsmax

The physik proxy is a super simple version of your render geometry. In Max you need to assign a separate material ID for the proxy and aslo make sure that all faces of your proxy have one smoothing group. According to the separate material ID you also need to create an extra submaterial for your proxy. This is physiklaized as physical Proxy in your crytek shader settings in 3DS max Material editor. The physik can only be changed here and not later in the editor. if you want to change the physic settings you need to reexport your object. The Physic Proxy is not allowed to have open edges. Open Edges can confuse the physic engine and have a negative affect on the performance. Its helpful to give assign an extreme color to the proxy to keep the overview.

Example picture

Node Properties

Normally, special Node properties are not needed. The engine will automatically try to replace mesh physics proxies with parametric primitives, by comparing the proxy with some basic shapes and approximating the possible primitive within some calculative limits. The shape is created around the general bounding box of the geometry and uses the original pivot point to attempt to rotate the primitive to match the geometry as best as possible. Using primitives saves a lot of calculation time on collision tests (1 face = 1 primitve). It is therefore important to use primitives as much as possible.

By explicitly tagging the proxies with a certain value (see list below) in the Node Properties, the engine extends the limits and replaces the proxy geometry with the named primitive.

Level of detail settings

proxies are only created for the LOD 0 - every succesive LOD step will take the proxy from the LOD0. same happens if different quality settings are used (Lowspec).

Complexity

The physics proxies of environmental object (fences, crates, containers, trees, rocks, ladders, stairs, etc) should be VERY SIMPLE.

The simplicity of the physics proxy is important for reducing redundant memory and physics calculations, but also for making the player movement smoother. The more complicated a proxy is, the more memory it takes, the more performance is lost on checking collisions against it's polygons and the more likely it is that the high frequency details will cause the player to get stuck or bounce undesirably against it. This affects both singleplayer and multiplayer, including the performance of a dedicated server. An ideal proxy is always a primitive (i.e. a box, a sphere, a capsule, or a cylinder). The engine recognizes primitives from meshes, but the default tolerance is very low; in order to force the recognition put the corresponding keyword ("box", "sphere", etc) into the node's user defined properties. Note, however, that meshes with several surface types cannot be turned into primitives. Primitives should be considered as an option even for more complex objects. In most cases it's preferable to have a multipart object (i.e. "merge nodes" off) with primitive parts instead of a single part mesh object.

It is used for character movement and first pass tracing of projectiles (bullets and decals). The projectiles and decals are refined using the render mesh if a hit was detected against the phys proxy. The render mesh should be fully encapsulated by the physics proxy, so that player camera does not intersect the render geometry and first pass projectile culling does not miss the physical part of the object even though it hits the visual part of the object. There is also support for creating a special raytrace proxy that will be used for raytracing, if provided (they should be physicalized as "nocollide"). That would then allow the main proxy to not have to encapsulate the render mesh and thus be even simpler.

For example, simple object like crates and fences can mostly be approximated with a simple block, 6 sides, 12 triangles. The top of stairs should be simple ramps, 2 triangles. More organic or irregularly shaped objects like rocks and trees can still be approximated with a fairly simple hull by allowing slight and acceptable inaccuracies between the render mesh and the physical proxy.

Please talk to DM for further details.

Linking Objects to simplify export

Physics proxies can be part of the render object (in 3dsMax as an Element) or as a separate object, linked to the render object.

Setup in Sandbox

In Sandbox you need to assign a surfacetype to your physik proxy in the material editor, as well as to your render geometry. The surfacetype gives information about sound and particle effect of your surface. You also need to assign a NoDraw shader in the material editor. Also make sure that no textures are assigned to you proxy sub material. The Physic Proxy will never be rendered in the engine without debug view. even if you assign an illum shader it will stay invisible. To reload the physic proxy you need to reload your object, delte it and undo delte.

Debugging

p_draw_helpers 1 shows the physics geometry. Parametric primitives are shown in a different rendering style.

Example picture without debug

Example picture with debug

Copyright © 2008 Crytek GmbH, All rights reserved


Mass & Density Setup for assets used as Entities

Below is the technical instruction from Anton:

Physical properties

Mass, Density

It is possible to specify either density or mass. If you specify one, set the other to a negative value (-1, or -0.01). Mass and density affect the way objects interact with other objects and float in the water (they sink if their density is more than that of the water). A zero-mass rigid body (with both mass and density 0) is a special case which means an "animated" rigid body (moved from outside the physics system). The difference from a static entity is that the physics will be aware that this object is actually dynamic, although it cannot simulate it directly. Note that both values describe the same physical property. When you specify mass, density will be computed automatically and vice versa. The relationship mass = density x volume is used. These computations imply that the object is solid; if you use a box to model an empty crate, you should assume that its density is a weighted average between wood density and inside air density. Here are some reference density values (in kg/m3):

max_time_step (0.005..0.1) Sets the maximum time step the entity is allowed to make (defaults to 0.01). Smaller time steps increase stability (can be required for long and thin objects, for instance), but are more expensive. Each time the physical world is requested to make a step, the objects that have their maxsteps smaller than the requested one slice the big step into smaller chunks and perform several substeps. If several objects are in contact, the smallest max_time_step is used;

damping (0..3) Sets the strength of the damping on an object's movement. Most objects can work with 0 damping; if an object has trouble coming to rest, try values like 0.2-0.3. Values of 0.5 and higher appear visually as overdamping. Note that when several objects are in contact, the highest damping is used for the entire group.

FixedDamping (true/false) When true, this object will force its damping to the entire colliding group (use it when you don't want a particular object being slowed by a highly damped entity, like a dead body).

sleep_speed (0.01..0.3) If the object's kinetic energy falls below some limit over several frames, the object is considered sleeping. This limit is proportional to the square of the sleep speed value. A sleep speed of 0.01 loosely corresponds to the object's center moving at a velocity of the order of 1 cm/s.

water_resistance (0..2000) Water resistance coefficient. If non-0, precise water resistance is calculated. Otherwise only water_damping (proportional to the submerged volume) is used to uniformely damp the movement. The former is somewhat slower, but not prohibitively, so it is advised to always set the water resistance. Although water resistance is not too visible on a general object, setting it to a suitable value will prevent very light objects from jumping in the water, and water flow will affect things more realistically. Note that water damping is used regardless of whether water resistance is 0, so it is better to set damping to 0 when resistance is turned on.

water_density (100..1000) This parameter could be used to specify that the object's physical geometry can leak. For instance, ground vehicles usually have quite large geometry volumes, but they are not waterproof, thus Archimedean force acting on them will be less than submerged_volume*1000 (with 1000 being the actual water density). Decreasing per-object effective water density will allow such objects to sink (as they would in reality) while still having large-volume physical geometry. Important note: if you are changing the default value (1000), it's highly recommended that you also change water_resistance in the same way (a rule of thumb might be to always keep them equal).

Some state-specific properties:

RigidBody (true/false) False means a static entity, true - a simulated rigid body. Note that a rigid body can still behave like a static entity if it has mass 0 (set either explicitly or by unchecking *RigidBodyActive*). The main difference between these rigid bodies and pure statics is that the physics system knows that they can be moved by some other means (such as the trackview) and expects them to do so. This means that objects that are supposed to be externally animated should be mass-0 rigid bodies in order to interact properly with pure physicalized entities.

Resting (true/false) The rigid body's initial state is sleeping. It'll need to be awoken by an external stimulus (bullet hit, explosion, collision, player interaction, etc) in order to start being simulated. BasicEntities have this flag on unconditionally.

CanBreakOthers (true/false) True if the entity can break jointed objects by colliding with them (provided they overcome the strength limit). BasicEntities have this flag off unconditionally.

Note that some of these properties can are only exposed in the RigidBodyEx entity.

Some properties, specific to the AnimObject entity:

Articulated (true/false) Physicalizes the character as an articulated physical entity (i.e., with bendable joints).

ActivatePhysicsThreshold (0..) Greater than 0 values are used for objects with pre-backed physical animations (requires Articulated to be on). Specifies the amount of force (in fractions of gravity) that needs to be exerted on a part for it to become detached and fully controlled by the physics.

ActivatePhysicsDist (0..) Used for objects with pre-baked physical animations (requires Articulated to be on and ActivatePhysicsThreshold to be greater than 0). Specifies the distance from the pivot after which parts automatically detach themselves from the animation and become fully physicalized. 0 disables distance-based detachment.

Addition: Dry static friction reference table

Copyright © 2008 Crytek GmbH, All rights reserved


Instancing Objects

backtoIndex

In order to save drawcalls, the engine combines identical elements of an object into one renderpass. It is mainly used on complex objects, which have a lot of separate internal parts, like fences or tanks, where a lot of similar objects are used or animated.

Sample File

Sample File: instancing_fence.max

General Setup in 3d applications

The elements of an object need to have the same vertex index, the same UVs, the same material.

elements can be translated, rotated and uniformally scaled

example picture of instanced elements fence (instances are blue)

General modelling workflow tips:
Setup in Sandbox

no special setup needed in Sandbox, just place your object as brush or simple entity.

Debugging

r_GeomInstancing 1/0 toggles the instancing on and off

Copyright © 2008 Crytek GmbH, All rights reserved


Occlusion proxy

backtoIndex

An Occlusion proxy is a simple geometry object which prevents objects behind from being rendered.

For example if the player stands in front of a big concrete wall with no holes inside, the engine does not need to render the objects behind the wall. This can reduce rendering time significantly and increase frames per second enormously.

Sample File

Sample File: occlusion.max

General Setup in 3d applications

A simple geometry object which represents the shape of the render geometry is created in the 3d application (i.e. a plane for the concrete wall). It must be named "$occlusion" and linked to the object it belongs to. In our example the wall piece. No special material setup is needed.

Important things to remember:

Occlusion polygons will be treated doublesided. A simple single sided plane in the 3d package might be a suffcient occluder for a non-see-through wall.

Keep the occluder as simple as possible, i.e. a singlesided plane for a complex wall.

Export

When linked correctly, the $occlusion proxy does not need to be added to the list window of the exporter.

"Merge all Nodes" needs to be unchecked in the exporter settings.

Setup in Sandbox

No special setup needed in Sandbox

Debugging

Copyright © 2008 Crytek GmbH, All rights reserved


Pickable Objects

Introduction

In CryENGINE® 2 objects can be turned into "pickables". The player can pick them up with one or two hands, carry them around and drop them again. The picking-behavior is dependent on the game script.

In the Crysis Game script, there are two types of picking behavior:

* One-handed
The player will pick up the object with his left hand and holds the object in this hand. The weapon in his right hand is still usable. If the player holds a two-handed weapon, the weapon will be switched to the fists.
* Two-handed
The Player will pick up and hold the object with both hands. The hands itself are not visible in the fist person view. No weapon is usable during that.
Requirements

A pickable object can be set up in a DCC-tool by having:

Basic Setup in a DCC-Tool

3D Studio Max

In order to define the object's position on the ingame-screen, a helper needs to be linked and aligned to the object. The presence of such a grab-helper in the object hierarchy turns the object into a pickable object.In Crysis, the pivot of this grab-helper is aligned to the "item_attachment"-bone, which is located in the skeleton of the frag grenade first-person animation.The orientation of this bone is: +X right, +Y front, +Z= up. In the one-handed pickup animation the "item_attachment"-bone position is in the left hand of the player. For a two-handed pickup the bone is located in the center between the player's hands.

Use the "Local" Coordinate system when adjusting the rotation of the grab-helper.

One-handed pickable objects

Example-File

pickable_onehanded.max

Example Hierarchy

Setting up the helper:
  1. Open your .max scene and create a "Dummy" helper. Name it " grab_onehanded_01 " (name needs to be correct!)
  2. Link the grab_onehanded_01 helper to you object.
  3. Align it to the object.

Proceed with export

Two-handed pickable objects

Example 1 File: pickable_twohanded.max

Example Hierarchy

Setting up the helper
  1. Open your max scene and create a "Dummy" helper. Name it "grab_twohanded_01" (name needs to be correct!)
  2. Link the grab_twohanded_01 helper to you object.
  3. Align it to the object. In Crysis the helper should be positioned below the object, so the player can see the object, since he can not see his own hands in two-handed mode.

Proceed with export

Pieces of Destroyable objects
Overview

When a destroyable entity is destroyed, it will spawn pieces as well as a remaining object. These objects can be set up as pickables too.

The process is equivalent to the one for one-handed and two-handed pickables, but the name of the object the helper is linked to needs to be added as a prefix in front of the helper name (e.g. remain_ grab_twohanded_01). A grab-helper for the non-destroyed version of the object ("main") does not need to have a prefix.

Example 2 File: pickable_destroyable.max

Example Hierarchy:

Basic Setup in Max:
  1. Open your max scene and create a "Dummy" helper for your object. Name it as described in the overview (e.g. remain_grab_twohanded_01 or piece_banana01_ grab_onehanded_01).
  2. Link the grab-helper to your object.
  3. Align it to the object.
    In most of the cases, the helper should be positioned below the object, so the player can see the object, since he can not see his own hands in two-handed mode.

    Note: The pivot of these spawned pieces/remain, that you can see in your DCC-tool, doesn't match necessarily the entity position in game. This means, that placing the helpers for these objects could require a bit more of "trial and error". It should be a good idea to use always the non-destroyed version of the object as reference to align your helper.
  4. Repeat step 1-3 for all pieces/remains that should be pickable.

Proceed with export

Using the pickable helper template file

Overview

During the Crysis development we developed an advanced technique to align one-handed grab-helpers to pickable objects in 3D Studio Max. We created a template file that contains the player's arms in the grab-pose that will be seen in the first person view of the game, and a camera that replicates the first person-camera of the game. It is also a grab helper included that is connected to a helper with a transformation-constraint. This makes it easier to rotate the whole template file and the grab-helper at the same time without unlinking the helper.

The key about this technique is to rotate the whole arms-template including the grab-helper, until the result looks as desired in the first person camera.

The disadvantage of this technique is that the scene might become complex, especially if more than one template is merged into the scene. Efficient layer usage will become helpful for this.

Pickable helper template file: pickable_template.max

Setup in 3D Studio Max:

Merge in the "pickable_template.max"-file. Select all the objects in the merge-window 1 Link the "grab_onehanded_01" helper to your object. 1 Adjust the position and rotation of the "pickable_template"-helper until you are satisfied with the position. The "grab_onehanded_01" helper is constrained to the "pickable_template", so it will inherit all transformation changes of the "pickable_template"-helper

Proceed with export

Example for a well aligned pickable helper template:

Export

Add the root node of your pickable object to the export list 1 Make sure "export by node" is checked and "merge all nodes" unchecked. 1 Click export.

Note: Everything linked to this object including all the sub-objects/helpers will be exported into one file.

Setup in Sandbox

In order to make your pickable object working in Sandbox, place it as a GeomEntity or any Entity which has set "Pickable" and "RigidBody" to "true". "Usable" has to be disabled. Pickable objects-types are:

Example-properties of a pickable entity:

Picking of animated non-AI characters

Overview

Non-AI-Characters can be set up to be pickable, too (Animals for example).

In this case we can not set up the grab-helper attachment in a DCC-tool but in the Character Editor.

The grab-helper will be will be added to the character as a bone attachment. So the orientation of the helper is dependent on the bone it will be attached to. You don't necessarily need to apply an object to the attachment, but for easier alignment it is recommended to use an object with a clearly visible orientation. The object will be removed from the attachment later on when the desired result is achieved.

Attachment Creation:

During the alignment:

After removing the Object path in notepad:

Notes

Changes on the pickability behaviour of AI-Characters and procedural breaking environment objects have to be modified in the game code. For AI-Characters, the name of the bone which serves as a grab helper needs to be defined by game code. The grab position of pickable procedural breaking environment pieces is located on an offset to its pivot, which needs to be defined by game code

Debugging

e_debug_draw 15 displays all grab_helpers

Copyright © 2008 Crytek GmbH, All rights reserved


Characters

backtoIndex

1st Person Characters

Overview

This document describes the whole process of creating a set of arms, an example weapon, basic animations, and how to export them to the engine. Up to now this is based on the workflow in Autodesk 3dsmax. Other packages will follow once the exporters are available.

The Arms Character
Geometry Handling

In this picture you can see an example mesh of a pair of arms which could be used for the 1st person arms of a character.

The local transformation of the mesh should be zeroed out for all axes. Also its pivot/center should always remain at the world center. (Position 0,0,0; Rotation 0,0,0)

Note:

Keep mesh/geometry at the world center with no rotation.

Arm Hierarchy

Below is the hierarchy which will be used to deform the arm's geometry. Note that the root, which is the top bone of the hierarchy, is also located at the world centre and has no rotations applied.

The three red coloured bones in the lower arms are twist helpers, and are used to help the deformation around the wrist. They have a simple expression applied to them which is connected to the hand's bones X- rotation.

Note:

Now is a good time to set a position and rotation key on all elements of the hierarchy at frame 0. This way you will always have the option to go back to the "initial Pose" of the character.

Here is the whole arm hierarchy in the schematic view.

The wrist helpers should be hidden after the envelope operator is applied, so that they won't accidentally be animated. This would cause the applied expressions to become ineffective.

There is no need to keep the hierarchy the same structure we used here. Also changing the way the wrists are solved is possible.

Weighting the Geometry

Note:

Always apply a "reset x-form" modifier and collapse it in the modifier stack, before you apply the envelope modifier. This removes unwanted transformations to the geometry, which could cause problems later on.

Which operator is used in max doesn't matter. You can either use Physique, or Skin to weight your model. Both are supported in the engine.

Info:

Whenever a vertex is influenced by more than two bones, the weighting on the ones with the weakest influence gets deleted and gets normalized between the remaining two bones.

In our example Skin is used to weight the arms to the bones. The modifier is applied at frame 0, which also defines the "default pose" which was keyed earlier. This also defines the default pose in the engine and helps in debugging problems later on in the process.

Only bones which are necessary to deform the mesh in a proper way were added to the bone list in the modifier.

Info:

Bones in the hierarchy which have an underscore at the beginning of their name won't be considered by the exporter. This keeps the size of the exported character low. In this case they were only left in the hierarchy to make the selection of links easier, when using the physique modifier.

Exporting the Character

Once you have finished weighting the character, you are ready to export the arms to the engine. If the plug-ins are installed correctly into your 3dsmax plug-ins folder, you should find the CryENGINE® exporter in the command panel under utilities. Select your arms geometry and hit the "Add selected" button in the "Object Export" section, if it's not already added automatically. In the "Bone Export" section it should automatically add the highest node of your hierarchy, "root" in this case.

Set the Drop-down-list in the "Object Export" section under "Export To" to "Character (*.chr), and click the "Export Nodes" button. This exports a compiled version of your object to the same folder your max-file has been saved to. If you want to specify a different name for your character (which is usually generated from the name of the max-file) you can specify one by activating the option below the "Export To" drop down list. Exporting is only possible to the same folder that the max-file resides in, or to a sub-folder from that one.

Now you can open the Character Editor under "view" in the editor...

...and load your character.

The big green arrow shows you the "forward direction" in the engine, which all characters should be facing to (Y+).

1st Person Weapon

The Weapon Geometry

Now that the arms model is ready, we can prepare a weapon to use with it. Here you can see a basic weapon model, with some elements highlighted in red.

Tip:

To make the weighting process more convenient, you can move away the parts which are meant to be animated later and should get their own bones, by a known amount of units or its multiples. Later after you applied your weighting modifier you can easily move them back to their original position by animating the bones they have been weighted to, the same amount you moved them apart from the main model earlier.

For the geometry the same rules apply like have been pointed out in the arms section. No translations should be applied to the geometry, and before applying the weighting modifier do a reset-x-form, and collapse it in the modifier stack, to get rid of unwanted transforms. The pivot should be aligned to the world coordinate center, and the model should point in the positive y-direction.

The Weapon Hierarchy

The same transformation rules should be kept for the bones you create for the weapon hierarchy, or at least to some of them which serve a specific purpose. In 3ds max it doesn't matter if bones or helpers (dummies) are used to define a hierarchy. The exporter treats them both as bones when they are exported.

All those names can be changed code wise of course; the names here are for demonstration purposes.

Weapon Term: used to attach the muzzle-flash effects to. Shells: used to attach the particle effect for the shells to. Collision: used for determining the position of impact when used as a melee weapon. Various attachment helpers, which are used to control the position of weapon parts. (attachment_top; attachment_side; attachment_bottom; etc)

Helpers or bones which don't influence elements or parts of the weapon geometry, won't need to be added to the deform modifier. Make sure they are added to the hierarchy before exporting the character, or they won't be accessible by the engine.

Note:

Before a deforming modifier is applied, merge in the arms character from its source max-file, and parent the highest node from the weapon rig under the root bone of the arms character.

Hint:

When using the Physique modifier chose the highest node in the hierarchy with which you want to deform your mesh upon initialisation.

Exporting the Weapon

After weighting is done, you can export your character to the engine. For this select the mesh of your weapon, go to the CryENGINE® rollout in the utilities pane of the command panel and add it to the node section. Switch to "Character" under "Export to..." and click the "Export Nodes" button. This exports your character into the same folder as the max file and inherits the name of your max file. You can also specify the name manually using the custom file name option.

In order to view your character in the Character Editor with the mesh skinned to the bones, you have to add them as a "skin attachment" by setting the choice to "skin" in the attachments properties, selecting the arms object, and then creating a "new" attachment. After you hit "Apply" the character is attached to the bones, and becomes visible in the editor.

Animations for 1st Person Characters

Preliminary tasks

In order to have the Resource compiler handling the 1st person weapons correctly you have to create an entry in the animations.cba file. In this file all information concerning your character is stored, i.e. compression ratio of animations, the path to the character etc. Here is a sample entry which has all the required settings for a 1st person weapon. For a detailed description of these parameters, see the reference document on the CBA file parameters. (LINK!) If this entry is missing the exporter won't export animations, because it needs to know the location of the character-file.

Exporting Animations

In 3ds max you have two different ways of exporting animations for your character. The easiest way is to set the time range in the timeline to the exact frames of the start and end positions of the animation you want to export. It's always a good idea to have all animations start and end in a default pose, so that blending in the engine works in a smooth way.

Tip:

You can also create a free camera at the world coordinate center which is looking in the direction of the positive y-axis. When you set its FOV (field of view) to the same value you use in-game, it becomes an accurate representation of what your animation will look like from the players view. You can also use "link constraints" on the camera to a helper called "camera_helper", which is parented to the "root-bone" of the arms character, and later activate the camera control parameter for specific animations to let them be controlled by this helper. Mind, that the start and end frame of the animation for the camera should always start and end at the world coordinate centre to prevent unwanted "jumps" in your animation in the engine, between animations which have this helper activated and those which haven't.

Once you set your time range, you can move on to the exporter. Make sure the right object is added in the node section of the objects pane. This should automatically add the root of your character in the "Bone Export" list. If not, do so manually. Hit the "Export Bones" button, enter the desired name of the animation and save it to the folder you entered earlier in the animations.cba file.

To preview your animation in the Character Editor, you have to create one more file which tells the engine which animations are available for this character (a "cal-file"). Below is the cal-file for the example weapon. It has the path of the animations folder in it, and the names of the animations, and their binary counterparts, like they would be called "on disk".

Scar_fp.cal

   = Animations\1st_person\SCAR_fp\

   select_01 = select_01.caf fire_bullets_right_01 =
   fire_bullets_right_01.caf idle_right_01 = idle_right_01.caf reload_01 =
   reload_01.caf

   zoom_in_ironsight_01 = zoom_in_ironsight_01.caf
   fire_bullets_right_ironsight_01 = fire_bullets_right_ironsight_01.caf
   idle_right_ironsight_01 = idle_right_ironsight_01.caf
   zoom_out_ironsight_01 = zoom_out_ironsight_01.caf


   //layers control placement of attachments

   silencer_on_layer_01 = silencer_on_layer_01.caf reflex_on_layer_01 =
   reflex_on_layer_01.caf scope_on_layer_01 = scope_on_layer_01.caf

The file needs to be saved to the same folder the character is saved to, and has to have the same name, except for the file extension, which is ".cal". The file path which points to the animations folder is relative to your games root folder. Once you entered all available animations into the cal-file, and exported them from 3ds max, they will show up in the "Available Animations"-list in the character editor.

The second option to export animations is to use the "Sub Ranges" dialog, in the "Timing" pane of the CryENGINE® exporter. You can add animations into the list, by highlighting the "new range" entry and typing the name of your animation. Make sure the start and end times are entered correctly. Check if the root of your character is still showing up in the bone list. When you activate the "Export file per range" in the "sub ranges" area, after hitting the "Export Bones" button, the exporter will ask for a location, and will export any of the entered animations from the "sub ranges" - list.

Layered Animations

Sometimes you might only want to change specific parts of an animation which is used on a hierarchy. One example might be a different pose for the fingers for the right hand, when you want to reuse it for another type of weapon. This is one use for layered animations, which could be activated by code, and overwrite the existing animations on certain parts of your hierarchy.

Layers are also used to control placement of attachments on weapons. In this case the silencer and the magazine are solved as attachments.

To export layered animations you have to make sure that the bone list only contains the highest node of the parts that should be influenced.

Also for these kinds of layers you might only use a static pose. To achieve this activate "manual range" in the timing pane of the exporter and set the start and end frame to be the same time.

After the animation is exported and added to the cal-file, you can test it in the Character Editor.

To add an attachment to your character, you have to create a new one in the attachments pane of the Character Editor.

In the attachment properties select Bone Attachment and select the bone you want the object to be attached to from the drop down list. (silencer_attach, in this case). After you have selected the correct object from the objects browser, you can create the new attachment and click "apply" to load it into the editor. It should show up at the default position of the bone you selected when you created the attachment.

To test the layer, you can activate a primary animation on the base character (i.e. an "idle" animation) by selecting one from the "available animations" list. Then switch to one of the "secondary" animation slots in the character animation pane, and select the layer animation in the list. The parts of the animation which were triggered from the "primary" animation on this bone should be overwritten, by the new layered animation.

Copyright © 2008 Crytek GmbH, All rights reserved


Breakable and Destroyable Objects

Breakable Objects

backtoIndex

Breakable objects consist of separate pieces which are held together by joints.

The single parts can be separately disjointed, by applying physical force (bullets, player interaction, explosions) bigger than the joint limits.

In general, Breakable objects are placed in Sandbox as brushes

A perfect example for a breakable objects would be a road sign, a wooden fence, or a wooden shag.

Table of Content

Sample File

Sample File: breakable_example.max

General Setup in 3d applications

example for dummy placement

Example for joint properties

Each time an external force (from collisions with other objects, or bullet hits) is applied to the object, the system calculates internal forces needed to hold the object parts together, and if some forces breach the threshold, the corresponding joints are removed. Then part connectivities via remaining joints are recomputed and isolated islands are moved to new entities.

Node Properties

The nodes need properties attached (depending on software) to work correctly in the engine.

entity (render geometry property)
If the render geometry properties include "entity", the object will not fade out after being disconnected from the main object.
box (render geometry property)
If the render geometry properties include "box", the engine will use a simple box (based on the bounding box of the object's physics proxy) as the collision geometry. This helps speeding up physics calculation.
mass=VALUE (render geometry property)
Mass defines the weight of an object based on real world physics
mass=0 sets the object to "unmovable". This is used on the basement of a house for example or the sign pole which should not be movable and always stay in the original position. When used in brushes and Geom Entities, this is the final part's mass. When used in regular Entities, all parts masses are scaled so that their total mass gives the mass specified in the entity properties. CAUTION! You must either define this value or density to ensure the simulation is working correctly.
density=VALUE
The engine automatically calculates the mass for an object based on the density and the bounding box of an object. Can be used alternatively to mass.
limit=VALUE (Joint object property)
limit is a general value for several different kind of forces applied to the joint. It contains a combination of the values
CAUTION! This value needs to be defined, otherwise the simulation will not work correctly. Crysis Example values: 100 - 500 can be broken by a bullet; 10000 can be broken by the impact of a driving vehicle or a big explosion.

The following values are optional and are used to fine tune the "limit" settings.

bend=VALUE (Joint object property)
maximum torque around an axis perpendicular to the normal.
twist=VALUE (Joint object property)
maximum torque around the normal
pull=VALUE (Joint object property)
maximum force applied to the joint's 1st object against the joint normal (the parts are "pulled together" as a reaction to external forces pulling them apart)
push=VALUE (Joint object property)
maximum force applied to the joint's 1st object (i.e. the one whose name is listed first in the joint's name, or if the names were not specified, the object the joint's z axis points towards) along the joint normal; joint normal is the joint's z axis, so for this value to actually be "push apart" (as a reaction to external forces pressing the parts together), this axis must be directed inside the 1st object
shift=VALUE (Joint object property)
maximum force in the direction perpendicular to normal
Dissolving into particles\pieces

Jointed Objects can be set up to break in smaller pieces when being detached from the joint. i.e. a wooden sheet breaks into several planks. The object properties must contain the information about the pieces used. i.e. "pieces=$blah1", "pieces=$rock1". Several objects can share the same name, but it is also possible to set up the pieces with different names, i.e. "pieces=$blah1,$blah2". Pieces need to be linked to the object they should replace later on.

Sample setup

Level of detail settings

LODs per object can easily be added by naming them $lod1; $lod2, $lod3... and linking them to the relevant subobjects. In order to make differentiation easier, a postfix can be added; i.e. "$lod1_wooden plank"

Occlusion Proxy

An Occlusion Proxy can be added by naming it $occlusion and linking it to the relevant jointed object; like a big sheet of metal on a metal fence or a wooden wall on a hut. Occlusion proxy is allowed to have open edges and need to be as low as possible (something around 2-10 polys).

Instancing within breakable objects

Instancing objects is used to optimize render time by reducing drawcalls and memory consumption. The engine automatically detects identical geometry elements within the exported objects.

There is no special setup needed to take advantage of this feature. UVs and relative point position to the pivot need to be identical in objects in order to qualify them for instancing.

Linking Objects to simplify export

Linked objects don t need to be exported, just the Root node needs to be added to the exporter list. All child nodes will automatically be exported. The name and pivot will be derived from the root joint.

Example of linking objects and joints for simpler export

PrebrokenObject_NamingAndHierarchy.jpg

Setup in Sandbox

Add the object as a brush or a Geom. Entity. In case of a brush, the engine will detext automatically that the object is breakable. For multiplayer where breaking objects has a massive impact on the data transfer, breakability is automatically disabled (might change later)

Debugging

Example of debug display

PrebrokenObject_sign_example.jpg

Copyright © 2008 Crytek GmbH, All rights reserved


Procedural Breaking 2D Objects

backtoIndex

Planar objects can break in a procedural way (as a later addition, some degree of curvature is also allowed). This can any object that has a planar surface,i.e. mirror, ice plate, table top, wooden wall. Note, however, that the fracturing will work best for brittle "glass-like" materials, and might look unnatural for wood, for instance.

currently only glass material is set up for procedural breaking - but a new material can be created easily.

Sample File

Sample Files:

window.max - sample window file

window.mtl - material file - to be reviewed in Sandbox

General Setup in 3d applications

* the surface type needs to be set to mat_glass

* it's possible to swap the texture of a glass object after the first procedural break (for that a submaterial that follows the one assigned to the object must have the word "broken" in its name).

* Geom Entities, Basic Entities or Brushes can contain elements with procedural 2D breaking

Debugging

* turn on p_draw helpers in console to see the physikalized geometry.

Copyright © 2008 Crytek GmbH, All rights reserved


Procedural Breaking 3D Objects

backtoIndex

The underlying physics technology is versatile enough to break many things, not only tree trunks. It is just a matter of setting up the assets. For the examples below we will concentrate on tree trunks, though.

Sample File

cut_shape.max - tree example

sample_tree.max - breakable cut out - example

General Setup in 3d applications

For the Trunk Material (!), turn on "physicalize" in the Material Editor. Set the Parameter for the physics to "default".

Important: Remove any proxy physics objects from parts you want to be breakable (i.e. trunk)

* create a predefined mesh in an extra cgf file, which is used to "cap" the broken parts.

Setup in Sandbox Editor

* In the Sandbox material editor, the trunk's material surface type needs to be set to "mat_wood_breakable".

* The surfacetype defines the predefined mesh used to cap the tree trunk. The location and name of this mesh is stored in the surfacetype script.

* Breakable trees need to be placed as vegetation objects.

Debugging

apply enough force to the object to break it. in Crysis explosions from rocketlaunchers or grenades were sufficient to check the functionality.

Copyright © 2008 Crytek GmbH, All rights reserved


Natural Objects

Tree Setup

backtoIndex

Trees are an integral part of the environments and have extended functionality, like bending affected by wind or the player. Additionally they can also have breakable trunks.

Sample File

Sample File: trees.max

Setup in 3d Studio MAX

Model Setup

An average tree consists normally of 4 elements:

trunk: provides pivot in the engine, elements are linked to the trunk for export

leaves/foliage + branches

bending proxy (green box in the picture below) - needed for trees with player/ AI interaction

AI obstruct proxy (red box in the picture below) - needed for trees with player/ AI interaction

Optional:

LODs can be included to decrease rendering time in the distance

Dummy; alternative root object: all objects, including trunk can be linked to the dummy

example picture of sample tree

example picture of sample tree hierarchy with dummy as root

Foliage Bending

When a player should be able to move the foliage with his body, the leaves need to be set up for Touch Bending.

Detail Bending is used for wind based bending effects.

Material Setup

An average tree has a Multi/Sub-Object material with at least 4 different Material IDs. One for leaves/foliage and branches, one for the trunk, one for the bending proxy and one for AI cover.

the lower the number of rendered materials, the better the performance + naming is irrelevant, we will refer in the text below to the names given above

In order to have the physics settings work correctly, the Crytek shader must be applied on all materials.

Set the materials to the following settings:

example for physics selection

Export Setup

Only export the root of the object.

Everything linked to the root will be automatically exported into one .cgf-file.

Pay attention to the settings in the Geometry Export Options in the picture below.

example for export settings

example for link strukture with trunk as root

Setup in Sandbox

Breakable Trunk Setup

The surface type for the trunk material needs to be set to mat_wood_breakable.

More detailed information can be found here in the Breakable Vegetation Setup section.

Placing Trees in Sandbox

In the vegetation dialog a new vegetation object is added by pressing the most left pintree button.

To place your tree the paint tool can be used. Placing a single tree can be achieved by selecting the object and pressing shift+leftMB in the viewport.

For more information about the setup of the vegetation, refer to the relevant section in the Sandbox description.

Debugging

These are the console commands you can use to debug your asset in the editor:

Copyright © 2008 Crytek GmbH, All rights reserved


Bush Setup

backtoIndex

Doing a bush is basically the same as a tree, but without a trunk. Have a look at the Tree Setup: Tree Setup

Sample File: bushes.max

Copyright © 2008 Crytek GmbH, All rights reserved


Grass Setup

backtoIndex
This Thread is based on Tree Setup.

make sure you read this first: Tree Setup

Sample File: grass.max

Grass can be done for two different Situations

  1. small grass patch for decoration or to fill small areas or corners
  2. big grass patch to fill big areas of landscape.

The Difference is based in the material in Sandbox.

For the Big Patches u need a different Material with "Fit to terrain" turned on.

You can find this in the shader generation parameters of the vegetation Shader.

Its very expansive , so only use it in this case.

It deforms the object to the terrain.

Also Turn on "grass" checkbox.

If you have Terrain like this:

and your grass patch looks like this:

with "fit to terrain" it will look like this:

Its working not for extreme 90 degrese corners, so use it carefully.

Max Setup

In Max there is nothing much to take care of.

Just make sure that you take care off all the stuff from Tree setup.

You dont need any proxys if you dont want to make it bend or use it as AI cover.

Touch Bending should be used only on really big Grass.

Editor Setup

Place your grass in the same way like you place your tree.

in the object parameters, never use "allign to terrain" for big grass patches.

Its not working together.

For grass it makes sense to turn on "pick terrin color".

This will merge the terrain color in your grass object.

For small Grass patches just turn on "Grass" in vegetation shader generation parameters.

This will take some features and make it more performant.

For Big Grass patches turn on "Grass" and "Fit to terrain" in vegetation shader generation parameters.

This will take some features and make it more performant.

Copyright © 2008 Crytek GmbH, All rights reserved


Vegetation Shader

backtoIndex

For all objects that are placed as Vegetation Object you need to take vegetation shader in your mtl file.

To open the materail dialog do left click on your object in the vegetation list and press "go to object material"

Most time you will use submaterials, open it and select you render geometry.

Material Settings:

Here you select your shader and surfacetype.

Shader

Select Vegetation Shader.

This opens special settings for vegetation objects.

Surface Type

Select mat_canopy (or what ever you want)

The surfacetype difines what partikle and sound effect which will be shown on collision.

Other changes are not needed.

Opacity Settings:

Here you can activate alpha channel for any texture which has one.

ALpha Test

Always stay around 50.

Play around with this value, you will see what happens.

Opacity can activate alpha blend, but for vegetation its to expansive as long as you want to use sahdows.

Other changes are not needed.

Lighting Settings

Here you can tweak difuse and specular color.

Diffuse Color

Make sure that the difuse color is always as close to 128,128,128 as possible.

Make as much color corection as possible in your texture.

Diffuse color is only for variations.

Specular Color

Here you tweak the strangth of you specual color.

Glossiness

Tweak the gloss level of your spec.

Other changes are not needed.

Textures:

Here you can assign your textures like diffuse, normal and specmap

Diffuse map:

RGB should contain diffuse color.

Alpha should contain opacity (used for alpha test)

Normal map (optional):

RGB should contain normal map.

Alpha (optional) should contain gloss map.

If no texture assigned, we get a very good performance/memory saving/optimization

Specular map (optional):

RGB should contain specular color.

If no texture assigned, normal map alpha channel will be used as gloss map.

If no texture assigned we get a good performance/memory saving/optimization.

Opacity map (optinal):

RGB should contain opacity color used in backlighting.

This texture can be much lower res than all others (eg: if diffuse is 1024x1024 this could be 128x128 or so).

If no texture assigned we get a good performance/memory saving/optimization.

Shader parameters:

Here you can Tune shader specific parameters.

Back View dependecy

This is for changing the view dependecy of the back diffuse color.

Makes it starting depending on the point of view earlyer or later.

Back Diffuse Color

This is for the color of the backside of leaves.

Back Diffuse Color Scale

This is for the color strength of the backside color of leaves.

Detail Bending frequency

Difines the bending speed for complex (wind) bending

Always make sure That this is in the right proportion to the wind in your level.

Bending Edges amplitude

Difines the movement of red color in the in the complex bending setup

Bending Branch amplitude

Difines the movement of blue color in the in the complex bending setup

Back Shadow bias (only for SH)

This is controling the shadow power on the back difuse color

Shader generation parameters:

Here you difine if you object is grass or leaves or should fit to Terrain. It s a different shading.

Leaves:

This means that shader is only used for rendering leaves, it will use a much more complex shading (=expensive).

Activate only for leaves rendering.

Grass:

This means that shader is only used for rendering grass, it will use a much cheaper shading.

Activate only for Grass rendering.

It basicly kills spec and normal map setting, so the shading is only difuse.

Fit to Terrain

This is for bigger grass patches only. it fits the object to the terrain surface.

Copyright © 2008 Crytek GmbH, All rights reserved