This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
modelling:usingasemodels [2009-05-17 15:25] Carsten created |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Using ASE Models ====== | ||
- | |||
- | Most 3D modelling programs can export models to the ASE file format. | ||
- | As all Ca3D-Engine 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 Ca3D-Engine. | ||
- | |||
- | |||
- | ===== Saving the model ===== | ||
- | |||
- | {{ :modelling:usingase-1.png|Saving the model}} 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**. | ||
- | |||
- | |||
- | ===== Setting the material names ===== | ||
- | |||
- | Open the previously saved ASE model in a [[wp>Text_editor|text editor]] like [[http://notepad-plus.sourceforge.net|Notepad++]] or [[http://www.ultraedit.com|UltraEdit]]. | ||
- | Use [[wp>Notepad|Notepad]] if you have nothing else. | ||
- | |||
- | In the file, find section ''*MATERIAL_LIST { ... }''. For example: | ||
- | |||
- | <code c> | ||
- | ... | ||
- | |||
- | *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 | ||
- | ... | ||
- | } | ||
- | ... | ||
- | } | ||
- | |||
- | ... | ||
- | </code> | ||
- | |||
- | 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: | ||
- | * you must be able to remember it or write it down for the next step, | ||
- | * it must not have whitespace (space or tab) characters, | ||
- | * it should be unique for all models known to the Ca3D-Engine. | ||
- | |||
- | 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 Ca3DE 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: | ||
- | |||
- | <code c> | ||
- | ... | ||
- | |||
- | *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" | ||
- | ... | ||
- | } | ||
- | ... | ||
- | } | ||
- | |||
- | ... | ||
- | </code> | ||
- | |||
- | |||
- | ===== Creating Ca3DE materials ===== | ||
- | |||
- | 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: | ||
- | <code java> | ||
- | 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 | ||
- | } | ||
- | </code> | ||
- | |||
- | You can just copy and paste this example for your own materials. | ||
- | - Edit the first line with the material name (**Models/wbridge** in the example) to match the name that was written into the ASE file in the previous step. | ||
- | - Edit the three lines that define the diffuse, normal and specular map. The most difficult part of the job is to get the pathnames to the texture images right: They are relative to the **DeathMatch** directory and for the sake of Linux users, you should use forward (**/**) instead of backward (**\**) slashes and make proper use of upper/lower case. | ||
- | - Leave the last four lines alone. | ||
- | |||
- | 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 Ca3DE material definitions at [[:start#the_ca3de_material_system|The Ca3DE 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. | ||
- | |||
- | |||
- | ===== Checking and using the model ===== | ||
- | |||
- | {{ :modelling:usingase-2.png|Checking the ASE model in the ModelViewer}} You can check the result in the Ca3DE ModelViewer by running it from the command line with the model name as a parameter: | ||
- | <code>C:\Ca3DE-9.05> ModelViewer.exe Games\DeathMatch\Models\Static\wbridge-1.ase</code> | ||
- | (Use auto-completion also with [[http://support.microsoft.com/kb/310530|Microsoft Windows]] for easily typing the path name.) | ||
- | |||
- | When you're satisfied with the result: | ||
- | * use the [[:mapping:cawe:editingtools:newentity|New Entity]] tool for placing your ASE model in CaWE, | ||
- | * watch the related "[[http://www.ca3d-engine.de/flash/Placing_a_Model.htm|Placing a Model]]" tutorial -- recommended! 8-) | ||
- | |||
- | 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. | ||