B Tutorial 2D Making armors in banner background color

Users who are viewing this thread

Hi, guys.  :smile:

Has anyone of you tried making armors just like heraldic ones but without the heraldry showing on it, just the background color specific for each banner?

Well I did and I found out some interesting things that I would like to share with you guys. The original idea to make these kinds of armors came from a friend of mine, JethroKirby, while working on his Warband Improved mod. He used the code lines from existing heraldic meshes and materials to make the colored armors.
I assume that you've already used or read Von Krieglitz's great tutorial for making heraldic items. This topic should be some kind of an extension to his work.

Only thing that needs to be adjusted to show bg color(and not the heraldry) is the position of the banner in tableau_materials.py. Well... almost.  :wink:

Here's an example of heraldic armor tableau material code(module_tableau_materials.py):

  ("heraldic_coat_of_plates_steel", 0, "heraldic_coat_of_plates_steel_sample", 1024, 1024, 0, 0, 0, 0,
  [
      (store_script_param, ":banner_mesh", 1),

      (set_fixed_point_multiplier, 100),
        (store_sub, ":background_slot", ":banner_mesh", arms_meshes_begin), #banner_meshes_begin),
      (troop_get_slot, ":background_color", "trp_banner_background_color_array", ":background_slot"),
      (cur_tableau_set_background_color, ":background_color"),

      (init_position, pos1),
      (cur_tableau_add_mesh_with_vertex_color, "mesh_heraldic_armor_bg", pos1, 200, 100, ":background_color"),
      (init_position, pos1),
      (position_set_x, pos1, 21),
      (position_set_y, pos1, 27),

      (cur_tableau_add_mesh, ":banner_mesh", pos1, 70, 0),
      (init_position, pos1),
      (position_set_z, pos1, 100),
      (cur_tableau_add_mesh, "mesh_tableau_mesh_heraldic_coat_of_plates_steel_banner", pos1, 0, 0),
      (cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
      ]),

The marked lines are banner position settings.

I figured out how the coordinates work... this is the pattern(a rough sketch):

heraldiccoordinatespatt.jpg

The blue and the red are the x and y axis, when you set coordinates in module_tableau_materials.py you can do this following the pattern.
The y axis is always a positive number, x can go negative. In my "coat of plates" example I wanted the banner to show on the marked rectangle(alpha), so I set the coordinates to values T(21, 27) - this is the center spot of the banner, to be shown on my texture.

And this was the result(if you want heraldry to be shown):
mb32o.jpg

If you want the bg color only, just delete the lines:
      (init_position, pos1),
      (position_set_x, pos1, 21),
      (position_set_y, pos1, 27),
      (cur_tableau_add_mesh, ":banner_mesh", pos1, 70, 0),
...or set the coordinates to some invalid values(x=300, y=300). And you will get this:
mb33k.jpg

You will notice that the colored part is low detailed(very few curves, shaded parts)... it looks too fabricated. Well, after some thinking I managed to find a solution for this. Pay attention on the marked line and the underlined mesh:

  ("colored_coat_of_plates_steel", 0, "colored_coat_of_plates_steel_sample", 1024, 1024, 0, 0, 0, 0,
  [
      (store_script_param, ":banner_mesh", 1),

      (set_fixed_point_multiplier, 100),
        (store_sub, ":background_slot", ":banner_mesh", arms_meshes_begin), #banner_meshes_begin),
      (troop_get_slot, ":background_color", "trp_banner_background_color_array", ":background_slot"),
      (cur_tableau_set_background_color, ":background_color"),

      (init_position, pos1),
      (cur_tableau_add_mesh_with_vertex_color, "mesh_heraldic_armor_bg", pos1, 200, 100, ":background_color"),

      (init_position, pos1),
      (position_set_z, pos1, 100),
      (cur_tableau_add_mesh, "mesh_tableau_mesh_colored_coat_of_plates_steel_banner", pos1, 0, 0),
      (cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
      ]),

The underlined mesh is a plain piece of cloth mesh that serves as a special layer for all(native) heraldic armors. It gives the heraldic area depth, shadows, curves. The problem is that this default mesh is low-res and to poor in detail. So, I decided to make some other meshes and corresponding textures/materials that would be more detailed and unique for every colored armor.

This is the result I had with the coat of plates after adding it's unique bg mesh:
mb1x.jpg


Don't forget to change the bg mesh name in the marked line of tableau material. And one more thing in that specific line...
(cur_tableau_add_mesh_with_vertex_color, "mesh_heraldic_armor_bg", pos1, 200, 100, ":background_color")
...you will want to change the marked value to 100. From what I've figured the "200" and "100" values define the size ratio of the bg mesh to the original heraldic mesh. So if you want to keep the ratio to 1:1, I recommend  keeping both values the same.

Here are the settings for .brf files...
material:
matzv.jpg

texture should be somewhat similar to specular(if you make the colored area too dark... your bg color will show up too dark in-game):
texyq.jpg

Texture should be generated in dxt1(1bit alpha) without mipmaps.

You need to make a new mesh, material and texture and add the corresponding lines to module_tableau_materials.py, module_meshes.py, module_items.py.

Example:
module_tableau_materials.py
  ("colored_coat_of_plates_steel", 0, "colored_coat_of_plates_steel_sample", 512, 512, 0, 0, 0, 0,
  [
      (store_script_param, ":banner_mesh", 1),

      (set_fixed_point_multiplier, 100),
        (store_sub, ":background_slot", ":banner_mesh", arms_meshes_begin), #banner_meshes_begin),
      (troop_get_slot, ":background_color", "trp_banner_background_color_array", ":background_slot"),
      (cur_tableau_set_background_color, ":background_color"),

      (init_position, pos1),
      (cur_tableau_add_mesh_with_vertex_color, "mesh_coat_of_plates_steel_bg", pos1, 100, 100, ":background_color"),

      (init_position, pos1),
      (position_set_z, pos1, 1),
      (cur_tableau_add_mesh, "mesh_tableau_mesh_colored_coat_of_plates_steel_banner", pos1, 0, 0),
      (cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
      ]),

module_meshes.py
  ("tableau_mesh_colored_coat_of_plates_steel", 0, "tableau_mesh_colored_coat_of_plates_steel",  0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("tableau_mesh_colored_coat_of_plates_steel_banner", 0, "tableau_mesh_colored_coat_of_plates_steel_banner",  0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("coat_of_plates_steel_bg", 0, "coat_of_plates_steel_bg",  0, 0, 0, 0, 0, 0, 1, 1, 1),


module_items.py
["colored_coat_of_plates_steel", "Colored Steel Coat Of Plates", [("colored_coat_of_plates_steel",0)], itp_merchandise| itp_type_body_armor  |itp_covers_legs ,0, 3828 , weight(25)|abundance(100)|head_armor(0)|body_armor(54)|leg_armor(16)|difficulty(:cool: ,imodbits_armor , [(ti_on_init_item, [(store_trigger_param_1, ":agent_no"),(store_trigger_param_2, ":troop_no"),(call_script, "script_shield_item_set_banner", "tableau_colored_coat_of_plates_steel", ":agent_no", ":troop_no")])]],

Here are some previews so you can easily notice the difference after adding unique bg meshes.
(BEFORE AND AFTER)
befaft.jpg

Some other(out of many) armors I've applied this system to:
previewrq.jpg


You can apply this to shields as well, the procedure is almost identical...
mb25m.jpg

This way you can make much more variety among heraldic armors and armors in general.

I hope this little tutorial helps some of you people. Good luck.  :grin:





 
This will sound lazy, because it is I suppose, but do you mind releasing what you have done already as OSP? I don't use the module system, but I'd love some of the native armours coloured like that.

I particularly like the shields, coat of plates and surcoats like that. Good tutorial though, I rarely use the module system and I understand what needs to be done.
 
Austupaio said:
This will sound lazy, because it is I suppose, but do you mind releasing what you have done already as OSP? I don't use the module system, but I'd love some of the native armours coloured like that.

I particularly like the shields, coat of plates and surcoats like that. Good tutorial though, I rarely use the module system and I understand what needs to be done.

I started working on these armors specifically for Warband Improved mod.
All of these armors will be released with WI in a couple of weeks and they will be OSP.  :smile:

 
Oh, very nice. As a matter of fact, that is pretty much how most of my attempts at making heraldic armours have turned out (but I hadn't managed it yet with shields.)

Also; that Steel Coat of Plates of yours is a-fricking-mazing. It's beautiful, it's grand, I want it! D:
 
FrisianDude said:
Oh, very nice. As a matter of fact, that is pretty much how most of my attempts at making heraldic armours have turned out (but I hadn't managed it yet with shields.)

Also; that Steel Coat of Plates of yours is a-fricking-mazing. It's beautiful, it's grand, I want it! D:

Thanks, man.  :smile:

But you will have to wait until JethroKirby's WI is released. Very soon.  :razz:
 
Heradic items and items coloured by tableau_materials have one big disadvantage - they become blurry. I don't know if it was changed for Warband (I doubt it), but in 1.011 such items had far less "sharp" textures than normal items. I did a lot of testing some time ago and the difference is huge. I probably still have some old screenshots showing how much detail is lost when using tableau_materials. If I'll find them, I'll post them here.
 
Slawomir of Aaarrghh said:
Heradic items and items coloured by tableau_materials have one big disadvantage - they become blurry. I don't know if it was changed for Warband (I doubt it), but in 1.011 such items had far less "sharp" textures than normal items. I did a lot of testing some time ago and the difference is huge. I probably still have some old screenshots showing how much detail is lost when using tableau_materials. If I'll find them, I'll post them here.

That's exactly what this fix is for...


You will notice that the colored part is low detailed(very few curves, shaded parts)... it looks too fabricated. Well, after some thinking I managed to find a solution for this. Pay attention on the marked line and the underlined mesh:

(click to show/hide)

The underlined mesh is a plain piece of cloth mesh that serves as a special layer for all(native) heraldic armors. It gives the heraldic area depth, shadows, curves. The problem is that this default mesh is low-res and to poor in detail. So, I decided to make some other meshes and corresponding textures/materials that would be more detailed and unique for every colored armor.

This is the result I had with the coat of plates after adding it's unique bg mesh:


Don't forget to change the bg mesh name in the marked line of tableau material. And one more thing in that specific line...
(cur_tableau_add_mesh_with_vertex_color, "mesh_heraldic_armor_bg", pos1, 200, 100, ":background_color")
...you will want to change the marked value to 100. From what I've figured the "200" and "100" values define the size ratio of the bg mesh to the original heraldic mesh. So if you want to keep the ratio to 1:1, I recommend  keeping both values the same.

The above part of the tutorial is what fixes the issue. Note the difference between this pic...
mb33k.jpg

... and this pic...
mb1x.jpg
 
JethroKirby, you misunderstood. What I was trying to say is that all textures added to mesh by tableau_materials look much lower quality than the same textures when they are assigned to model by material in brf file. I'm not talking just about the part of the armor that is colored, by about whole armor, including those parts that doesn't change (chainmail for example).

You can't fix that lack of details by adding another texture using tableau_materials, because using tableau_materials forces a loss of details on texture. Well, maybe if I'll find those comparison screens you will see what I mean.


Edit

Here are those screenies:

 
Slawomir of Aaarrghh said:
JethroKirby, you misunderstood. What I was trying to say is that all textures added to mesh by tableau_materials look much lower quality than the same textures when they are assigned to model by material in brf file. I'm not talking just about the part of the armor that is colored, by about whole armor, including those parts that doesn't change (chainmail for example).

You can't fix that lack of details by adding another texture using tableau_materials, because using tableau_materials forces a loss of details on texture. Well, maybe if I'll find those comparison screens you will see what I mean.


Edit

Here are those screenies:


What you are talking about... refers only to heraldic armors. The loss in detail happens because each particular banner is lower in resolution than the armor you want to stretch it to. Most of the armor textures are 1024*1024... and the banner resolution is 132*330. If the heraldic part on the armor is big(like in heraldic mail with surcoat)... it's understandable you will have a loss in detail.
But this doesn't affect background colored armors.  :smile:
 
Njunja said:
What you are talking about... refers only to heraldic armors. The loss in detail happens because each particular banner is lower in resolution than the armor you want to stretch it to...
You did not look on those screenshots at all, did you? :smile:
Else you would notice that there are not 132x330 banners in there

There is indeed some loss of quality (more blurriness) in tableau materials compared to same texture applied as, well, a texture. Apart  from that one can have pretty large resolution in tableaus and far better quality than standard banners allow
 
You've figured out so many things. Don't know why you haven't figured out that you can simply delete the following:
      (init_position, pos1),
      (position_set_x, pos1, 300),
      (position_set_y, pos1, 300),
      (cur_tableau_add_mesh, ":banner_mesh", pos1, 113, 0),

to relieve you of the labour of relocating the banners and relieve computers of the labour of processing them  :grin:

Or I'm wrong, point me out please.
 
foxyman said:
You've figured out so many things. Don't know why you haven't figured out that you can simply delete the following:
      (init_position, pos1),
      (position_set_x, pos1, 300),
      (position_set_y, pos1, 300),
      (cur_tableau_add_mesh, ":banner_mesh", pos1, 113, 0),

to relieve you of the labour of relocating the banners and relieve computers of the labour of processing them  :grin:

Or I'm wrong, point me out please.

You're absolutely right.  :smile:
But I didn't pay that much attention to the position...  :razz: Thanks for pointing that out.
As I already said, my friend started working on these colored armors, the only thing what bothered him was the low detail on the cloth.
 
GetAssista said:
Njunja said:
What you are talking about... refers only to heraldic armors. The loss in detail happens because each particular banner is lower in resolution than the armor you want to stretch it to...
You did not look on those screenshots at all, did you? :smile:
Else you would notice that there are not 132x330 banners in there

There is indeed some loss of quality (more blurriness) in tableau materials compared to same texture applied as, well, a texture. Apart  from that one can have pretty large resolution in tableaus and far better quality than standard banners allow

I really don't mind seeing some acceptable loss in detail. I like heraldic items.

I thought it would be nice if I share this with some other people who are having troubles and want to make these kinds of armors. 
And seems to me... that there are some people on this forum who come only with criticism.
 
Uhmm, maybe I'm blind, but where is that criticism? :smile: Did someone say that you did something wrong or what? I only pointed out that using tableau_materials is causing a slightly loss of texture sharpness. That's just a fact. I didn't say that you are responsible for that, so relax, mate, have a drink...
beer.gif


There are many pros of using tableau_materials, but it also has some cons. That's all. Modder should be aware of both advantages and disadvatages of chosen solution.
 
I missed this when it was posted yesterday--great work!

I've always thought that armors in M&B should have portions of the texture for "Civ-specific" colors (using my old Civ3 modding terminology) that make them distinguishable as part of a certain lord's party. Heck, medieval soldiers used to tie ribbons to their arms to distinguish themselves in battle, if necessary. These seems a necessary addition.
 
Slawomir of Aaarrghh said:
Uhmm, maybe I'm blind, but where is that criticism? :smile: Did someone say that you did something wrong or what? I only pointed out that using tableau_materials is causing a slightly loss of texture sharpness. That's just a fact. I didn't say that you are responsible for that, so relax, mate, have a drink...
beer.gif


There are many pros of using tableau_materials, but it also has some cons. That's all. Modder should be aware of both advantages and disadvatages of chosen solution.

I'm aware of that mate. I didn't want to sound rude or something.
I'm sorry if I did. Let's have a drink... I really need one.  :razz:
Cheers.
beer.gif
 
Caba`drin said:
I missed this when it was posted yesterday--great work!

I've always thought that armors in M&B should have portions of the texture for "Civ-specific" colors (using my old Civ3 modding terminology) that make them distinguishable as part of a certain lord's party. Heck, medieval soldiers used to tie ribbons to their arms to distinguish themselves in battle, if necessary. These seems a necessary addition.

Thanks man.  :grin:

...here's one beer for you too...
beer.gif
 
Back
Top Bottom