Welcome to the TWC Wiki! You are not logged in. Please log in to the Wiki to vote in polls, change skin preferences, or edit pages. See HERE for details of how to LOG IN.

Difference between revisions of "IWTE - Units in Blender/Milkshape"

From TWC Wiki
Jump to navigationJump to search
(Export and Import RTW Units & RTW/M2TW Strat Characters: note on engine animations)
 
(34 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{RTW M2TW Modding Logo}}  
+
{{RTW M2TW Modding Logo}}
 +
{{IWTE}}  
 
__TOC__
 
__TOC__
  
<big>Tips and instructions for working with RTW and M2TW battle map units and strat map characters via '''[[IWTE]]''' and '''[[Blender]]''' using the .dae format - December 2020 version onwards.</big>  
+
<big>Tips and instructions for working with RTW and M2TW battle map units and strat map characters via '''[[IWTE]]''' and '''[[Blender]]''' using the .dae format.</big>  
  
 
''The .dae files used for the Collada  import/export can also be used with '''3ds Max''', however, max users absolutely have to use the [https://github.com/KhronosGroup/OpenCOLLADA/wiki/OpenCOLLADA-Tools '''OpenCollada plugin'''] and file format when importing/exporting files, max comes with the AutodeskCollada file format by default which neither imports nor exports files from the game correctly.''
 
''The .dae files used for the Collada  import/export can also be used with '''3ds Max''', however, max users absolutely have to use the [https://github.com/KhronosGroup/OpenCOLLADA/wiki/OpenCOLLADA-Tools '''OpenCollada plugin'''] and file format when importing/exporting files, max comes with the AutodeskCollada file format by default which neither imports nor exports files from the game correctly.''
  
*IWTE download [https://www.twcenter.net/forums/downloads.php?do=file&id=2741 here]
+
*IWTE download [https://www.twcenter.net/forums/downloads.php?do=file&id=2741 here] - please use the latest version, early versions do not have this functionality.
 
*For queries about these functions please ask [https://www.twcenter.net/forums/showthread.php?808315-IWTE-Character-Unit-Skeleton-and-Animation-editing here].
 
*For queries about these functions please ask [https://www.twcenter.net/forums/showthread.php?808315-IWTE-Character-Unit-Skeleton-and-Animation-editing here].
 
*For information on working on M2TW Settlements in Blender see [[IWTE - Settlements in Blender]]
 
*For information on working on M2TW Settlements in Blender see [[IWTE - Settlements in Blender]]
Line 18: Line 19:
 
The drop-down menu in IWTE allows a unit .mesh to be merged with its basepose skeleton and one animation.  A task file is needed to allow combining of animations and is the only way to also incorporate weapon animations.
 
The drop-down menu in IWTE allows a unit .mesh to be merged with its basepose skeleton and one animation.  A task file is needed to allow combining of animations and is the only way to also incorporate weapon animations.
  
The drop-down menu options, and alternative IWTE Task button positions are shown below:
+
The drop-down menu options, and alternative IWTE Task button options are described below:
  
 
[[File:Export-mesh-in-IWTE.jpg]]
 
[[File:Export-mesh-in-IWTE.jpg]]
  
Select 'Unit mesh to date' if you have the "full" version of the .cas anims (the ones the game re-packs).  Select the 'Unit mesh/skel/casanim to dae' option if you have the versions unpacked using XIDX.
+
1.  For Blender select the 'Unit mesh/skel/casanim to dae' option if you have the skeleton and animation versions unpacked using XIDX etc.<br>
 +
2.  For Blender select 'Unit mesh to dae' if you have the "full" version of the .cas basepose and animations (the ones the game re-packs as supplied by Caliban/Devkit/IWTE).<br>
 +
3For Milkshape select the 'Unit mesh/skel/casanim to ms3d' option if you have the skeleton and animation versions unpacked using XIDX.<br>
 +
4.  For Blender select 'Unit mesh to ms3d' if you have the "full" version of the .cas basepose and animations (the ones the game re-packs as supplied by Caliban/Devkit/IWTE).<br>
  
Select the double mesh option for unit meshes that have both a main and attachment texture.  Select the single mesh option for most other cases (e.g. standard mounts).   
+
For all of the above options select the Double Textured option for unit meshes that have both a main and attachment texture.  Select the Single Textured option for most other cases (e.g. standard mounts).   
  
You will be prompted to select the model .mesh first, then the basepose.cas for the skeleton (full cas version) or the unpacked skeleton file (unpacked version), and then an animation.cas file that is compatible with that skeleton (this will need to be in the same format as the skeleton, full or unpacked).   
+
You will be prompted to select the model .mesh first, then the basepose.cas for the skeleton (full cas version) or the unpacked skeleton file (unpacked version), and then an animation.cas file that is compatible with that skeleton (this should be in the same format as the skeleton, full or unpacked).   
  
 
===Export/Import by Task Process===
 
===Export/Import by Task Process===
To generate a .dae file from .mesh and .anims via the task process you will need a text file ending in _task.txt which starts with the mesh to dae command, run the task file by selecting the 'IWTE Task' > 'Select Task File' buttons.  See example below for mesh_to_dae (the extra line breaks have been included just to show the body/weapon pairing):
+
To generate a .dae or .ms3d file from .mesh and .anims via the task process you will need a text file ending in _task.txt which starts with the mesh to dae command, run the task file by selecting the 'IWTE Task' > 'Select Task File' buttons.  See example below for mesh_to_dae (the extra line breaks have been included just to show the body/weapon pairing):
  
  <task_id>                              mesh_to_dae
+
  <task_id>                              mesh_to_extract
 
  <mesh_file_full_path_in>              C:\M2TW\mods\devkit\data\animations\EB_Slinger\numidian_slinger_lod0.mesh  
 
  <mesh_file_full_path_in>              C:\M2TW\mods\devkit\data\animations\EB_Slinger\numidian_slinger_lod0.mesh  
  <mesh_double_texture>                  yes
+
<mesh_type>                            unit                        # line can be omitted if not also adding mount
  <cas_file_types_in_list>              body weapon
+
  <mesh_double_texture>                  yes                         # or 'no' for single texture
 
+
  <cas_file_types_in_list>              body weapon              
 +
 +
<directory_out>                        C:\M2TW\mods\devkit\data\animations\EB_Slinger 
 +
<extract_file_name_out>                EBslingerAnims.ms3d
 +
<extract_file_type>                    ms3d                        # or 'dae' for Blender
 +
<create_text_file>                    no                          # or 'yes' for summary files, 'full' for detailed files
 +
<task_file_full_path_out>              C:\IWTE/IWTE_tasks/ms3d_to_mesh_slinger_task.txt  # name for your return task file
 +
   
 
  <cas_file_full_path_in_default_list>  
 
  <cas_file_full_path_in_default_list>  
 
  C:\M2TW\mods\devkit\data\animations\EB_Slinger\EB_Slinger_basepose.cas  
 
  C:\M2TW\mods\devkit\data\animations\EB_Slinger\EB_Slinger_basepose.cas  
Line 47: Line 58:
 
  C:\M2TW\mods\devkit\data\animations\EB_Slinger\Weapon\w_EB_Slinger_attack_missile_ready.cas  
 
  C:\M2TW\mods\devkit\data\animations\EB_Slinger\Weapon\w_EB_Slinger_attack_missile_ready.cas  
 
   
 
   
<directory_out>                        C:\M2TW\mods\devkit\data\animations\EB_Slinger 
 
<dae_file_name_out>                    EBslingerAnims.dae
 
<create_text_file>                    yes
 
 
 
Please see the IWTE example control processes.txt file that ships with IWTE for further details/instructions.  
 
Please see the IWTE example control processes.txt file that ships with IWTE for further details/instructions.  
  
Running the task will generate you a .dae file with the animations joined together with an additional 'basepose' frame added at frame 0, to aid editing.  The task will also auto-generate for a reverse dae_to_mesh_****_task.txt file for you, this will list the start and end frame positions of all included animations and the names of all the files that will be re-created from the .dae.  The names and frame positions can be edited to suit any changes you may require before running the return task.
+
Running the task will generate you a .ms3d or .dae file with the animations joined together with an additional 'basepose' frame added at frame 0, to aid editing.  The task will also auto-generate for a reverse dae/ms3d_to_mesh_****_task.txt file for you, this will list the start and end frame positions of all included animations and the names of all the files that will be re-created from your file.  The names and frame positions can be edited to suit any changes you may require before running the return task.
  
 
When creating the task files it is common to make minor errors in the file names/paths that mean IWTE cannot find all the elements!  If you get an error message whilst running the task you'll get a chance to read the error message  
 
When creating the task files it is common to make minor errors in the file names/paths that mean IWTE cannot find all the elements!  If you get an error message whilst running the task you'll get a chance to read the error message  
Line 79: Line 86:
 
If you assign two textures to a unit in the [[battle_models.modeldb]] then the game expands out the horizontal axis of the uv maps so that the area from 0 to 0.5 is used to cover 0 to 1 on the first texture, and the uv's from 0.5 to 1.0 on the horizontal axis are used to cover 0 to 1 on the second texture.
 
If you assign two textures to a unit in the [[battle_models.modeldb]] then the game expands out the horizontal axis of the uv maps so that the area from 0 to 0.5 is used to cover 0 to 1 on the first texture, and the uv's from 0.5 to 1.0 on the horizontal axis are used to cover 0 to 1 on the second texture.
  
Milkshape/.mesh converters use the texture (Main or Attachment) assigned to a mesh group to determine which section of the uv map the group's uv coordinates will be moved to, with Main texture co-ordinates compressed into the 0>0.5 area and Attachment texture co-ordinates compressed into the 0.75>1.0 section.
+
Milkshape/.mesh converters use the texture (Main or Attachment) assigned to a mesh group to determine which section of the uv map the group's uv coordinates will be moved to.  On write back the Main texture co-ordinates are compressed into the 0>0.5 area and Attachment texture co-ordinates compressed into the 0.5>1.0 section.
  
 
The IWTE mesh to .dae for Blender process works differently.  The texture assignment process is used purely so you can view the mesh groups with the correct relevant texture.  The 0>1.0 horizontal uvs are expanded to 0>2.0 if you use the process for 'double textures' and then compressed back to 0>1.0 on the return to .mesh.
 
The IWTE mesh to .dae for Blender process works differently.  The texture assignment process is used purely so you can view the mesh groups with the correct relevant texture.  The 0>1.0 horizontal uvs are expanded to 0>2.0 if you use the process for 'double textures' and then compressed back to 0>1.0 on the return to .mesh.
Line 89: Line 96:
 
To see the 2nd texture under its uv's open the sidebar (n) in the uv screen and select the 'repeat texture' button.
 
To see the 2nd texture under its uv's open the sidebar (n) in the uv screen and select the 'repeat texture' button.
 
In Blender it is possible to partially assign some triangles from a group to the 1st texture and some triangles to the 2nd texture, if you do that please remember to also move the uv's to the appropriate zone.
 
In Blender it is possible to partially assign some triangles from a group to the 1st texture and some triangles to the 2nd texture, if you do that please remember to also move the uv's to the appropriate zone.
 +
 +
===Scaling of Anims===
 +
The 'full' cas animations as supplied by Caliban should be regarded as scale 1.0.  If you need to load from them to suit a skeleton that will be scaled by the game you need to give IWTE the skeleton scale in the mesh_to_extract task using the appropriate tag e.g.<br>
 +
<skeleton_scale> <br>
 +
<mount_skeleton_scale>
 +
 +
If you load from the unpacked skeleton and unpacked animation the scale will be read from the skeleton, so you do not need to add any further information.
  
 
==Export and Import RTW Units & RTW/M2TW Strat Characters==
 
==Export and Import RTW Units & RTW/M2TW Strat Characters==
 +
<big>'''NOTE:''' IWTE now supports the full weighting allowed in Rome Remastered by default - to ensure you do not create RTW/M2TW cas files that exceed their games capabilities add '''<cas_mesh_format> rtw''' (or M2) to the task file.</big>
 +
 +
 
The process for this is similar to the .mesh Export/Import process described above, the button locations are shown in the below image: <br>
 
The process for this is similar to the .mesh Export/Import process described above, the button locations are shown in the below image: <br>
 
[[File:Export-cas-to-dae.jpg|Exporting animated cas to date with IWTE]]
 
[[File:Export-cas-to-dae.jpg|Exporting animated cas to date with IWTE]]
  
Use the 'Animated cas_mesh to dae' button if you have the full versions of the animation files, e.g the type supplied by Caliban that M2TW itself re-packs. The first file requested will be the .cas 'mesh', e.g. the one with the body model in it.  The second file requested will be an animation file, if you do not have a suitable animation file just click 'Cancel' to close the selection screen.  Use the 'Animated cas/dae' button for all unit/character .cas files even if you aren't going to load an animation.
+
1. For Blender to convert cas model with skeleton and animations unpacked from the RTW/RR animation pack files. The first file requested will again be the .cas 'mesh', e.g. model.  The second file requested will be the skeleton file (as produced by XIDX/tool using extract_skeletons).  The third file requested will be the .cas animation file (as produced by XIDX/tool using extract_animations).<br>
 
+
2. For Blender to convert cas model with skeleton and animations unpacked from the M2TW animation pack files. Works as above.<br>
If you are using RTW or are using M2TW but only have the skeleton/cas files unpacked using XIDX use the appropriate '* casmesh,skel,casanim to dae' button. The first file requested will again be the .cas 'mesh', e.g. model. The second file requested will be the skeleton file (as produced by XIDX using extract_skeletons). The third file requested will be the .cas animation file (as produced by XIDX using extract_animations).  
+
3. For Blender to convert cas model if you have the full versions of the animation files, e.g the type supplied by Caliban that M2TW itself re-packs or engine animations. The first file requested will be the .cas 'mesh', e.g. the one with the body model in it.  The second file requested will be an animation file, if you do not have a suitable animation file just click 'Cancel' to close the selection screen.  You can use the 'Animated cas/dae' button for all unit/character .cas files even if you aren't going to load an animation.<br>
 +
4. For Blender this button is designed for converting static cas models.<br>
 +
5. For Milkshape as option 2 above.<br>
 +
6. For Milkshape as option 3 above.<br>
 +
7. For Milkshape as option 4 above.<br>
 +
A. Can be used for writing back to .cas model/animations but task file method is prefered.<br>
 +
B. Must be used if you need the model AND animation in one .cas file (applicable to RTW/RR spot effects only).<br>
  
These processes will generate a .dae file in a /to_dae sub-folder where your IWTE.exe is located.  You will also have two task files generated in the /iwte_tasks sub-folder.  The dae_to_cas one provides a default task file for reversing the process and generating new .cas files.  The cas_to_dae one allows you to repeat the process you just did by simply running the IWTE Task, you can also adapt that task file to load multiple animations.  The following is an example task file for cas_to_dae with multiple anims, and using rtw skeleton and anims,  note that if the file path/name has spaces the entire path needs to be inside " ", also note the skeleton name does not have a file extension, direction of \  or / doesn't matter:
+
Processes 1-7 will generate a .dae/.ms3d file in a to_dae/ms3d sub-folder where your IWTE.exe is located.  You will also have two task files generated in the /iwte_tasks sub-folder.  The ms3d/dae_to_cas one provides a default task file for reversing the process and generating new .cas files.  The cas_to_dae/ms3d one allows you to repeat the process you just did by simply running the IWTE Task, you can also adapt that task file to load multiple animations.  The following is an example task file for cas_to_dae with multiple anims, and using rtw skeleton and anims,  note that if the file path/name has spaces the entire path needs to be inside " ", also note the skeleton name does not have a file extension, direction of \  or / doesn't matter:
  <task_id>                                          cas_to_dae                                                
+
  <task_id>                                          cas_to_extract                                                
 
  <cas_mesh_file_full_path_in>                        I:\M2TW\M2TWcopy\mods\IWTE\to_dae/from_dae/ALEX_companion_cavalry_lod_1.cas  
 
  <cas_mesh_file_full_path_in>                        I:\M2TW\M2TWcopy\mods\IWTE\to_dae/from_dae/ALEX_companion_cavalry_lod_1.cas  
 
  <directory_out>                                    I:\M2TW\M2TWcopy\mods\IWTE/to_dae               
 
  <directory_out>                                    I:\M2TW\M2TWcopy\mods\IWTE/to_dae               
  <dae_file_name_out>                                 ALEX_companion_cavalry_taunt.dae         
+
  <extract_file_name_out>                             ALEX_companion_cavalry_taunt.dae
 +
<extract_file_type>                                dae         
 
  <cas_animation_file_format>                        rtw                                                 
 
  <cas_animation_file_format>                        rtw                                                 
  <create_text_file>                                  yes                                                
+
  <create_text_file>                                  no                                                
 
  <create_task_file_from_input>                      yes                                                 
 
  <create_task_file_from_input>                      yes                                                 
 
  <task_file_full_path_out>                          I:\M2TW\M2TWcopy\mods\IWTE/IWTE_tasks/dae_to_cas_alextaunt_task.txt   
 
  <task_file_full_path_out>                          I:\M2TW\M2TWcopy\mods\IWTE/IWTE_tasks/dae_to_cas_alextaunt_task.txt   
Line 113: Line 137:
 
  "i:/m2tw/m2twcopy/mods/iwte/to_dae/from_dae/lid_57_07 taunt 3.cas"  
 
  "i:/m2tw/m2twcopy/mods/iwte/to_dae/from_dae/lid_57_07 taunt 3.cas"  
  
To get amended units/anims back into game you will need to 'export' 'collada' from Blender or 3dsMax.  The .dae file created will have the same structure whether you're converting to Mesh/Cas model, and Full/XIDX packable anims, so you need to use a task file to specify the format to be returned.  The automatically generated return task file will have assumed you want the same format that went in, so the task file above will have generated this return file:
+
To get amended units/anims back into game you will need to 'export' 'collada' from Blender or 3dsMax, or save as .ms3d from Milkshape.  The .dae/.ms3d file created will have the same structure whether you're converting to Mesh/Cas model, and Full/XIDX packable anims, so you need to use a task file to specify the format to be returned.  The automatically generated return task file will have assumed you want the same format that went in, so the task file above will have generated this return file:
 
  <task_id>                                          dae_to_cas                                    # to read dae file and generate *.cas files
 
  <task_id>                                          dae_to_cas                                    # to read dae file and generate *.cas files
 
  <dae_file_full_path_in>      i:/m2tw/m2twcopy/mods/iwte_v20_12_c/to_dae/ALEX_companion_cavalry_taunt.dae  # *.dae file to read in. i.e. change to collada name exported from Blender
 
  <dae_file_full_path_in>      i:/m2tw/m2twcopy/mods/iwte_v20_12_c/to_dae/ALEX_companion_cavalry_taunt.dae  # *.dae file to read in. i.e. change to collada name exported from Blender
 
  <directory_out>              i:/m2tw/m2twcopy/mods/iwte_v20_12_c/to_dae/from_dae                  # directory to put new created files
 
  <directory_out>              i:/m2tw/m2twcopy/mods/iwte_v20_12_c/to_dae/from_dae                  # directory to put new created files
 
  <cas_mesh_file_name_out>      alex_companion_cavalry_lod_1.cas                                    # *.cas file to be created
 
  <cas_mesh_file_name_out>      alex_companion_cavalry_lod_1.cas                                    # *.cas file to be created
  <cas_animation_file_format>          rtw                                                         #  format of cas to be created by dae (rtw or full)  
+
  <cas_animation_file_format>          rr                                                         #  format of cas to be created by dae (rr, m2 or full)  
 
  <cas_unpacked_skeleton_scale>        1.0000                                                      # cas unpacked skeleton scaling
 
  <cas_unpacked_skeleton_scale>        1.0000                                                      # cas unpacked skeleton scaling
 
  <overlap_frames>                      no                                                          # overlap frames selection used to create the dae (not used on import)
 
  <overlap_frames>                      no                                                          # overlap frames selection used to create the dae (not used on import)
Line 127: Line 151:
 
  #<end_frame>                                        237                                            # Last animated frame (use to see full animation in blender)
 
  #<end_frame>                                        237                                            # Last animated frame (use to see full animation in blender)
  
  if you're trying to convert format, instead of rtw you need to use:
+
If you're trying to convert format, instead of rr you need to use:
 
  <cas_animation_file_format> '''m2'''  #for M2TW anims re-packable by XIDX
 
  <cas_animation_file_format> '''m2'''  #for M2TW anims re-packable by XIDX
  
  <cas_animation_file_format> '''full'''  #for M2TW anims re-packable by '''the game'''
+
  <cas_animation_file_format> '''full'''  #for M2TW anims re-packable by '''the game''' and ALL ENGINE ANIMATIONS
  
 
If you want an M2TW mesh back instead of a .cas model use the  
 
If you want an M2TW mesh back instead of a .cas model use the  
Line 136: Line 160:
 
instead of dae_to_cas
 
instead of dae_to_cas
  
===Creating a simple Multi-weighted Section===
+
Using the 'Animated dae to cas_mesh' ('''4''') button will generate a separate cas model file and a full version anim called _action.  See below for animation  file type details.
'''NOTE: This will not allow you to import a typical M2TW unit with complex weighting directly into RTW!'''
 
  
'''NOTE2:  This only works properly in-game if the MODEL is scaled 1.0, strat models that are normally scaled down x0.7 need to be reduced in size so they can be used at 1.0 scale.'''
+
Using the 'RTW object animation dae to cas' ('''5''') will produce a cas which includes both the model and the animation together, these are used only for [[Spot fx animations and effects|spot_fx]] items in RTW/RR.
  
Contrary to popular belief .cas files allow a '''limited''' amount of vertexes to be assigned with weighting to two bones per vertex, for more details about the limitation see the '''[[Cas_Models#Multi_Bone_Weighting|Cas Models]]''' page.  Also contrary to popular belief bone positions can be '''moved''' as well as rotated in RTW animations, however, the multi-weighting feature and bone movement might not work well together.
+
===Bone Weighting===
 +
RTW battle map units and strat models and M2TW strat models will generally have vertexes weighted to only one bone per vertex.
  
The limit of 100 vertexes in a multi-weighted .cas section appears to be a hard coded limit, IWTE will currently try and split any such group into separate sections.  It is highly recommended that you only attempt to have a few multi-weighted vertexes, such as having a ring of 50/50 weighted vertexes at the Upperarm/Torso junction to smooth out shoulder movement.  Cas files with multi-weighting must use the '''model_flexi_m''' setting to work in-gameThey should work in-game for RTW unit models and for M2TW strat models, however, the .cas models created with this are unlikely to convert/load successfully with any tool other than IWTE currentlyOther existing tools do not export the multi-weighted sections from vanilla models.
+
If you convert a dae with multiple bone weights per vertex to cas with IWTE it will generate one cas with vertexes weighted to up to two bones, and one cas with the suffix "_lod1"The _lod1 cas can be renamed and used for RTW/M2TW.  Ideally however you should limit the bone weight totals yourself so you can check how the model will behave in game when posedSee [[Blender_hints_and_tips#Bone_Assignment|Blender hints and tips]].
  
As an example of how you could easily add some transitional weighting to an RTW unit model, you could add or re-weight verts between the area assigned to the pelvis and the area assigned to the abs bones.  If there is already a wide gap in this area you could add more verts, as you want as few verts that need the multi-weighting as possible, first convert the mesh in that area from tri's to quads:
+
For details on optionally creating a simple multi-weighted Section see: [[Model_flexi_m in RTW]]
  
[[File:Tris-to-quads.jpg|300px|Mesh from tris to quads]]
+
===Cas animation types===
 +
IWTE supports the full (never packed) versions of [[Cas Files|.cas files]], as supplied by Caliban and also the ones that have been generated from Pack files by XIDX, IWTE or similar tools.  PLEASE NOTE: The RTW and M2TW anims generated from the pack files use a different format - DO NOT pack RTW types into M2TW packs or vice-versa - check that you are generating the correct type for the game you are going to use them in!  Also do not attempt to re-pack the full type (where you can see the bone names) with XIDX or IWTE, they will only work if you have a full set including .evt files and let M2TW repack them from descr_skeleton.txt.
  
If you then 'Bisect' this area or otherwise split the edges and then re-triangulate and view in 'Weight Paint' mode, you will see that Blender has assigned the new verts proportionately between the abs and pelvis:
+
NB: All engine animations for RTW, RR and M2TW are the 'full' type.
  
[[File:Bisected-viewed-in-weight-paint.jpg|300px|Bisected area with proportional weighting]]
+
===Recreating full .cas and .evt files from packs===
 +
IWTE will generate full versions of .cas and .evt files from M2TW skeleton and animation packs, and will also generate for you a descr_skeleton.txt file to use to allow the game to re-pack the created animation and event files.  Please note that if the animation files were originally packed from a mod-folder then the skeleton text file will be generated assuming that they will be replaced and packed from the same named folder.
  
The triangles between the two arrows, the ring of verts attached wholly to the Abs bone, and the ring of verts attached wholly to the Pelvis bone will have to be included in a separate 'type 3' section within the .cas file.  IWTE will do this for youDO NOT attempt to split the area into a separate group yourself, this will only result in unnecessary seams and additional 'named' groups which cause other problems with the game limits.  Also please see the section on limitation for this, the shared verts must only be between direct parent/child bones so, Pelvis/Abs works, Pelvis/Torso will not work.
+
Use the button shown below to start the extraction processTo allow the game to re-pack the files they must be copied and moved to the appropriate mod-folder locations.
  
===Multi-weighted sections and bone movement anims===
+
[[File:Iwte-cas-evt-extraction.jpg]]
The video [https://youtu.be/SX_KRViGD-8 here] shows some effects of deliberately exaggerated bone movements during animations, where the unit model also has multi-weighted sections.
 
  
[[File:Game-versus-blender-movement.jpg|300px]]
+
==Units - General Tips==
 +
*Seams - To avoid seams in the finished model you CAN 'weld' vertexes that have disconnected uvs, in Blender use Mesh> Clean Up> Merge by Distance (without uvs ticked), and Shading> Smooth Faces.  That will get you a shared normal that allows the area to look smooth.  For the game IWTE will generate two vertexes at that point to preserve the uvs and set that normal as a custom normal for each.
  
In the above picture the sections of the shoulder pad that are partially weighted to Torso/Upperarm show as stretching evenly between the two bones when the Upperam bone is moved away in Blender.  (similarly for the head section which has been partially weighted to the torso)  In game although these sections remain at the correct angle all the vertexes with the Upperarm as child bone have moved with it in a way proportional to the original distance between the bones, and not proportional to the new extended distance. The inset in the below picture shows what is effectively happening with the sections partially weighted to the upperarm bone following it and ignoring the extended distance
+
*Anims/skeletons - In Blender you can make any alteration you like to the 'Pose Mode' this will only affect the animation frames.  Do NOT, unless you know what you are doing...  move or edit the bones in the 'Armature' edit mode, this will affect the bone positions in the model/anim.cas produced, and will need to be matched to a skeleton with the same bone positions.   If using the "full" M2TW cas anims that the game re-packs you can adjust the bone positions for a folder of .cas anims by using the skeleton replacement method detailed belowIf using XIDX unpacked/packed anims you will need to change the skeleton using other tools.
 
 
[[File:Multi-weight and bone move.jpg|300px]]
 
 
 
Multi-weighted sections do however behave as expected where the bones are rotatedThis poor chap has had his chin and face partially weighted to his torso, as you can see the effect in game is the same as shown in Blender:
 
 
 
[[File:Game-versus-blender-rotate.jpg|300px]]
 
  
===.cas animation types===
+
==Animations - General Tips==
The tool supports the full (never packed) versions of .cas files, as supplied by Caliban and also the ones that have been generated from Pack files by XIDX or similar decompression and splitting toolsPLEASE NOTE: The RTW and M2TW anims generated from the pack files use a different format - DO NOT pack RTW types into M2TW packs or vice-versa - check that you are generating the correct type for the game you are going to use them in! Also do not attempt to re-pack the full type (where you can see the bone names) with XIDX, they will only work if you have a full set including .evt files and let M2TW repack them from descr_skeleton.txt.
+
*Blender must be set to 20fps BEFORE importing a .dae with animation created by IWTETo do this use the custom setting and type in 20. When you import a .dae file you should then see the keyframes neatly aligned with the time markers. See below:
  
==Units - General Tips==
+
[[File:20fps.jpg|200px]]
*Seams - To avoid seams in the finished model you CAN 'weld' vertexes that have disconnected uvs, in Blender use Mesh> Clean Up> Merge by Distance (without uvs ticked), and Shading> Smooth Faces.  That will get you a shared normal that allows the area to look smooth.  For the game IWTE will generate two vertexes at that point to preserve the uvs and set that normal as a custom normal for each.
 
  
*Anims/skeletons - In Blender you can make any alteration you like to the 'Pose Mode' this will only affect the animation frames. Do NOT, unless you know what you are doing...  move or edit the bones in the 'Armature' edit mode, this will affect the bone positions in the model/anim.cas produced, and will need to be matched to a skeleton with the same bone positions.  If using the "full" M2TW cas anims that the game re-packs you can adjust the bone positions for a folder of .cas anims by using the skeleton replacement method detailed below.  If using XIDX unpacked/packed anims you will need to change the skeleton using other tools.
+
==Mesh Names/Comments==
 +
The Blender .dae interface does not support comments, so all the information about the mesh sections (primary/secondary weapons etc.) needs to go in the mesh name:
  
 
*Section Naming - For Blender the full details of the group names are stored in the name itself.  There isn't a comment section like milkshape.  Things that need to go back into the game as separate sections, e.g. to denote primary weapons, or alternate versions, need a double underscore __ to show where the name should be split or a space included.  For M2TW mesh sections that you want to be optional, use __opt at the end of the group name.
 
*Section Naming - For Blender the full details of the group names are stored in the name itself.  There isn't a comment section like milkshape.  Things that need to go back into the game as separate sections, e.g. to denote primary weapons, or alternate versions, need a double underscore __ to show where the name should be split or a space included.  For M2TW mesh sections that you want to be optional, use __opt at the end of the group name.
Line 202: Line 222:
 
:you can delete copy or move keyframes around for selected bones in the Dope Sheet section
 
:you can delete copy or move keyframes around for selected bones in the Dope Sheet section
  
*Export collada - in settings check Anim is on Matrix option and 'keep keyframes' and 'all keyed curves' are selected
+
*Export collada - in settings check Anim is on Matrix option and 'keep keyframes' and 'all keyed curves' are selected.
 
+
'''DO NOT USE IWTE Model Files > Siege Engine dae to mesh  to convert back'''  the dae doesn't include enough info to retain the three textures named in the mesh .
'''Temporary Note for IWTE version B:
 
  
!!!!!!!DO NOT USE IWTE Model Files > Siege Engine dae to mesh  to go back....  the dae doesn't include enough info to get the mesh textures back properly!!!!!!!!
+
*USE the "dae_to_mesh_*****_task.txt" that IWTE has written into the "IWTE_Tasks" sub-folder where your IWTE.exe is
 
 
USE the "dae_to_mesh_*****_task.txt" that IWTE has written into the "IWTE_Tasks" sub-folder where your IWTE.exe is
 
 
:change the .dae name you're reading in to the one you've just saved - change any other output names IF you need to
 
:change the .dae name you're reading in to the one you've just saved - change any other output names IF you need to
:check the number of frames listed ties up with the end frame you set in collada - for version B of IWTE you need to add the line.
+
:check the number of frames listed ties up with the end frame you set in collada.
::''<mesh_compressed>            no''
 
:below the mesh section.  The need to do this will be fixed in version C.'''
 
  
 
*Run the task file from the IWTE Task button in top menu bar, the separate files will be saved where specified in the task file.
 
*Run the task file from the IWTE Task button in top menu bar, the separate files will be saved where specified in the task file.
Line 218: Line 233:
 
*If you have changed the number of bones used or their positions you will need to align all the other .cas anims used by the mesh, to do this use the skeleton replacement process explained below.
 
*If you have changed the number of bones used or their positions you will need to align all the other .cas anims used by the mesh, to do this use the skeleton replacement process explained below.
  
==Skeleton Replacement==
+
==Skeleton Replacement (M2TW)==
 
''RTW and packed M2TW skeletons can not be changed via this method.'' <br>
 
''RTW and packed M2TW skeletons can not be changed via this method.'' <br>
 
To replace the skeleton in M2TW where you have the set of full .cas anims that the game re-packs in the IWTE top menu bar go to:
 
To replace the skeleton in M2TW where you have the set of full .cas anims that the game re-packs in the IWTE top menu bar go to:
Line 243: Line 258:
 
* Directory in is optional, alternatively the task file can be placed in the directory and launched from there
 
* Directory in is optional, alternatively the task file can be placed in the directory and launched from there
 
* Directory out is optional, if not given a sub-folder /updateskeletons will be created
 
* Directory out is optional, if not given a sub-folder /updateskeletons will be created
 +
 +
===Fixing Floating Units===
 +
For how to create the new basepose see [[Blender_hints_and_tips#Fixing_Floating_Units|Blender Hints and Tips]]
 +
 +
Once you have the new basepose.cas you need to use it as the source to replace the bone positions in ALL of the animations the unit uses.  For strat_models if you haven't already edited the .cas files of all the effected models include them in the skeleton replacement process too.
 +
 +
==Weapon Animations (M2TW)==
 +
M2TW includes the possibility of having 'add-on' animations for weapons/shields.  These are commonly listed in the model db file but rarely actually used.
 +
 +
The advantage of properly using the weapon bones and anims instead of adding additional 'normal' bones to the skeleton is that the main skeleton remains 'standard' and does not cause the victim death anim bug when in battle with units whose skeletons have different numbers of bones!
  
 
==IWTE Task File Options==
 
==IWTE Task File Options==
Line 259: Line 284:
 
[[Category:M2TW Modding]]
 
[[Category:M2TW Modding]]
 
[[Category:Blender]]
 
[[Category:Blender]]
 +
[[Category:RTW Modding]]

Latest revision as of 08:12, 17 June 2023

Rome:Total War & Remastered - Modding Index

M2TW Modding Index


IWTE
IWTE main page

Useful Reference:


Tips and instructions for working with RTW and M2TW battle map units and strat map characters via IWTE and Blender using the .dae format.

The .dae files used for the Collada import/export can also be used with 3ds Max, however, max users absolutely have to use the OpenCollada plugin and file format when importing/exporting files, max comes with the AutodeskCollada file format by default which neither imports nor exports files from the game correctly.

  • IWTE download here - please use the latest version, early versions do not have this functionality.
  • For queries about these functions please ask here.
  • For information on working on M2TW Settlements in Blender see IWTE - Settlements in Blender
  • For general tips on working with Blender see Blender hints and tips
  • For related info about .cas file structure see here


Export and Import M2TW .mesh Units

The most useful method of export involves matching the unit .mesh with its skeleton basepose and one or more animations.

The drop-down menu in IWTE allows a unit .mesh to be merged with its basepose skeleton and one animation. A task file is needed to allow combining of animations and is the only way to also incorporate weapon animations.

The drop-down menu options, and alternative IWTE Task button options are described below:

Export-mesh-in-IWTE.jpg

1. For Blender select the 'Unit mesh/skel/casanim to dae' option if you have the skeleton and animation versions unpacked using XIDX etc.
2. For Blender select 'Unit mesh to dae' if you have the "full" version of the .cas basepose and animations (the ones the game re-packs as supplied by Caliban/Devkit/IWTE).
3. For Milkshape select the 'Unit mesh/skel/casanim to ms3d' option if you have the skeleton and animation versions unpacked using XIDX.
4. For Blender select 'Unit mesh to ms3d' if you have the "full" version of the .cas basepose and animations (the ones the game re-packs as supplied by Caliban/Devkit/IWTE).

For all of the above options select the Double Textured option for unit meshes that have both a main and attachment texture. Select the Single Textured option for most other cases (e.g. standard mounts).

You will be prompted to select the model .mesh first, then the basepose.cas for the skeleton (full cas version) or the unpacked skeleton file (unpacked version), and then an animation.cas file that is compatible with that skeleton (this should be in the same format as the skeleton, full or unpacked).

Export/Import by Task Process

To generate a .dae or .ms3d file from .mesh and .anims via the task process you will need a text file ending in _task.txt which starts with the mesh to dae command, run the task file by selecting the 'IWTE Task' > 'Select Task File' buttons. See example below for mesh_to_dae (the extra line breaks have been included just to show the body/weapon pairing):

<task_id>                              mesh_to_extract 
<mesh_file_full_path_in>               C:\M2TW\mods\devkit\data\animations\EB_Slinger\numidian_slinger_lod0.mesh 
<mesh_type>                            unit                        # line can be omitted if not also adding mount
<mesh_double_texture>                  yes                         # or 'no' for single texture
<cas_file_types_in_list>               body weapon                

<directory_out>                        C:\M2TW\mods\devkit\data\animations\EB_Slinger  
<extract_file_name_out>                EBslingerAnims.ms3d 
<extract_file_type>                    ms3d                        # or 'dae' for Blender
<create_text_file>                     no                          # or 'yes' for summary files, 'full' for detailed files
<task_file_full_path_out>              C:\IWTE/IWTE_tasks/ms3d_to_mesh_slinger_task.txt   # name for your return task file 
   
<cas_file_full_path_in_default_list> 
C:\M2TW\mods\devkit\data\animations\EB_Slinger\EB_Slinger_basepose.cas 
C:\M2TW\mods\devkit\data\animations\EB_Slinger\Weapon\w_EB_Slinger_default.cas

<cas_file_full_path_in_action_list> 
C:\M2TW\mods\devkit\data\animations\EB_Slinger\EB_Slinger_stand_A_idle.cas	
C:\M2TW\mods\devkit\data\animations\EB_Slinger\Weapon\w_EB_Slinger_default.cas 

C:\M2TW\mods\devkit\data\animations\EB_Slinger\EB_Slinger_attack_missile_ready.cas	
C:\M2TW\mods\devkit\data\animations\EB_Slinger\Weapon\w_EB_Slinger_attack_missile_ready.cas 

Please see the IWTE example control processes.txt file that ships with IWTE for further details/instructions.

Running the task will generate you a .ms3d or .dae file with the animations joined together with an additional 'basepose' frame added at frame 0, to aid editing. The task will also auto-generate for a reverse dae/ms3d_to_mesh_****_task.txt file for you, this will list the start and end frame positions of all included animations and the names of all the files that will be re-created from your file. The names and frame positions can be edited to suit any changes you may require before running the return task.

When creating the task files it is common to make minor errors in the file names/paths that mean IWTE cannot find all the elements! If you get an error message whilst running the task you'll get a chance to read the error message (which is easier in the command window) - you can then click "Ignore" to keep IWTE open, fix the name/path/file issue in the .txt file and try running the task again. The error message should indicate which file it couldn't find. If you forget to add the file extension and try and get it to open a folder you'll get an 'access violation' type message.

For unit models that do not have any elements weighted to the 'weapon bones' you only need to run the process with

<cas_file_types_in_list> body

and supply the main skeleton basepose and animation.

If the mesh has a weapon weighted to weapon bones use the body weapon example shown above.

If the mesh has both a weapon weighted to weapon bones and a shield weighted to bone_shield etc use

<cas_file_types_in_list> body weapon shield

and supply the main skeleton, weapon animation and shield animation baseposes and animations in sets of three in order.

Note: a lot of models that are apparently using fs_test_shield according to their battle_models.modeldb entry don't actually have anything weighted to bone_shield, making the shield 'anim' irrelevant.

UV Mapping for Double Texture Units

The mesh format for both double and singled textured units in M2TW is actually exactly the same with just one set of uv's that should range from 0 to 1.0 in both horizontal and vertical axis.

If you assign two textures to a unit in the battle_models.modeldb then the game expands out the horizontal axis of the uv maps so that the area from 0 to 0.5 is used to cover 0 to 1 on the first texture, and the uv's from 0.5 to 1.0 on the horizontal axis are used to cover 0 to 1 on the second texture.

Milkshape/.mesh converters use the texture (Main or Attachment) assigned to a mesh group to determine which section of the uv map the group's uv coordinates will be moved to. On write back the Main texture co-ordinates are compressed into the 0>0.5 area and Attachment texture co-ordinates compressed into the 0.5>1.0 section.

The IWTE mesh to .dae for Blender process works differently. The texture assignment process is used purely so you can view the mesh groups with the correct relevant texture. The 0>1.0 horizontal uvs are expanded to 0>2.0 if you use the process for 'double textures' and then compressed back to 0>1.0 on the return to .mesh.

In Blender the uv mapping to the two textures will look like the image below.

Uvs for double textured units.jpg

To see the 2nd texture under its uv's open the sidebar (n) in the uv screen and select the 'repeat texture' button. In Blender it is possible to partially assign some triangles from a group to the 1st texture and some triangles to the 2nd texture, if you do that please remember to also move the uv's to the appropriate zone.

Scaling of Anims

The 'full' cas animations as supplied by Caliban should be regarded as scale 1.0. If you need to load from them to suit a skeleton that will be scaled by the game you need to give IWTE the skeleton scale in the mesh_to_extract task using the appropriate tag e.g.
<skeleton_scale>
<mount_skeleton_scale>

If you load from the unpacked skeleton and unpacked animation the scale will be read from the skeleton, so you do not need to add any further information.

Export and Import RTW Units & RTW/M2TW Strat Characters

NOTE: IWTE now supports the full weighting allowed in Rome Remastered by default - to ensure you do not create RTW/M2TW cas files that exceed their games capabilities add <cas_mesh_format> rtw (or M2) to the task file.


The process for this is similar to the .mesh Export/Import process described above, the button locations are shown in the below image:
Exporting animated cas to date with IWTE

1. For Blender to convert cas model with skeleton and animations unpacked from the RTW/RR animation pack files. The first file requested will again be the .cas 'mesh', e.g. model. The second file requested will be the skeleton file (as produced by XIDX/tool using extract_skeletons). The third file requested will be the .cas animation file (as produced by XIDX/tool using extract_animations).
2. For Blender to convert cas model with skeleton and animations unpacked from the M2TW animation pack files. Works as above.
3. For Blender to convert cas model if you have the full versions of the animation files, e.g the type supplied by Caliban that M2TW itself re-packs or engine animations. The first file requested will be the .cas 'mesh', e.g. the one with the body model in it. The second file requested will be an animation file, if you do not have a suitable animation file just click 'Cancel' to close the selection screen. You can use the 'Animated cas/dae' button for all unit/character .cas files even if you aren't going to load an animation.
4. For Blender this button is designed for converting static cas models.
5. For Milkshape as option 2 above.
6. For Milkshape as option 3 above.
7. For Milkshape as option 4 above.
A. Can be used for writing back to .cas model/animations but task file method is prefered.
B. Must be used if you need the model AND animation in one .cas file (applicable to RTW/RR spot effects only).

Processes 1-7 will generate a .dae/.ms3d file in a to_dae/ms3d sub-folder where your IWTE.exe is located. You will also have two task files generated in the /iwte_tasks sub-folder. The ms3d/dae_to_cas one provides a default task file for reversing the process and generating new .cas files. The cas_to_dae/ms3d one allows you to repeat the process you just did by simply running the IWTE Task, you can also adapt that task file to load multiple animations. The following is an example task file for cas_to_dae with multiple anims, and using rtw skeleton and anims, note that if the file path/name has spaces the entire path needs to be inside " ", also note the skeleton name does not have a file extension, direction of \ or / doesn't matter:

<task_id>                                           cas_to_extract                                               
<cas_mesh_file_full_path_in>                        I:\M2TW\M2TWcopy\mods\IWTE\to_dae/from_dae/ALEX_companion_cavalry_lod_1.cas 
<directory_out>                                     I:\M2TW\M2TWcopy\mods\IWTE/to_dae               
<extract_file_name_out>                             ALEX_companion_cavalry_taunt.dae
<extract_file_type>                                 dae        
<cas_animation_file_format>                         rtw                                                 
<create_text_file>                                  no                                                
<create_task_file_from_input>                       yes                                                
<task_file_full_path_out>                           I:\M2TW\M2TWcopy\mods\IWTE/IWTE_tasks/dae_to_cas_alextaunt_task.txt  
<skeleton_unpacked_file_full_path_in>               I:\M2TW\M2TWcopy\mods\IWTE\testthings\animations\rome_animations/fs_swordsman
<cas_file_full_path_in_action_list>                                                                               
"i:/m2tw/m2twcopy/mods/iwte/to_dae/from_dae/lid_57_04 taunt 2.cas"                                             
"i:/m2tw/m2twcopy/mods/iwte/to_dae/from_dae/lid_57_06 taunt 1.cas"                                             
"i:/m2tw/m2twcopy/mods/iwte/to_dae/from_dae/lid_57_07 taunt 3.cas" 

To get amended units/anims back into game you will need to 'export' 'collada' from Blender or 3dsMax, or save as .ms3d from Milkshape. The .dae/.ms3d file created will have the same structure whether you're converting to Mesh/Cas model, and Full/XIDX packable anims, so you need to use a task file to specify the format to be returned. The automatically generated return task file will have assumed you want the same format that went in, so the task file above will have generated this return file:

<task_id>                                           dae_to_cas                                     # to read dae file and generate *.cas files
<dae_file_full_path_in>       i:/m2tw/m2twcopy/mods/iwte_v20_12_c/to_dae/ALEX_companion_cavalry_taunt.dae   # *.dae file to read in. i.e. change to collada name exported from Blender
<directory_out>               i:/m2tw/m2twcopy/mods/iwte_v20_12_c/to_dae/from_dae                  # directory to put new created files
<cas_mesh_file_name_out>      alex_companion_cavalry_lod_1.cas                                     # *.cas file to be created
<cas_animation_file_format>           rr                                                          #  format of cas to be created by dae (rr, m2 or full) 
<cas_unpacked_skeleton_scale>         1.0000                                                       # cas unpacked skeleton scaling
<overlap_frames>                      no                                                           # overlap frames selection used to create the dae (not used on import)
<cas_file_name_out_anim_split_list>                                                                # cas anim files start and end frames
"lid_57_04 taunt 2.cas"                                 1   79                                                          
"lid_57_06 taunt 1.cas"                                80  162                                                          
"lid_57_07 taunt 3.cas"                               163  237                                                          
#<end_frame>                                        237                                            # Last animated frame (use to see full animation in blender)

If you're trying to convert format, instead of rr you need to use:

<cas_animation_file_format> m2  #for M2TW anims re-packable by XIDX
<cas_animation_file_format> full  #for M2TW anims re-packable by the game and ALL ENGINE ANIMATIONS

If you want an M2TW mesh back instead of a .cas model use the

<task_id>   dae_to_mesh

instead of dae_to_cas

Using the 'Animated dae to cas_mesh' (4) button will generate a separate cas model file and a full version anim called _action. See below for animation file type details.

Using the 'RTW object animation dae to cas' (5) will produce a cas which includes both the model and the animation together, these are used only for spot_fx items in RTW/RR.

Bone Weighting

RTW battle map units and strat models and M2TW strat models will generally have vertexes weighted to only one bone per vertex.

If you convert a dae with multiple bone weights per vertex to cas with IWTE it will generate one cas with vertexes weighted to up to two bones, and one cas with the suffix "_lod1". The _lod1 cas can be renamed and used for RTW/M2TW. Ideally however you should limit the bone weight totals yourself so you can check how the model will behave in game when posed. See Blender hints and tips.

For details on optionally creating a simple multi-weighted Section see: Model_flexi_m in RTW

Cas animation types

IWTE supports the full (never packed) versions of .cas files, as supplied by Caliban and also the ones that have been generated from Pack files by XIDX, IWTE or similar tools. PLEASE NOTE: The RTW and M2TW anims generated from the pack files use a different format - DO NOT pack RTW types into M2TW packs or vice-versa - check that you are generating the correct type for the game you are going to use them in! Also do not attempt to re-pack the full type (where you can see the bone names) with XIDX or IWTE, they will only work if you have a full set including .evt files and let M2TW repack them from descr_skeleton.txt.

NB: All engine animations for RTW, RR and M2TW are the 'full' type.

Recreating full .cas and .evt files from packs

IWTE will generate full versions of .cas and .evt files from M2TW skeleton and animation packs, and will also generate for you a descr_skeleton.txt file to use to allow the game to re-pack the created animation and event files. Please note that if the animation files were originally packed from a mod-folder then the skeleton text file will be generated assuming that they will be replaced and packed from the same named folder.

Use the button shown below to start the extraction process. To allow the game to re-pack the files they must be copied and moved to the appropriate mod-folder locations.

Iwte-cas-evt-extraction.jpg

Units - General Tips

  • Seams - To avoid seams in the finished model you CAN 'weld' vertexes that have disconnected uvs, in Blender use Mesh> Clean Up> Merge by Distance (without uvs ticked), and Shading> Smooth Faces. That will get you a shared normal that allows the area to look smooth. For the game IWTE will generate two vertexes at that point to preserve the uvs and set that normal as a custom normal for each.
  • Anims/skeletons - In Blender you can make any alteration you like to the 'Pose Mode' this will only affect the animation frames. Do NOT, unless you know what you are doing... move or edit the bones in the 'Armature' edit mode, this will affect the bone positions in the model/anim.cas produced, and will need to be matched to a skeleton with the same bone positions. If using the "full" M2TW cas anims that the game re-packs you can adjust the bone positions for a folder of .cas anims by using the skeleton replacement method detailed below. If using XIDX unpacked/packed anims you will need to change the skeleton using other tools.

Animations - General Tips

  • Blender must be set to 20fps BEFORE importing a .dae with animation created by IWTE. To do this use the custom setting and type in 20. When you import a .dae file you should then see the keyframes neatly aligned with the time markers. See below:

20fps.jpg

Mesh Names/Comments

The Blender .dae interface does not support comments, so all the information about the mesh sections (primary/secondary weapons etc.) needs to go in the mesh name:

  • Section Naming - For Blender the full details of the group names are stored in the name itself. There isn't a comment section like milkshape. Things that need to go back into the game as separate sections, e.g. to denote primary weapons, or alternate versions, need a double underscore __ to show where the name should be split or a space included. For M2TW mesh sections that you want to be optional, use __opt at the end of the group name.

Siege/Artillery Engines

Siege/Artillery for both RTW and M2TW use the "full" cas anim versions (not packed/unpacked at any stage). For M2TW use the dedicated Model Files > Mesh Models > Siege Engine mesh to date for export and IWTE Task import process. For RTW use the Model Files > Cas Models > Animated cas_mesh to date, the RTW process seems to be quite straightforward as there isn't the mis-alignment between bone names and start poses that is present in M2TW.

M2TW Siege Engine Skeleton Alteration Example Process

  • In top menu bar go to Model Files > Siege Engine mesh to dae > select mesh, then default cas then anim cas.
Check that the default .cas is actually the one listed as anim-default in descr_engine_skeleton.txt
also check that you're using an anim that is in use in game - some of the anims in the folder don't work.
  • IWTE will have written a .dae file in "to_dae" sub-folder below your .mesh model location.
  • Load in Blender by using 'file' 'import' 'collada'
  • Add bones as required to the Armature - note there should only be one top level bone, e.g bone_body add all other bones as child of this, or of existing bones.
  • Use 'weight paint' to assign vertices to bones as required.
Note - the .mesh file will only accept vertexes weighted to a max of 2 bones
use 'limit total' in 'weights' menu and set to 2 to avoid any verts weighted to 3 or more bones - (this is applied to selected verts only)
use 'normalise all' to make sure verts are fully weighted, use 'auto normalise' option whilst working also
  • change animation by switching to 'animation' layout in top bar
trigger Pose mode by clicking pose running man symbol within the Armature
if you can't see bones, or the summary when you click them, in main sidebar click the pose (running man) button, select "viewport display" and select the "in front" option
when you move a bone in the pose mode use shortcut "i" in main window to open keyframe dialogue and select "LocRot"
you can delete copy or move keyframes around for selected bones in the Dope Sheet section
  • Export collada - in settings check Anim is on Matrix option and 'keep keyframes' and 'all keyed curves' are selected.

DO NOT USE IWTE Model Files > Siege Engine dae to mesh to convert back the dae doesn't include enough info to retain the three textures named in the mesh .

  • USE the "dae_to_mesh_*****_task.txt" that IWTE has written into the "IWTE_Tasks" sub-folder where your IWTE.exe is
change the .dae name you're reading in to the one you've just saved - change any other output names IF you need to
check the number of frames listed ties up with the end frame you set in collada.
  • Run the task file from the IWTE Task button in top menu bar, the separate files will be saved where specified in the task file.
  • If you have changed the number of bones used or their positions you will need to align all the other .cas anims used by the mesh, to do this use the skeleton replacement process explained below.

Skeleton Replacement (M2TW)

RTW and packed M2TW skeletons can not be changed via this method.
To replace the skeleton in M2TW where you have the set of full .cas anims that the game re-packs in the IWTE top menu bar go to:

Model Files > Cas Models > Skeleton Replacement
  • On the first prompt select the .cas file containing the bones in the basepose positions you want (probably the default or basepose .cas)
  • On the second prompt select the FOLDER that contains all the .cas files you want to change.

The revised files will be saved in a sub folder of that folder called "updateskeletons" they will have the same names as the original .cas files and can be used to directly replace them. Please back-up your original files before doing this, and remember that other .cas/.mesh models may be using the same files, so you may need to create a separate folder and separate entry in descr_skeleton.txt etc.

Adding bones should be straightforward, if you delete bones that had child bones then the result may be unpredictable and the resulting animations may need editing.

Bone Renaming Task

To rename the bones throughout a folder of full .cas animations use a task file. If you want to swap the names of bones you need to add an additional stage to re-name one bone to a temporary name, the example below shows how to swap bone_H_Saddle and bone_Spine names with each other:

<task_id>     cas_bone_name_change      
<directory_in>   I:\M2TW\mods\WD_PKH\data\animations\pkh_horse_marka 
<directory_out>    I:\M2TW\mods\WD_PKH\data\animations\pkh_horse_marka\changedbones   
<bone_name_change_list>                       
bone_H_Saddle          bone_H_Saddlex
bone_Spine      bone_H_Saddle
bone_H_Saddlex          bone_Spine
  • The task cas_bone_name_change changes a bone name (the NEW name must not already exist in a skeleton this is being applied to)
  • Directory in is optional, alternatively the task file can be placed in the directory and launched from there
  • Directory out is optional, if not given a sub-folder /updateskeletons will be created

Fixing Floating Units

For how to create the new basepose see Blender Hints and Tips

Once you have the new basepose.cas you need to use it as the source to replace the bone positions in ALL of the animations the unit uses. For strat_models if you haven't already edited the .cas files of all the effected models include them in the skeleton replacement process too.

Weapon Animations (M2TW)

M2TW includes the possibility of having 'add-on' animations for weapons/shields. These are commonly listed in the model db file but rarely actually used.

The advantage of properly using the weapon bones and anims instead of adding additional 'normal' bones to the skeleton is that the main skeleton remains 'standard' and does not cause the victim death anim bug when in battle with units whose skeletons have different numbers of bones!

IWTE Task File Options

Text File Output

using <create_text_file> you can optionally generate .txt files that show, for information purposes only, the content of the incoming .mesh/.cas files, the default option is

<create_text_file> no  #stops any text file being created 
<create_text_file> yes  #creates a summary text file with header/trailer info, numbers of verts, texture and mesh names etc.
<create_text_file> full  #creates a full text file showing the interpretation of all the ints/floats etc in the file, with comments


External Links