Question: What is so interesting about the below image?
Answer: all dresses on the image are essentially the same dress, dynamically re-painted or re-textured by tableau materials.
Download Link (Google Drive, 238K)
So, what do you have to do to make nearly any wearable item in the game dynamically retexturable?
The answer is: surprisingly little.
Step 1: Make a replica of texture file used by the item (I used blue_dress.dds which is used by itm_blue_dress_new).
Step 2: Open it in GIMP.
Step 3: Decide what area of your item will be retexturable. Make it semi-transparent and desaturated while leaving visual imperfections. Tool "Color to Alpha" in "Color" menu works great for this, possibly followed by decoloration tool from the same menu. See file "lav_cc_dress.dds" in the downloadable example to see what you want to get in the end.
Step 4: With modified texture, create material and simple tableau mesh. Reference the tableau mesh in module_meshes. See "lav_cc_dress" entries in brf file and "camo_dress" in module_meshes for examples on how.
Step 5: Make a replica of tableau material code for your item. Important notes: your tableau material header should reference the material used by the original item (so correct bumpmap and specmap are applied to the resulting item), as well as correct texture dimensions. Use your new tableau mesh instead of "mesh_camo_dress". The remaining code will be the same.
Step 6: Voila! You can now make any number of new items using your new tableau material. There's an important caveat though:
Step 7: Tableau material can use either a solid color or a texture mesh to "paint" your item. If you pass a negative value, it is treated as a hex color code. If you pass a mesh reference, the mesh will be used instead. See module_items in the downloadable example to see how it's done.
So the essential result is that you no longer need to create separate textures, materials and meshes to have differently colored items. Create one mesh, invest some work to make a transparent texture, and you can spawn any number of variations of your item by just adding new entries to module_items. Creating re-textured items is only slightly more complex as you have to create a texture mesh, but making one is easy even to a newbie, and once a texture mesh is made, it can be applied to any of your re-texturable items.
Answer: all dresses on the image are essentially the same dress, dynamically re-painted or re-textured by tableau materials.
Download Link (Google Drive, 238K)
So, what do you have to do to make nearly any wearable item in the game dynamically retexturable?
The answer is: surprisingly little.
Step 1: Make a replica of texture file used by the item (I used blue_dress.dds which is used by itm_blue_dress_new).
Step 2: Open it in GIMP.
Step 3: Decide what area of your item will be retexturable. Make it semi-transparent and desaturated while leaving visual imperfections. Tool "Color to Alpha" in "Color" menu works great for this, possibly followed by decoloration tool from the same menu. See file "lav_cc_dress.dds" in the downloadable example to see what you want to get in the end.
Step 4: With modified texture, create material and simple tableau mesh. Reference the tableau mesh in module_meshes. See "lav_cc_dress" entries in brf file and "camo_dress" in module_meshes for examples on how.
Step 5: Make a replica of tableau material code for your item. Important notes: your tableau material header should reference the material used by the original item (so correct bumpmap and specmap are applied to the resulting item), as well as correct texture dimensions. Use your new tableau mesh instead of "mesh_camo_dress". The remaining code will be the same.
Step 6: Voila! You can now make any number of new items using your new tableau material. There's an important caveat though:
Step 7: Tableau material can use either a solid color or a texture mesh to "paint" your item. If you pass a negative value, it is treated as a hex color code. If you pass a mesh reference, the mesh will be used instead. See module_items in the downloadable example to see how it's done.
So the essential result is that you no longer need to create separate textures, materials and meshes to have differently colored items. Create one mesh, invest some work to make a transparent texture, and you can spawn any number of variations of your item by just adding new entries to module_items. Creating re-textured items is only slightly more complex as you have to create a texture mesh, but making one is easy even to a newbie, and once a texture mesh is made, it can be applied to any of your re-texturable items.
Attention: adding these lines to your module is not enough, you need to download the archive with resources as well.
Code:
("camo_dress", 0, "lav_cc_dress", 0, 0, 0, 0, 0, 0, 1, 1, 1),
("camo_texture_01", 0, "lav_cc_texture_01", 0, 0, 0, 0, 0, 0, 1, 1, 1),
("camo_texture_02", 0, "lav_cc_texture_02", 0, 0, 0, 0, 0, 0, 1, 1, 1),
("camo_texture_03", 0, "lav_cc_texture_03", 0, 0, 0, 0, 0, 0, 1, 1, 1),
("camo_texture_04", 0, "lav_cc_texture_04", 0, 0, 0, 0, 0, 0, 1, 1, 1),
("camo_texture_05", 0, "lav_cc_texture_05", 0, 0, 0, 0, 0, 0, 1, 1, 1),
("camo_texture_06", 0, "lav_cc_texture_06", 0, 0, 0, 0, 0, 0, 1, 1, 1),
("camo_texture_07", 0, "lav_cc_texture_07", 0, 0, 0, 0, 0, 0, 1, 1, 1),
Code:
("camo_dress", 0, "blue_dress", 512, 512, 0, 0, 0, 0,
[
(store_script_param, ":instance_id", 1),
(set_fixed_point_multiplier, 100),
(init_position, pos1),
(try_begin),
(gt, ":instance_id", 0),
(cur_tableau_add_mesh, ":instance_id", pos1, 0, 0),
(else_try),
(store_sub, ":instance_id", 0, ":instance_id"),
(val_or, ":instance_id", 0xFF000000),
(cur_tableau_set_background_color, ":instance_id"),
(try_end),
(position_set_z, pos1, 30),
(cur_tableau_add_mesh, "mesh_camo_dress", pos1, 0, 0),
(cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
]
),
Code:
["camo_dress_r", "Camo Dress - Red", [("blue_dress_new",0)], itp_merchandise| itp_type_body_armor |itp_covers_legs|itp_civilian ,0, 6 , weight(1)|abundance(100)|head_armor(0)|body_armor(6)|leg_armor(2)|difficulty(0) ,imodbits_cloth,
[(ti_on_init_item, [(cur_item_set_tableau_material, "tableau_camo_dress", -0x800000)])]],
["camo_dress_g", "Camo Dress - Green", [("blue_dress_new",0)], itp_merchandise| itp_type_body_armor |itp_covers_legs|itp_civilian ,0, 6 , weight(1)|abundance(100)|head_armor(0)|body_armor(6)|leg_armor(2)|difficulty(0) ,imodbits_cloth,
[(ti_on_init_item, [(cur_item_set_tableau_material, "tableau_camo_dress", -0x008000)])]],
["camo_dress_b", "Camo Dress - Blue", [("blue_dress_new",0)], itp_merchandise| itp_type_body_armor |itp_covers_legs|itp_civilian ,0, 6 , weight(1)|abundance(100)|head_armor(0)|body_armor(6)|leg_armor(2)|difficulty(0) ,imodbits_cloth,
[(ti_on_init_item, [(cur_item_set_tableau_material, "tableau_camo_dress", -0x000080)])]],
["camo_dress_01", "Camo Dress - Blue Web", [("blue_dress_new",0)], itp_merchandise| itp_type_body_armor |itp_covers_legs|itp_civilian ,0, 6 , weight(1)|abundance(100)|head_armor(0)|body_armor(6)|leg_armor(2)|difficulty(0) ,imodbits_cloth,
[(ti_on_init_item, [(cur_item_set_tableau_material, "tableau_camo_dress", "mesh_camo_texture_01")])]],
["camo_dress_02", "Camo Dress - Burlap", [("blue_dress_new",0)], itp_merchandise| itp_type_body_armor |itp_covers_legs|itp_civilian ,0, 6 , weight(1)|abundance(100)|head_armor(0)|body_armor(6)|leg_armor(2)|difficulty(0) ,imodbits_cloth,
[(ti_on_init_item, [(cur_item_set_tableau_material, "tableau_camo_dress", "mesh_camo_texture_02")])]],
["camo_dress_03", "Camo Dress - Electric Blue", [("blue_dress_new",0)], itp_merchandise| itp_type_body_armor |itp_covers_legs|itp_civilian ,0, 6 , weight(1)|abundance(100)|head_armor(0)|body_armor(6)|leg_armor(2)|difficulty(0) ,imodbits_cloth,
[(ti_on_init_item, [(cur_item_set_tableau_material, "tableau_camo_dress", "mesh_camo_texture_03")])]],
["camo_dress_04", "Camo Dress - Military", [("blue_dress_new",0)], itp_merchandise| itp_type_body_armor |itp_covers_legs|itp_civilian ,0, 6 , weight(1)|abundance(100)|head_armor(0)|body_armor(6)|leg_armor(2)|difficulty(0) ,imodbits_cloth,
[(ti_on_init_item, [(cur_item_set_tableau_material, "tableau_camo_dress", "mesh_camo_texture_04")])]],
["camo_dress_05", "Camo Dress - Leopard", [("blue_dress_new",0)], itp_merchandise| itp_type_body_armor |itp_covers_legs|itp_civilian ,0, 6 , weight(1)|abundance(100)|head_armor(0)|body_armor(6)|leg_armor(2)|difficulty(0) ,imodbits_cloth,
[(ti_on_init_item, [(cur_item_set_tableau_material, "tableau_camo_dress", "mesh_camo_texture_05")])]],
["camo_dress_06", "Camo Dress - Leather", [("blue_dress_new",0)], itp_merchandise| itp_type_body_armor |itp_covers_legs|itp_civilian ,0, 6 , weight(1)|abundance(100)|head_armor(0)|body_armor(6)|leg_armor(2)|difficulty(0) ,imodbits_cloth,
[(ti_on_init_item, [(cur_item_set_tableau_material, "tableau_camo_dress", "mesh_camo_texture_06")])]],
["camo_dress_07", "Camo Dress - Walnut", [("blue_dress_new",0)], itp_merchandise| itp_type_body_armor |itp_covers_legs|itp_civilian ,0, 6 , weight(1)|abundance(100)|head_armor(0)|body_armor(6)|leg_armor(2)|difficulty(0) ,imodbits_cloth,
[(ti_on_init_item, [(cur_item_set_tableau_material, "tableau_camo_dress", "mesh_camo_texture_07")])]],