This is an old revision of the document!
Most 3D modelling programs can export models to the ASE file format. As all Cafu programs directly support the ASE file format, using ASE models is straightforward.
This section explains the one-time adjustments required so that an ASE model works properly with the Cafu engine.
Save or copy your model file and all related texture images somewhere into the Games/DeathMatch/Models subdirectory.
In the example at the right, we saved the ASE model file wbridge-1.ase of a wooden footbridge and the three texture images for its material in the Static subdirectory inside Models.
Open the previously saved ASE model in a text editor like Notepad++ or UltraEdit. Use Notepad if you have nothing else.
In the file, find section *MATERIAL_LIST { … }
. For example:
... *MATERIAL_LIST { *MATERIAL_COUNT 4 *MATERIAL 0 { *MATERIAL_NAME "textures/spkat3/cwood_mo5c" *MATERIAL_CLASS "Standard" *MATERIAL_DIFFUSE 1.000000 1.000000 1.000000 *MATERIAL_SHADING Phong ... } ... } ...
In the *MATERIAL_LIST
, for each listed *MATERIAL
, you must replace the *MATERIAL_NAME
string.
The new *MATERIAL_NAME
string can be anything you like, but:
If there is more than one *MATERIAL
in your *MATERIAL_LIST
, you can initially use the same *MATERIAL_NAME
string everywhere.
When you later find out that you want to use different Cafu materials for different parts of the model, come back here and assign individual
material names as required.
In the example, we have chosen Models/wbridge as the new material name, and our ASE file is saved like this:
... *MATERIAL_LIST { *MATERIAL_COUNT 4 *MATERIAL 0 { *MATERIAL_NAME "Models/wbridge" *MATERIAL_CLASS "Standard" *MATERIAL_DIFFUSE 1.000000 1.000000 1.000000 *MATERIAL_SHADING Phong ... } *MATERIAL 1 { *MATERIAL_NAME "Models/wbridge" ... } ... } ...
We now add definitions for each material that we referenced above. Once more using the text editor, you can either create a new .cmat file somewhere inside the Games/DeathMatch/Materials folder, or just open one of the existing .cmat files and add your definitions there.
In our example, we just open Games/DeathMatch/Materials/Models/Static.cmat, and add at the end:
Models/wbridge { diffusemap Models/Static/wbridge_diff.png // normalmap Models/Static/wbridge_norm.png // specularmap Models/Static/wbridge_spec.png red ambientLightRed green ambientLightGreen blue ambientLightBlue meta_editorImage noEditor }
You can just copy and paste this example for your own materials.
Note that in the example, the normal and specular map lines are commented out.
For your own use, remove the comment marker //
as required.
You can learn more about Cafu material definitions at The Cafu Material System.
If the *MATERIAL_NAME
keyword occurred multiple times in the ASE file and you specified different names for them, you should repeat this step for every distinct material name.
You can check the result in the Cafu ModelViewer by running it from the command line with the model name as a parameter:
C:\Cafu-9.06> ModelViewer.exe Games\DeathMatch\Models\Static\wbridge-1.ase
(Use auto-completion also with Microsoft Windows for easily typing the path name.)
When you're satisfied with the result:
If you want to make adjustments later, both the ASE model as well as the material definitions can be edited as shown above also after the model has been placed in a map or world file. The changes will take effect when the program is next restarted.