Post tutorial RSS Using Existing Materials With Custom Meshes

This tutorial describes in detail how a modder can use the Autodesk Softimage Mod Tool to link existing CryEngine materials with custom meshes.

Posted by on - Basic Props Modelling

This tutorial is about setting up meshes created in the Mod Tool to work correctly with materials already available in your Crysis installation. If done right, there should be no need to manually assign a material in the Sandbox Editor.

The first thing to understand is that the MTL material files often contain a number of sub-materials and, even though you may only want to make use of one of them, you have to have a record of all sub-materials in your exported CGF files. I can only guess the reason for this. Most likely, the CryEngine refers to materials internally by index (not name) for performance reasons and so needs the number and order of materials in the CGF file to match that in the MTL file. If you export a mesh designed to use the third sub-material in a MTL file but don’t also include references to the other sub-materials your mesh will appear in the CryEngine with the first sub-material that appears in the applied MTL file.

The Crysis meshes were originally created in 3DS Max and were each assigned a material of a type which contains several sub-materials called a Multi/Sub-Object Material. Softimage has no material
types which directly relate to this kind of material so, instead, the Softimage Crytek Exporter exports the entire library of materials in the scene with the materials within as sub-materials. It follows that you will want to match the material library name to the MTL file you want to use and the names of each of the contained materials to the names of each of the sub-materials. The Material Manager can be accessed from Render>Modify>Materials.


For example, if you were wanting to create a new fighter jet model for a mod but wanted to use the correct materials, as written by Crytek, you would start by creating a material library in the Mod Tool
called ‘us_fighter.mtl’ and create six CryShader materials named ‘us_fighter_main’, ‘glass’, proxy’, ‘decals’, ‘destroyed’ and ‘decals_2’ and assign each shader the correct material ID. Then assign the correct material to the correct mesh. There is no need to assign the other materials to anything. You can choose whether or not you want to keep the automatic prefixes (‘_01_...’, etc.) in the material names. It should work either way.


While many modders are attracted to the Mod Tool because it’s free, if you do happen to have a full copy of Autodesk Softimage you have the option of exporting the material library for use in future modding projects. Curiously, if you try to import an exported material library into the Mod Tool it will bring up a message box stating that ‘You cannot use an external library in the Mod Tool version’ and then promptly import the selected library anyway. Weird, but useful.

Sometimes it might be unclear from the sub-material names which sub-material is best suited to your mesh. For example, should my new hangar wall have ‘wall_lower’ or ‘wall_top’ assigned to it? Unfortunately, the only solution I could come up with was to open up a reference CGF file in a hex editor (I use Notepad++ with the Hex Editor plugin) and have a look to see whether I could see a pattern or identify a unique byte after one of the material names which might indicate that that material was in use by the mesh. It’s not foolproof but I don’t know enough about the CGF file format to give better advice. No doubt there are others out there who do (feel free to correct me or leave details in a comment).

Finally, bear in mind when modelling in Softimage that 1 grid unit = 1m in the CryEngine game world so you’ll have to scale your UVs correctly if you want the materials to look right. It’s often worth importing (by whatever pipeline you like – most people go via Wavefront OBJ files) a related CGF file into the Mod Tool so you can have a look at its UVs to use as a reference.

That’s it for now. I hope this has been useful. If you have any questions just leave a comment.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Tutorial
Related Engines
CryENGINE 2
CryENGINE 2 Commercial
Related Groups
Crytek
Crytek Developer & Publisher