It's been pointed out to me recently that although people have already achieved building texture changes, such as this timber to brick conversion, there doesn't seem to be any consolidated information on this, there is a lot of general information relating partly to this in the world modified thread, but the length of that is making it hard to find things.... so here goes with building textures:
Index:
Texture Format
Building Texture File Locations (& Faction Variants)
Finding Which Textures Are Used
Changing Which Textures Are Used
Adapting Textures Without Changing UV Mapping
Changing UV Mapping
Texture Format
The battlemap building textures are in the same format as the battlemap units textures, with one coloured texture and one normal map texture which creates a slight 3d impression in game.
They all have the .texture file extension. They can be handled in exactly the same way as unit textures. The most common method for that is use Alpaca's texture/dds converter. You'll need to have Python installed to run that, if you're fiddling with building textures you'll probably in the end want to use some of the world editor tools so if you don't already have Python try the recommended installation which should also work for the world editor tools. (Python is a free program)
Once you've got to the .dds you'll need to either additionally convert to .tga (free converters are available on the web) or use an NVIDIA dds plug-in for Photoshop or a plug-in adapted for GIMP. The NVIDIA Photoshop plug-in also allows you to make the 'normal' version of the texture.
All of that is the same as for units, so please search forums for info on how to convert / use dds etc...
Building Texture File Locations (& Faction Variants)
In the vanilla set up the building texture files are located in
data/blockset/textures
if you use a mod-folder and keep the texture names the same you can place textures in
/mods/my_mod/data/blockset/textures
and they'll be used instead of the vanilla ones
viewing the full trace version of a log file when it loads a settlement owned by a faction - say Egypt - shows that it looks for textures in
/mods/my_mod/data/blockset/faction_variations/egypt/ etc
and only if it doesn't find one in there loads the texture in /blockset/textures
so if you want to change the textures for a specific faction only you can make the folder
/mods/my_mod/data/blockset/faction_variations/faction_name/
and put same named textures as vanilla in there, and they'll be used for settlements built by that faction.
If you have a battle in winter the game looks automatically for winter versions of the textures, at the most basic level it'll look in
data/BlockSet/Textures/winter/
but similarly to the above you can use a faction specific variant from your mod-folder by placing texture in:
mods/my_mod/data/BlockSet/Textures/faction_variations/faction_name/winter/
(change my_mod and faction_name to suit mod!)
The vanilla file also has a
data/blockset/textures/variations/south_european
folder - I'm not quite sure when if at all the culture variations are used as most textures are already specifically NE or SE versions... if anyone does know that bit please reply and I'll update
Finding Which Textures Are Used
Most settlements use a few different textures. To find out which specific ones are being used for a particular settlement, either
a). experiment, paint existing textures in different silly colours so you can visually identify which ones appear where...
b). use
or similar in your config file. Look at the resultant log file after you've loaded battlemap with the relevant settlement, search from bottom up for instances of data/blockset/textures, and see which ones it has loaded (note: there'll be a lot more stuff in there, and all its failed attempts to find faction_variants)Code:[log] to = logs/system.log.txt level = * trace
if you already know which .world file is being used - (mostly they are obvious, the Northern European castle is at: data/settlements/north_european/castles/castle/north_european_castle_a.world)
c). open the relevant .world file with a hex editor like the free XV132 and search for all the instances of 'texture'
d). load the relevant .world file in KnightErrant's WorldEditor (you'll need the Python installation mentioned above for that) then open the world_name_nomodeldata.txt file that the editor has created in a sub-folder. Search again for all instances of 'texture'
Changing Which Textures Are Used
You'll have gathered hopefully from the above that you can change the textures a particular faction is using for all of it's settlements just by placing the new ones in a /faction_variations/faction_name/ sub-folder.... where you meet problem is if you only want to change say the Castle textures and not the Large_castle and Fortress ones
In vanilla a lot of the settlements share some of the same textures, so to change textures for only one of the settlement levels you have to change the texture path specified inside the .world file.... (which is the point where M2 gets annoying as it can mean duplicating a 50mb .world file just so you can change one texture)
you can change either the texture name or the folder it's stored in (it doesn't have to be 'blockset') or even change both, note though that; the .world file is similar to the battle_models.modeldb file in that it has a string count at the start of each texture path/name - that count must equal the number of characters in the string or you'll get CTD
safest and easiest thing to do is to keep the path and name length the same so for instance you might change
blockset/textures/walls_castle_large_stone.texture
to
mynewset/textures/walls_castle_large_stone.texture
or
blockset/textures/mynew_castle_large_stone.texture
which gives you the same number of characters
(obviously if you've given it a new folder name you have to make the folder and put texture in there )
there are two ways of making the changes
a). with a hex editor
if you use the XV132 editor go into 'tools' and make sure 'overwrite' is ticked, then you can't accidentally change the path length. (if you do want to change the path length you need to encode the new path length as an integer in the position 4 bytes before the start of the path - I'll assume you know what you're doing if you want to do it that way)
b). use KnightErrant's WorldEditor to generate a text file version of the .world file - (this full version of the file will be called world_name_textrep.txt - note; you can't re-load from the world_name_nomodeldata.txt version) open the textrep file in notepad, for the larger settlements notepad can take a few minutes to open the file, and make the changes to texture names and paths in the textrep file, then use the WorldEditor again to load from text file, and create new modified .world file (re-name the modified world file so its used in place of the old one)
For either way of doing it, note that the same texture may be mentioned many times in the same .world file - generally it lists a texture for each individual structure in the .world. Sometimes though, it just uses a look up to a previous structure within the same .world file, you won't see a texture reference for the structures that do that (and at the moment you also won't be able to make them use a different texture from the one being used by the linked structure)
Adapting Textures Without Changing UV Mapping
The way CA have designed most of the building parts is to use independent squares of model (made up of two triangles) representing aprox 2m x 2m area of building in battlemap.
The diagrams below are from something I was working on but vanilla models are similar
is view in milkshape, this structure is using a variation of walls_castle_large_stone.texture which I've painted the blue grid lines on to demonstrate effect
is the front section facing you in left hand panel viewed in the texture co-ordinate editor
you can see that the building doesn't map as one piece to the texture. Each 3d model square goes to a different area on the texture, the areas on the texture work like tiles, different combinations of tiles can be assembled to make up larger bits of wall, and the same tiles of texture are re-used with the uv mapping reversed to get the wall corner effects on different sides.
All the bits of texture used for the walls are designed so that the stone work coursing runs through the tiles at consistent heights so that it can link a plain tile to a window or door or corner tile, and have the stone coursing running through from one to another.
You can change the textures purely using a 2d program so long as you put equivalent bits in same places etg:brick corbel instead of stone corbel, or square window instead of arched window. And also obey the same rules about keeping anything with horizontal lines running through at the same levels so they link across tiles....
The bashed up looking bits of wall are the parts of textures used for the damaged versions of the models that appear after buildings have been hit by artillery, they obey the same principles, using 'tiles' of the texture that should link up to a variety of things that could be next to them.
even without opening anything in milkshape you can see the way they are likely to be used eg:
the plain bit of wall at D if it is damaged will most likely use the section at D2
a plinth section at E will use something like E2
End result of that is whatever you do to the undamaged looking parts of the texture you need to do to corresponding relevant damaged sections.
Changing UV Mapping
Changes to the UV mapping is possible for those structures it's currently possible to open with milkshape after exporting them with the WorldEditor. A minor glitch in the uv mapping representation produced by the editor is being fixed currently, but its likely that the restriction on which structures can be opened in milkshape will remain.
I hope to be able to add more to this later, will bump thread if I do....