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.

Spot fx animations and effects

From TWC Wiki
Revision as of 05:08, 30 November 2021 by Makanyane (talk | contribs) (note about spot_fx not applying to settlement view)
Jump to navigationJump to search

Effects such as smoke, or animated effects such as the gatehouse flags are added to RTW and Rome Remastered using the spot_fx system.

Animated items added by spot_fx will appear in custom and campaign map battles, but are not rendered in the settlement view option launched from campaign without a battle.

Spot_fx

The spot_fx is a .cas model which gives the location and rotation of the effect - the name of the mesh/es inside the .cas match the name of the effect to be called. If you need two versions of the same effect you'd use 'smoke00' and 'smoke01' etc.

The blacksmiths and armourers have examples of spot_fx using smoke. The .cas is added to the buildings dbb listing after the physical_info line:

barbarian_armourer
{
	stat_cat medium_wooden
	localised_name barbarian_armourer
	level
	{
		min_health 1
		battle_stats
		item		barbarian_armourer
		physical_info	info_barbarian_armourer.cas
		spot_fx		barbarian_armourer_spot_fx.CAS
	}

The gatehouse buildings have examples of spot_fx files which call animated 'models_spot' which give the animated flag effects.

The .cas files for spot_fx are placed in data/models_building/spot_fx.

Changing spot_fx cas files

Versions of IWTE from v21_11_c.exe onwards will correctly export and import the fx cas files to .dae for Blender/Max.

The important thing to note is the mesh naming and the transforms. The transforms tell the game where the effect should be moved to. To add a new mesh create a flat plane at 0,0,0 if you need to include a rotation change the shape in EDIT mode so you can tell which way you've turned the plane. Then in OBJECT mode move and rotate the plane so it is centered where you want the effect. DO NOT apply the transforms, the end result in Blender still needs to show the transform values, see pic below:

How the spot_fx file should look in object mode in Blender

Earlier tools for .cas conversion did not add the transform information in the correct format, this caused the misaligned and huge versions of spot_fx effects.

Models_spot

Data/models_building/models_spot/flag_horizontal_large.cas is an example of an animated spot effect. The flag uses an armature and keyframes that are contained in the same file as the model, and does not use an external skeleton.

The models_spot need to be added to the game in the same way as building items. The existing ones are found in data/descr_items/di_spot_items.txt. The horizontal flag is coded as:

type					flag_horizontal_large
lod
max_distance				200
model_anim					models_spot/flag_horizontal_large.CAS
lod
max_distance				4000
model_rigid					models_spot/flag_horizontal_large_low.CAS

Note that the model_anim setting is needed for the high lod to use its animation. The model_rigid version is provided to stop the game having to animate the object when out of viewing distance.

In addition to being added as building items the models_spot need to be added to spot_items in descr_building_battle.txt, the vanilla entries just include:

spot_items
{
 flag_vertical_small
 {
  any			flag_vertical_small
 }
 flag_vertical_large
 {
  any			flag_vertical_small
 }
 flag_horizontal_large
 {
  any			flag_horizontal_large
 }
}

The part in italics is the spot_fx name which needs to be used in the _fx.cas as a mesh name, the part in bold is the models_spot item name.

You can add additional spot_items. Getting the models_spot.cas to convert to a .item file requires the same procedure as generating other building items (delete your descr_items.db to get a new item added, delete the .item file if you want to use an updated .cas model for an existing item)

Changing models_spot cas files

IWTE will export the existing flag_horizontal_large.cas to .dae - if you import that to Blender you will see it contains an armature and simple animation. If you want to amend that file you can add bones, more mesh, change the animations etc., there doesn't seem to be a bone limit or any presets required for Rome Remastered models_spot.

For IWTE dae to cas please leave the first bone of the armature called bone_something, so it recognises its meant to keep the armature! To get the animation and model in the same cas you will need to use the new button 'RTW object animation dae to cas'.

Location of new combined animation button

If you want to create complex animations that involve some bone movement or large rotations you will need to simplify the Armature structure, the models_spot system does not seem to render parented bone structures with complex movements properly. For example with a horse or human animation the armature should have all the bones de-parented in edit mode, and then have 'child-of' constraints added in pose mode to simulate a similar movement system. The picture below shows a set up for a horse:

Horse with constrained instead of parented armature

Note: the .dae file will not save the child constraints, it will instead provide keyframes for each bone as if they were independent, this suits the game, but will be hard to edit if you try to work back from it, so SAVE your BLEND file!

Rome Remastered will only accept meshes that have 1 bone per vertex weighting. If you add a mesh with flexi_m type variable weighting on a vertex the mesh will not be shown in game. Use 'limit_total' in Blender to reduce to single bone weighting.

3ds Max specific

Working with 3ds max (importing the .dae created by IWTE and openCOLLADA) will require the attention to the following aspects:

- Exporting the animated .dae file will require you in max to rotate the object with 180 degrees.

- IWTE doesn't handle textures, so in order to export the right texture, you need to name the material with the same name as the used texture, like this:

3ds Max material naming.png

YOU can help us improve this Wiki! ~ Look for ways to help and editing advice. ~ If you need further advice, please post here.