Skip to content

Exporting a Character with CryBlend

dwhite4 edited this page Oct 17, 2014 · 1 revision

This tutorial will outline the process of exporting a character from Blender 2.69 to CryEngine 3.4.5. Be sure you are using CryEngine 3.4.5 because later versions of 3.5.X will generate Chunk Loader errors when attempting to load your characters into the engine.

A character consists of several key components: a soft body (or deformable) mesh attached to a skeleton. For our basic character we will consider the export of a single mesh and skeleton. Here is the character we will be exporting (generated using MakeHuman 1.0 alpha 7).

XXX

A couple of things to keep in mind when creating your character:

1.) Keep your character as low poly as possible. Recommended: vertexCount < 10,000

2.) Use as minimal bones as possible. Recommended: boneCount < 100

3.) ALWAYS name your character's object AND skeleton (it doesn't matter what you call them, but NEVER use spaces in names; use underscores instead)!

4.) Do NOT parent your character to your skeleton yet - the tutorial will address when to do this!!!

For your character to export successfully and look as expected in the CryEngine you have to follow these steps very carefully!!!

Step 1: Set up Your Project Folder.

It is very important to keep organized when creating a character. Characters are complicated and very easy to mess up. For this reason, you'll want to create a folder for your project.

Find your CryEngine folder, wherever you installed CryEngine. In the CryEngine folder, locate the folder called 'Objects'. If you do not have a folder called Objects, this is because you never created one. For instruction on how to create this folder and why it is necessary, see the following article...

XXX

...Under the Objects folder create a new folder and give it a name of your choice; I will name mine 'char'. This folder will be your project folder and is where you will put all of the files for your character. In your newly created project folder, create two additional folders: one called 'animations' and the other called 'textures.' Animations will be exported to the animations folder and textures to the textures folder. Great! Now you are ready to proceed to step 2.

Step 2: Create Your Character's Mesh.

Begin by modeling your character, however you choose. Avoid bad geometry such as degenerate faces and non-manifold geometry. If you do not know what these are or run into problems with these bad geometries later on while exporting, see the following article on how to identify and fix them...

XXX

...Avoid triangles at all costs when modeling your character. This is very important because triangles do not respond well to deformation and your character will not animate properly.

IMPORTANT: If you want your character to be realistically scaled in the CryEngine you will need to use a unit system. To enable metric units, navigate to the SCENE tab and, under 'Units', choose 'Metric'. Now your PROPERTIES panel will display your object's dimensions in meters. A reasonable height for a human character is 1.8 meters.

Once you have completed your mesh, you are ready for step 3.

Step 3: Create Your Character's Skeleton.

Now you are ready to create the skeleton for your character. Create the skeleton as you normally would but make sure you follow these ESSENTIAL rules:

1.) Name ALL bones. Be sure to NEVER use spaces, symbols, or special characters in your bone names except for underscores. CryBlend will not be able to read bone names with spaces or other special characters.

2.) You CAN use the following bone-naming scheme: Bone000, Bone001, Bone002, Bone003
But you CANNOT use the following bone-naming scheme: Bone, Bone001, Bone002, Bone003

If you break this rule you will receive an AttributionError.

3.) ALL bones must trace back to a SINGLE root bone and every bone must have a parent excluding the root bone.

Step 4: Position Your Character and Skeleton Properly.

By this point you should have a complete character mesh and skeleton, but the character should NOT be parented to the skeleton; if the character is parented to the skeleton, un-parent it and delete all of the vertex groups on your character's mesh.

You will want your character and skeleton's origins to be placed at the feet of your character. To do this, move the 3D cursor to the center of the scene. Do this by navigating to the OBJECT menu and choose 'Snap --> Cursor to Center'. Select both your character and skeleton in OBJECT mode and move them so that the feet of the character are on top of the ground plane. Finally, under the OBJECT menu, choose 'Transform --> Origin to 3D Cursor'. If you've done this correctly, you should see something similar to the image below...

XXX

It is also very important that you rotate your character to face the positive y-axis. This means that when you enter into FRONT view in Blender, you should see the back side of your character. This needs to be done so that the character faces forwards in the engine.

Next, you will want to apply the transformations done to your mesh and skeleton. With your character's mesh and skeleton selected, press CTRL + A and apply the Location, Rotation, and Scale.

Now you can parent your mesh to your skeleton. Choose whatever method you prefer. For my character, I chose to parent the mesh to the armature using automatic weights. With your character properly positioned you are ready to proceed to the next step.

Step 5: Setting Up Materials.

For this step, you really need to have an understanding of the CryBlend conventions for materials. If you do not know the naming conventions, I recommend you read the following article on naming materials...

XXX

...Select your character and navigate to the MATERIALS tab. Add a new material for your character. Since we are only exporting a simple character, we will only need one material. If you choose to use multiple materials, simply follow the rules for naming multiple materials and you will be fine.

Name your newly created material according to convention. I will name mine:

char__1__mat__physDefault

IMPORTANT: Don't forget to use DOUBLE underscores in between components in your material name. Also, make sure that you name your library name (the first part of the material name) exactly the same as your CryExportNode, which we will create later. We are about half way there; now let's move onto textures.

Step 6: Setting Up Textures.

For CryEngine to use your textures, they must be in a special compressed format called the .dds. The .dds is a compressed version of the .tiff file. We can use the RC (resource compiler) to convert .tiff files to .dds files.

If your textures are not already in the .tiff format, you will need to convert them. You can do this using an image editing software such as GIMP or Photoshop. GIMP is free, so I will be using GIMP. If you would like to download GIMP, see the following article with links to assorted useful programs...

XXX

...To convert your file to a .tiff using GIMP, simply open your image in GIMP and from the FILE menu, choose 'Export to'. Name your file and add the ending .tiff. Export your file with no compression to the 'textures' folder you created in your project directory. Do this for all of your textures, diffuse, specular, etc.

Once you have .tiff's for all of your textures, see the following article for information on how to convert them to .dds files.

XXX

...Make sure your .dds files are placed in the 'textures' folder under your project directory. Now, in Blender, navigate to the TEXTURES tab for your material. Add as many texture slots as you need and select 'Image or Movie' for the Type. Scroll down in the TEXTURES tab and, under 'Mapping', choose your Coordinates to be UV.

The next step varies depending on what type of texture(s) you are exporting...

1.) If it is a diffuse texture --> under 'Influence - Diffuse' check the box for 'Color'.

2.) If it is a specular texture --> under 'Influence - Specular' check the box for 'Color'.

3.) If it is a normal texture --> under 'Influence - Geometry' check the box for 'Normal'.

After you have your textures setup, the last step is to select your character mesh, enter into EDIT mode, and unwrap your mesh; this will generate your UV map which is necessary for export. With your mesh unwrapped you should link your UV map to the respective texture(s) for your character. You can do this by opening the UV Image Editor with your mesh selected in EDIT mode and selecting your texture(s) from the dropdown. Or you can link your UV's by scrolling down in the TEXTURES tab and, under 'Mapping' selecting your mesh from the 'Map' dropdown.

NOTE: If you want to view your texture and ensure it is working, select GLSL (under 'Display' in older versions of Blender and under 'Shading' in newer versions) in the PROPERTIES panel and choose 'Textured Solid' if you want to see your texture in solid mode. Otherwise, you can choose 'texture mode', but you will have to add a light to your scene to see your object's texture.

Step 7: Add Your Mesh and Skeleton to a CryExportNode.

We are nearly ready to export our character. The next step is to add both the character and skeleton to a CryExportNode. To do this, select both your mesh and skeleton in OBJECT mode and, under the CryBlend menu, select 'Add CryExportNode'.

IMPORTANT: Name your CryExportNode EXACTLY THE SAME as your library name on the character's material. The library name is the first component in the material name:

libraryName__1__materialName__physDefault

This is a crucial step! If these names do not agree, no nodes will be able to be loaded from the scene and the export will fail.

For my example, I will be naming my CryExportNode 'char' to match my material library name as seen below:

char__1__mat__physDefault

CryExportNode's are just specially named groups. This means you can edit the name of your CryExportNode or remove items from this node at any point you need to. You can view and edit your CryExportNode if you select an object in the CryExportNode and navigate to the OBJECT tab. Scroll down until you see the heading 'Groups' and your CryExportNode should be located there. You should always check the groups your objects belong to. Make sure your character and skeleton do not belong to any other groups except for the CryExportNode you specified.

If your CryExportNode was successfully created you should notice that when your objects are selected, they are now outlined in green. When objects are in groups, they appear outlined in green; when not in any groups, they appear outlined in orange.

Step 8: Add Fakebones to Your Skeleton.

Fakebones appear as small cubes located at each joint of your character's skeleton. Fakebones are paranyed to the bones of the skeleton to track the transformations of the bones as they are animated. This animation data is captured by the transformations done to the fakebones and compiled into CAF files (Character Animation Files) by the RC.

To create fakebones for your skeleton, select your character in OBJECT mode and, under the CryBlend menu, choose 'Add Fakebone'. This will add the fakebones at each joint of your skeleton. You should ALWAYS verify that your fakebones were created. To do this, hide your mesh and skeleton by pressing 'H' and check to see that they appear at the character's joints. If they are messed up, you should check to make sure the location, rotation, and scale of your character's mesh and skeleton were applied. Otherwise, you can unhide your mesh and skeleton by pressing ALT + H. Your fakebones should NEVER be added to your CryExportNode; otherwise they will be visible in the engine. Also, NEVER apply the location on your fakebones; otherwise they will all be moved to the origin when loaded into CryEngine.

IMPORTANT: If at any point you make any changes to your character's mesh or skeleton, to make sure that your character exports fine you should remove all fakebones, un-parent your mesh form your skeleton, remove all vertex groups on your mesh, apply the location, rotation, and scale on your mesh and skeleton, re-parent your mesh to your skeleton, and regenerate the fakebones. This ensures all data is up to date and accurately representing the character visible in your Blender viewport. It also reduces the chance of errors and warnings.

Step 8: Exporting and Testing Your Character.

You are now ready to export your base character to the engine! You should ALWAYS save before exporting however in case Blender crashes. To export your character, select all items in the scene by pressing 'A', navigate to the CryBlend menu, and, from the dropdown, choose 'Export to Game'. Give your export file a name (this name can be anything - it will be the name of the unconverted Collada or .dae file). I will name my export 'char' to be consistent. It is very IMPORTANT that you select the following options from the export menu shown below:

XXX

When you have completed the above, you may click 'Export'. Depending on the size and complexity of your character, the export may take anywhere from 30 seconds to 20 minutes. A character of about 2000 verts and 100 bones takes about 30 seconds to a minute on my computer but be patient if it takes longer. During the course of the export Blender may stop responding but this is normal and there is no need to panic.

  • CryBlend:
  • Home
  • What is CryBlend?
  • Meet the Team
  • Compatibility
  • Resources:
  • [Offline Tutorials](Offline Tutorials)
  • [Example Files](Example Files)
  • Programs
  • [Errors and Warnings](Errors and Warnings)
  • Texture conversion to DDS
  • Getting Started:
  • [Finding the Resource Compiler](Finding the Resource Compiler)
  • [Setting Up the Asset Pipeline](Setting Up the Asset Pipeline)
  • [A Guide to Clean Geometry](A Guide to Clean Geometry)
  • Static Geometries:
  • [Static Object](Exporting a Static Object)
  • [LOD's Object](Exporting an Object with LOD's)
  • [Breakable Object](Exporting a Breakable Object)
  • [Deformable Object](Exporting a Deformable Object)
  • [Touch-Bendable Object](Exporting a Touch-Bendable Object)
  • Animated Geometries:
  • [Rigid Body Animation](Exporting a Hard Body Animated Geometry)
  • [Simple Character](Exporting a Simple Character)
  • [Complicating a Simple Character](Complicating a Simple Character)
  • Human Biped
  • FPS
  • Developer Resources:
  • References
  • [Blender Icons](Blender Icons)
Clone this wiki locally