Strat Models - M2TW
For everything you always wanted to know about the campaign map models in M2TW.
The campaign map models in M2TW are based on .cas models for mesh and animations and .tga textures. All of the strat elements seem to have problems with shadows if vertexes are placed too close together on the line of the light rays.
Strat Flag
The strat flag carried by units consists of one .cas model to which each faction's symbol is applied. The size of the displayed symbol cannot be altered by changing the .cas model.
The model comprises three components:
- banner
- pole
- symbol
The background the faction's symbol is displayed on is the 'banner' mesh in the model, this has to be one flat plane, it appears to have a texture uv mapped onto the plane, but the uv map used by the game is actually just the co-ordinates given for 'flag' in descr_standards.txt. The visible parts of the texture are also overlayed with the faction's colour with a darker section that expands from the bottom that shows the strength of the army. If you apply an alpha channel to the texture then the faction colour background also won't be shown in any alpha'd out area. The position of the faction's symbol in left/right and up/down plane is determined by a hard-coded relationship to the 'banner' mesh, so changing the size of the banner mesh can also move the symbol position.
In terms of depth the texture of the banner, and the faction/strength colouring is always shown as though the mesh were at zero on the front/back axis, but the faction symbol position moves to the front/back axis location of the 'banner' mesh. The banner mesh therefore needs to be slightly in front of 0 in the front/back axis so the faction symbol appears in front of it.
The 'pole' is a conventional piece of mesh with texture.
The 'symbol' mesh although required doesn't appear to do anything if changed.
The flag moves roughly as if its 0,0,0 location was attached to the Bone_Lhand of strat army characters. Moving this bone underground in the anims can hide the flag. For occupied settlements the flag position is set by the 'symbol' position in the residence .cas.
Strat Characters
The Strat Flag position follows roughly the path of the Bone_Lhand in the strat character skeleton. It seems to follow a smoothed less exact path, so can appear out of sync with some movements.
Strat character models and anims can have up to 24 bones in addition to the Scene Root.
The basepose in the strat animations is only used to name the bones, changing the x,y,z locations of bones in it will not affect the animations. It overrides the naming of the bones in animation and mesh .cas's - so if the 5th bone in the basepose.cas is Bone_Lhand, it will be the 5th bone in the anim that the banner follows.
Strat characters use a separate shadow.cas this is a simplified figure with the same skeleton as the visible character, this figure is not textured and is used by the game solely to cast the shadow, thus avoiding the problems caused if you try and cast a shadow from a complex object.
Strat Trees
Trees appear to sway, but they don't have an animation in the .cas file. The sway seems to be a hard-coded movement around their 0,0,0 location.
Trees are not revolved on the campaign map, and 'back-faces' of the model aren't seen, so some detail at the rear of models can be omitted.
Tree models used in the 'canopy' section of dense_forest do not cast shadows (even if they're the same models that cast shadows when used as single trees), the ground under the canopy section is also not textured and appears black, which can give the allusion of shadow through the gaps in the canopy.
Textures with alpha'd out sections can be used for strat trees, and you will be able to see through the 'hole' made by the alpha, however, the game does not show cast shadows in the section seen through the texture, this generally makes alpha'd out elements look bad!
Bridges
The bridge .cas models are revolved by the game to 0, 90, 180 and 270 degrees to suit the river angle and direction. Unfortunately, the shadow cast by the model only revolves between 0 and 90, you therefore need a model that is symmetrical about its x and y axis so the shadow cast at 0 angle looks correct for the model revolved to 180!