SP Tutorial Animation How to make animated map icons in OpenBRF

Currently Viewing (Users: 0, Guests: 1)

Pitch

Sergeant at Arms
WBNWVCM&BWF&S
Best answers
8
Thats solid Wall of text. Thanks for this, I really appreciate it.
It will help many moders. 
 

NPC99

Baron
M&BWBWF&SVC
Best answers
26
3. Making an windmill map icon

Warband already has a windmill for use in scenes. Open town_houses_b.brf in Warband's CommonRes folder, copy four parts of windmill (3, 6, 13 & 21) together with the three parts of windmill_fan_turning (3, 5 & 27) and paste them into your icon_test.brf.

All map icons can only have one material. Previously, we combined four textures in the quadrants of a single texture and transformed texture coordinates in OpenBRF using the following method:

mtarini said:
You can but you have to suffer a bit and also prepare the textures themselves yourself.

The tool you are looking is "Transform texture coordinates"
For example, to assemble 4 sheets into one sheet like this:

A B
C D

then all the models should be scaled by 50% (both U and V).
meshes originally using A should not be translated.
meshes originally using B should be translated by 0.5 in U (horizontal)
meshes originally using C should be translated by 0.5 in V (vertical).
meshes originally using D should be translated by 0.5 both in U and in V.

Now, all these meshes must be using the material linked to the new assembled texture.
Unfortunately, this method only works where meshes are actually UV mapped within the boundaries of their texture. Some architectural, meshes such as windmill.6, rely on textures to tile, spilling over the texture boundaries as you can see in the next two Blender images of windmill.6's UV map.


This undermines the quadrant method as the UV maps tile all four quadrants, resulting in chequer board textures:


So, before we can combine textures, some of the windmill meshes need to have their UV maps edited in Blender.

Highlight windmill.6 in OpenBRF, right click and select Export static mesh.... Then import the .obj file created into Blender. Select this object, switch to Edit Mode and open a UV/Image Editor window.


Within the UV edit window, use circle select (C) and border select (B) to highlight all the vertices of the row of triangles only. Then click Y to selectively split off only those faces where all the vertices have been selected and next use G to move the row of triangles away from the texture square (centre of the UV editor).

Repeat this process for all UV mappings which spill out over the central texture square and arrange them around it for further manipulation.


For the row of triangles, use circle select (C) to highlight all the vertices of a single triangle. Then click Y to selectively split just that triangle's faces out of the row, move it (G) to a free area. Repeat for each triangle and stack each following one on the first as closely as you can manage without resizing. Once all the triangles are stacked, resize (S) and move (G) to fit the whole stack inside the texture boundaries. The square mapping can be shrunk to size and placed on the texture. The two small rectangles just need to be relocated onto the texture.


Now that the mesh's UV map has been edited to place all mappings within the texture boundaries, export it as a wavefront (.obj) file. After importing this static mesh back into OpenBRF and reapplying its material, you will see that the textures are oversized where the UV maps where shrunk compared to the original.


This can't be improved by transforming its texture coordinates in OpenBRF without compromising the merger of textures/materials using quadrants. We will need to resolve this later by modifying its texture resolution within the combined material.

Repeat this process to edit the UV maps of windmill.3, windmill.13, windmill_fan_turning.3 and windmill_fan_turning.5.

The original windmill used six different materials. To reduce this to four:
1. Change the material of windmill.21 from building_details to planks_1,
2. Change the material of windmill_fan_turning.5 from planks_3 to planks_1.

Then in the image editor of your choice, create a new blank 1024 x 1024 image and:
1. Resize a copy of planks.dds to 512 x 512 pixels and paste its main surface into the top left quadrant of your new blank image,
2. Resize a copy of wall3.dds to 512 x 512 pixels and paste it into the top right quadrant,
3. Use four copies of 256 x 256 pixel roof_plates.dds to fill the bottom left quadrant to compensate for magnifying its texture when we shrank its UV map, and
4. Resize a copy of tent.dds to 512 x 512 pixels and paste it into the bottom right quadrant.

Save your new texture as windmill_tex.dds, remembering to generate mipmaps.


Import windmill_tex.dds as a new texture into your icon_test.brf. In the materials tab, copy and paste map_icon_mount, rename this material windmill_mat and change its DiffuseA to windmill_tex.

Next to convert your meshes to this new shared material:

1. Substitute the planks_1 material for windmill_mat on windmill.3, windmill.21, windmill_fan_turning.3 and windmill_fan_turning.5 and transform their texture coordinates: Scale% U: 50.00 V: 50.00
2. Substitute the roof_1 material of windmill.6 for windmill_mat, and transform its texture coordinates as follows: Scale% U: 50.00 V: 50.00 Translate U: 0.0000 V: -0.5000.
3. Substitute the stone_wall_1 material of windmill.13 for windmill_mat, and transform its texture coordinates as follows: Scale% U: 50.00 V: 50.00 Translate U: 0.5000 V: 0.0000.
4. Substitute the tent material of windmill_fan_turning.27 for windmill_mat, and transform its texture coordinates as follows: Scale% U: 50.00 V: 50.00 Translate U: 0.5000 V: -0.5000.


These meshes can be used, but I feel that 1,889 faces/polys is expensive for a map icon. You can follow or skip the next spoiler's instructions on reducing your number of faces/polys.

Right click windmill.3 in OpenBRF and select split into connected sub-meshes. Of its 21 components (0 to 20), we only need the first three (0 to 2), highlight these three, right click and select combine meshes. Keep this new windmill.3 and delete the original windmill.3 and all of its components, saving 180 polys.

Right click windmill.13 in OpenBRF and select split into connected sub-meshes. Of its 7 components (0 to 6), we only need the first windmill.13.0 - delete the original windmill.13 and its other 6 components, saving 254 polys.

Right click windmill_fan_turning.3 and select split into connected sub-meshes. Of the 48 components, we can delete all the cross bars apart from those at either end of the sails (i.e. delete 6-11, 18-23, 30-35 & 42-47). Then hightlight all the remaining components, right click and select combine meshes. Keep your new windmill_fan_turning.3 and delete the original one and its remaining components, saving 192 polys.

That just leaves windmill_fan_turning.27, which has expensive fluted sails (672 polys). Right click windmill_fan_turning.27 and select Compute LODs. Right click lod1 and select Recompute Normals... to get rid of any black smudging. LOD1 looks ok apart from one broken sail. To fix this, right click windmill_fan_turning.lod1.27 and select split into connected sub-meshes. Delete the broken sail windmill_fan_turning.lod1.27.7 and make a copy of windmill_fan_turning.lod1.27.6 to replace it (copy & paste). Rename this windmill_fan_turning.lod1.27.7 to avoid confusion. Then right click it and select Roto-translate-rescale... and translate X: by 1.7781 and Z: by 0.6472. Select all the componets of lod1, right click and select combine meshes. Delete the original windmill_fan_turning.27 and the rest of its LODs/LOD components. Then rename windmill_fan_turning.lod1.27 as windmill_fan_turning.27 or it will not combine with the other non-LOD meshes, saving 326 polys.

The texture mapping of windmill.21 is quite crude. To improve it you need to split it into its connnected sub-meshes. Right click windmill.21.2 (the door), select Transform texture coords and Scale% U: 450.00 V: 100.00 Translate U: 0.2300 V: 0.0000. This provides better planking for the door. Something similar could also be done for the windows, but that would be pointless at map scale.

To make the windows (& door handle maybe) stand out at map scale - highlight windmill.21.3, windmill.21.1 and windmill.21.0, right click, select Color uniform... and pick black from the top left of OpenBRF's basic colour options.

You can choose to paint the door windmill.21.2 the same way - I chose R 125 G 39 B 39. You can right click on a coloured mesh and choose Tune colors HSB... to change contrast, hue, saturation and brightness.

Once you are happy, recombine the components of windmill.2

Next, combine windmill meshes 3, 6, 13 and 21. Combine windmill_fan_turning meshes 3, 5 and 27, then, rename your windmill_fan_turning mesh windmill.2 so it and windmill can be manipulated in OpenBRF as components of the same multi-mesh. Right click windmill.2, select Roto-translate-rescale... and rotate Y: -90.00. Now, highlight windmill first, hold the control key and highlight windmill.2 second, select Roto-translate-rescale... and tick the Apply to last selected object only check box and move/translate windmill.2 until it is correctly positioned (translate X: -4.0000 Y: 11.4000).

At map scale there is little to chose between the high and low poly versions.


Now to animate our windmill. On the world map all animations stop when the game pauses apart from banners, which continue to ripple in the wind. As our windmill must continue to turn, open map_flags_d.brf from Warband's CommonRes folder and copy map_flag_kingdom_c into your icon_test.brf. The flag has 11 frames, but frame0 and frame1 are unused static flags. So we only need 9 motion frames.

Next, copy and paste windmill.2 to give a new version to rotate (lets us retain the original one in case of errors). Anything rotated in OpenBRF is rotated around a central point, meaning meshes rotated away from the centre will be displaced as well as rotated. Right click windmill.2, select Roto-tramslate-rescale... and click the central of three icons to the right of translation section for X, Y and Z. This centres your mesh by each axis in turn automatically. Note down the distances translated as you will need those to return the sails to their correct position later (X: 5.5117, Y: -11.39333 & Z: -0.0145).

Make three copies of your centered windmill.2 and rename them windmill.2.frame0, windmill.2.frame1 and windmill.2.frame2 respectively.

Make a new copy of your centered windmill.2, right click, select Roto-translate-rescale... and select Rotation X: 10.00. Rename this as windmill.2.frame3.

Now, repeat the last step to create frames 4 to 10 (rotating X by a further 10 degrees each time).

Highlight frames 0 to 10 and your centred windmill.2 and they should look like this:


Then, make a vertical list of your windmill.2 frames, running in order from 0 at the top to 10 at the bottom, highlight them all, right click and select Merge as frames in a vertex ani. You now have an 11 frame vertex animation called windmill.2.frame0. Click OpenBRF's > button and watch your animation loop through its frames.

If you are happy its animation is smooth, right click on it, select Roto-translate-rescale... and input the values you noted previously, but this time with the opposite sign as the movement is reversed (X: -5.5117, Y: 11.39333 & Z: 0.0145) to reposition your windmill's sails.

Next, make 11 copies of windmill in a vertical list, highlight them all, right click and select Merge as frames in a vertex ani, giving an 11 frame vertex animation of the static tower.

Highlight your two vertex animations, windmill.2.frame0 and windmill, right click and select Combine meshes. Rename the combined mesh as my_final_map_windmill to avoid confusion with your working components. Next copy map_flag_kingdom_c, highlight my_final_map_windmill and from OpenBRF's edit menu select Paste timings to synch your map icon to Warband's engine. Then right click my_final_map_windmill, select Roto-translate-rescale..., Rescale X: 10.00 (with the uniform box ticked) to reduce it to map scale and save your icon_test.brf.

Warning - if you made each frame separately including the static tower and then merged them into a vertex animation, the presence of the tower would have distorted your animation.

Putting your new icon into the game as a standard map icon will not animate it as we copied map_flag timings. Accordingly, you need to include it as a new banner. As banners have to be allocated to other parties on the world map, open object_meshes.brf in Warband's CommonRes folder, copy straw_c.7 and paste it into your icon_test.brf. Rename it map_straw and rescale it using Roto-translate-rescale..., Rescale X: 25.00 (with the uniform box ticked).

To get your windmill in game, you need to edit your module system as follows:

####insert after banner_135

("banner_windmill",0,"my_final_map_windmill", banner_scale,0),

#####insert before final ] bracket

("map_windmill",mcn_no_shadow,"map_straw", 0.45, 0, 0.0, -1.2, 0.0),

Save and compile.

#####insert before final ] bracket

("windmill_1","Windmill", icon_map_windmill|pf_is_static|pf_always_visible|pf_no_label|pf_hide_defenders, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-93.42,20.6:cool:,[],166),
Save and compile.

######search for only instance of:
######(party_set_banner_icon, ":center_no", ":cur_banner"),
######insert after next (try_end),

(party_set_banner_icon, "p_windmill_1", "icon_banner_windmill"),

Save and compile.

Then load up your Warband mod and check your windmill in game near Praven.






 

DerGreif

Sergeant Knight at Arms
WBVC
Best answers
0
Thank you so much! Great tutorial! This atually has the potential to model the player character according to their equipment. Perhaps only for a limited set of combinations due to the hard coded map icon limit of 256, but in combination with Lav's FISH & CHIPS OSP you can ditch all but two or three flags and then there is enough room to provide for a couple of different equipment sets (civilian/light/heavy armour + each of them on horse) and even female outfits.
 

Max2150

Regular
Best answers
0
I don't know if i'm being stupid or not, but with these custom map icons, why is it that they dont carry a banner?
 

NPC99

Baron
M&BWBWF&SVC
Best answers
26
Max2150 said:
I don't know if i'm being stupid or not, but with these custom map icons, why is it that they dont carry a banner?
Banners are separate meshes, which are added to icons once the player or ai Lord qualifies to carry one.
 

Max2150

Regular
Best answers
0
Ok, Thank you! This tutorial is absolutely amazing, it transforms the game completely when all the lords are the same icon :razz: Keep up the good work! :smile:
 

builder of the gods

Sergeant at Arms
Best answers
0
thanks alot for the extensive tutorial.

One question tho if my mesh has six materials how would i do that, you told us to work in quadrants so i could go like

AB
CD

but then i have to eliminate 2 textures

I could go for another quadron but then i would have 7 textures

AB
CD with A being

A1A2
A3A4
Also on another map icon i’m having 71 materials, ofcourse i will look to bring this back but i’m pretty sure it will be harsh, any tips for that?
 

NPC99

Baron
M&BWBWF&SVC
Best answers
26
Godarcher said:
thanks alot for the extensive tutorial.

One question tho if my mesh has six materials how would i do that, you told us to work in quadrants so i could go like

AB
CD

but then i have to eliminate 2 textures

I could go for another quadron but then i would have 7 textures

AB
CD with A being

A1A2
A3A4
Also on another map icon i’m having 71 materials, ofcourse i will look to bring this back but i’m pretty sure it will be harsh, any tips for that?
For the less important textures make a four quadrant texture, then just shrink it and use it as the first quadrant with three other full size textures giving you a 7 texture atlas. If you look at the mounted map icon tutorial, you’ll see that I used a five texture atlas that only covered 2 quadrants.
 

lhhtsinghua

Recruit
Best answers
0
Thank you very much for this helpful tutorial, sir!!!

It's so useful that I literally registered and signed in to reply and thank you!
Hope to see more of your tutorials in the future.

Some questions:
1. If I want to make models like this for other use (not the icon_map), and I decided to use the high poly half face. How can I make a whole face use that half? Duplicate and invert? I could not find such actions.
 

NPC99

Baron
M&BWBWF&SVC
Best answers
26
lhhtsinghua said:
Thank you very much for this helpful tutorial, sir!!!

It's so useful that I literally registered and signed in to reply and thank you!
Hope to see more of your tutorials in the future.

Some questions:
1. If I want to make models like this for other use (not the icon_map), and I decided to use the high poly half face. How can I make a whole face use that half? Duplicate and invert? I could not find such actions.
In OpenBRF, duplicate the half face then mirror it and then merge meshes. Just remember that the game only needs half a face as the engine mirrors it automatically in battles etc. I only use whole heads in OpenBRF to check helmets, hair, etc before putting them into the game. If you use the whole head to check animations in OpenBRF it can be disconcerting as the animations cause the face to also run through all its vertex animation frames of facial expressions - I always separate all frames and just use frame 0.
 

lhhtsinghua

Recruit
Best answers
0
NPC99 said:
lhhtsinghua said:
Thank you very much for this helpful tutorial, sir!!!

It's so useful that I literally registered and signed in to reply and thank you!
Hope to see more of your tutorials in the future.

Some questions:
1. If I want to make models like this for other use (not the icon_map), and I decided to use the high poly half face. How can I make a whole face use that half? Duplicate and invert? I could not find such actions.
In OpenBRF, duplicate the half face then mirror it and then merge meshes. Just remember that the game only needs half a face as the engine mirrors it automatically in battles etc. I only use whole heads in OpenBRF to check helmets, hair, etc before putting them into the game. If you use the whole head to check animations in OpenBRF it can be disconcerting as the animations cause the face to also run through all its vertex animation frames of facial expressions - I always separate all frames and just use frame 0.
Thanks!
Yes, they use animation frames for slight changes in the mesh, e.g. face emotions, man/female differences.

One more question:
When I am playing with two-handed weapons animation, I simply put the weapon "mount on one bone" to item.R the same as a one-handed weapon. Now I found the animation is not accurate, for example, those two hands are not on the weapon. So I was wondering how should I do that?
The reason I am asking this is that I am trying to select different armors/weapons then export many different animations.
 

Eärendil the Mariner

Subforum Moderator
WBWF&SM&B
Best answers
64
lhhtsinghua said:
NPC99 said:
lhhtsinghua said:
Thank you very much for this helpful tutorial, sir!!!

It's so useful that I literally registered and signed in to reply and thank you!
Hope to see more of your tutorials in the future.

Some questions:
1. If I want to make models like this for other use (not the icon_map), and I decided to use the high poly half face. How can I make a whole face use that half? Duplicate and invert? I could not find such actions.
In OpenBRF, duplicate the half face then mirror it and then merge meshes. Just remember that the game only needs half a face as the engine mirrors it automatically in battles etc. I only use whole heads in OpenBRF to check helmets, hair, etc before putting them into the game. If you use the whole head to check animations in OpenBRF it can be disconcerting as the animations cause the face to also run through all its vertex animation frames of facial expressions - I always separate all frames and just use frame 0.
Thanks!
Yes, they use animation frames for slight changes in the mesh, e.g. face emotions, man/female differences.

One more question:
When I am playing with two-handed weapons animation, I simply put the weapon "mount on one bone" to item.R the same as a one-handed weapon. Now I found the animation is not accurate, for example, those two hands are not on the weapon. So I was wondering how should I do that?
The reason I am asking this is that I am trying to select different armors/weapons then export many different animations.
You do know that your question is in no way related to this thread topic? It would be better if you would ask this in the Q&A thread...
 

NPC99

Baron
M&BWBWF&SVC
Best answers
26
lhhtsinghua said:
One more question:
When I am playing with two-handed weapons animation, I simply put the weapon "mount on one bone" to item.R the same as a one-handed weapon. Now I found the animation is not accurate, for example, those two hands are not on the weapon. So I was wondering how should I do that?
The reason I am asking this is that I am trying to select different armors/weapons then export many different animations.
You can try a polearm animation, or adjust the weapon position.
 

mauromagno

Knight at Arms
WBNW
Best answers
7
ufff  I did not appear the option to convert into animation by vertices .... I spent a whole day trying to convert it hahaha and it occurred to me to find a newer version of openBRF hahaha (download one of 2016) and there it worked.
Thanks for the tutorial :wink: