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.

IWTE - Units in Blender/Milkshape

From TWC Wiki
Revision as of 12:58, 4 December 2020 by Makanyane (talk | contribs)
Jump to navigationJump to search
M2TW Modding Index


Tips and instructions for working with M2TW battle map units via IWTE and Blender using the .dae format - December 2020 version onwards.

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.


Export and Import

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 button location is shown below:

Export-mesh-in-IWTE.jpg

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). You will be prompted to select the model .mesh first, then the basepose.cas for the skeleton, and then optionally any number of animation.cas files that are compatible with that skeleton. Press cancel when you have loaded all the animations you want to view in the one file.

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. See example below:

<task_id> mesh_to_dae

<mesh_file_full_path_in> C:\M2TW\mods\devkit\data\animations\EB_Slinger\numidian_slinger_lod0.mesh

<mesh_double_texture> yes

<cas_file_types_in_list> body weapon

<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

<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. (the code is hard to display well on wiki!)

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.

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.

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 weights' and set to 2 to avoid any verts weighted to 3 or more bones
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

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 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.

<mesh_compressed> no

below the mesh section. 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.
YOU can help us improve this Wiki! ~ Look for ways to help and editing advice. ~ If you need further advice, please post here.