Results 1 to 14 of 14

Thread: Battlemap Building Textures

  1. #1

    Default Battlemap Building Textures

    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
    Code:
    [log]
    to = logs/system.log.txt
    level = * trace
    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)

    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....

  2. #2

    Default Re: Battlemap Building Textures

    Good to have a tutorial on this. Never done any skinning myself, but this looks quite interesting. Thanks.
    Son of PW

  3. #3
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Battlemap Building Textures

    Excellent. Definite +rep.


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  4. #4
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Battlemap Building Textures

    Great! Even though we're hamstrung til the world editor is more versatile, I'm sure there's plenty of mods out there which can settle for texture changes of existing buildings, and this will help them tremendously.

  5. #5
    Meister Röhrich's Avatar Tiro
    Join Date
    Sep 2009
    Location
    wild and wet northern Germany
    Posts
    227

    Default Re: Battlemap Building Textures

    Thank you, thank you, thank you! oh, and +rep of course

  6. #6

    Default Re: Battlemap Building Textures

    Wow...this will be a huge help. We are so lucky it came out today, lol!

  7. #7
    Horsa's Avatar Artifex
    Join Date
    Nov 2008
    Location
    Isle of Slingers
    Posts
    3,769

    Default Re: Battlemap Building Textures

    Thanks for this! I was actually trying the find the files just before you posted. +rep

  8. #8

    Default Re: Battlemap Building Textures

    great tut!
    +rep

    one question more!
    is this possible to change the models.

    d.

  9. #9
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Battlemap Building Textures

    Quote Originally Posted by dome View Post
    great tut!
    +rep

    one question more!
    is this possible to change the models.

    d.
    Not yet, that's what's being worked on with the World Editor among other things. Or at least, the options for model changing are too limited, you have to use some of the same properties as whatever building it was replacing.

  10. #10

    Default Re: Battlemap Building Textures

    ok thanks aug!

    By the way nice progress on auh project

    d.

  11. #11

    Default Re: Battlemap Building Textures

    Awesome makanyane ! +rep for sure

  12. #12

    Default Re: Battlemap Building Textures

    Some of 1st post has now been superseded by advances in world modification tools including release of the IWTE editor. This post is to explain to those who are already using new textures for individual settlements how to fix issue with old texture appearing for walls / gates or towers whilst they are in their animation phase.

    ********************************************

    The building textures used for static parts of buildings is listed per structure in the .world file, the .world file also specifies which animation set is used for transitions between object damage states. The animations folders contain, .anim .evt and .mesh files. The .mesh files specify which texture is used. Currently (and this isn't AFAIK being worked on) it's not possible to view or alter the structure used in the mesh file, but you can quite easily hex edit the texture name to make them use a different texture.

    To set up a 'new' animation to use a different texture for a particular .world first convert the relevant .world file to text using either IWTE or Knight Errant's world editor. Search the text file for 'anim' to find the animstrings section:




    It will look a bit like the above, find the relevant animation section in this case I'm changing the wall animation from looking in
    BlockSet/North_European/Animations/Wall_Animations/castle_Large_Stone_Wall/
    to look in
    BlockSet/North_European/Animations/Wall_Animations/zastle_Large_Stone_Wall/
    you can make names and paths anything you want - but it's a lot simpler if you KEEP THE PATH LENGTH THE SAME...... Convert your text file back to binary with the same tool you used to extract it, rename the resulting .world file so it's read in place of the previous one.

    copy entire /Castle_Large_Stone_Wall/ folder and name the copy zastle_Large_Stone_Wall
    or whatever you put in the string

    go into your copied folder and ammend all the .mesh files with a hex editor



    do this by searching for the text string 'texture' and changing the name of the texture it's looking for to your new texture - again it's advisable to KEEP THE PATH LENGTH THE SAME - I've not experimented with changing it, it's probably possible if you encode the correct path length before the string but much easier not to. Change the name of the normal.texture too if you need that to use new normal.

    For my experiment I made a pink version of the existing texture and called it zalls_castle_large_stone.texture. Here you can see the original texture in use while the wall is using the static object model, and appearing pretty in pink whilst in the animation transition phase:






    Uploaded with ImageShack.us

  13. #13
    wilddog's Avatar Paintedwolves run free
    Join Date
    Jan 2005
    Location
    UK
    Posts
    2,337

    Default Re: Battlemap Building Textures

    An ability to amend the texture references in the animation mesh files will be added for version 5.2 or above of the IWTE tool. You will simply need to select the type of texture, update the two path names (texture and normal) and save.

  14. #14
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Battlemap Building Textures

    Question: has anyone checked whether the new Teutonic buildings still use the same disjointed texture structure? It is well known that the Aztec buildings use a sensible 'one-texture' mapping, contrary to the European buildings, but I'm wondering if they extended this improvement to the new Teutonic buildings as well.


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •