Page 1 of 5 12345 LastLast
Results 1 to 20 of 84

Thread: Editing worldterrain files (IWTE)

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

    Default Editing worldterrain files (IWTE)

    IWTE - Editing worldterrain files
    The following information should help modders understand the basics of modding the worldterrain files.This allows you to change the landscape of any .world map without actually changing any of the .world/collision/animations. So you can position the ‘settlement’ on a hill, in a valley etc but still retain everything about the settlement (if you wish).

    Essentially you should think of the worldterrain file as containing four items :

    1. The worldterrain Vertex – these are all exactly 8m apart. You can only adjust the height
    2. The worldterrain merge factor associated with each vector – value 1.0 to 0.0 identifying whether this vector shows fully or becomes more merged until it has no effect on the original landscape
    3. The Landscape merge mask – merges the original landscape towards an average 0.0 height
    4. The mask TGA paths – the texture masks applied to the world terrain file. There are 4 masks with a macro and micro mask for each


    To try and explain this better :

    The worldterrain vertexes
    The vertexes are all 8m apart. All you can do is add new rows or columns and amend their height.
    The normal battlemap is approx. 221 vertexes square.
    Milkshape can only handle 181 vertexes square.
    The worldterrain should be variations of height from a 0.0 average height.
    It should be noted that the triangles that then make up the mesh do not have a uniform direction. They follow a basic pattern (which isn't a single bottom left to top right split as an example). However when the vertex meets water the pattern gets broken and the triangles are formed connecting to the lowest vertex.

    The worldterrain merge factor
    This factor says what the vertex weighting is versus the underlying landscape. A value of 1.0 implies the vertex shows 100% and the underlying terrain is completely hidden whereas a value of 0.0 means the underlying landscape is showing completely and the vertex has no effect. Obviously you should have values of 1.0 under the settlement (ie any vertexes associated with the .world file) and then should merge to a 0.0 value for the outer edges of the world terrain. This will then blend the worldterrain into the underlying landscape.

    The Landscape merge mask
    This is a fixed size (256*256) and is either present or not (IWTE tool doesn’t allow you to delete it if you don’t want it – in that case just select a starting file that doesn’t have one. It will allow you to add though). Its purpose is to merge the surrounding landscape towards an average height which is 0.0 in .world/.worldterrain terms. In this case the fully merged means the landscape value is 0.0 whereas the unmerged shows the true landscape (based around an average 0.0 height).
    The merge mask also covers the same area regardless of changes to the world terrain vertex mesh (it’s a few metres bigger than the 121 size maybe fitting to a 128 size)

    The mask TGA paths
    OK these are really textures but are internally referred to as TGA. There are 4 masks which can be called whatever you like but start normally as mud, path, farm1 and farm2. Each has 2 files associated with it representing the macro file and the micro file. Each file then has a size associated with it (in metres) over which the TGA is stretched.
    Please note that the masks ONLY use their alpha channels to determine how much of the associated Macro and Micro files show.

    Order of sequence
    You should think of the order of sequence for building the battlemap as :
    1. Obtain height and feature information from stratmap.
      - Also apply climate, geography and vegetation information.
    2. Apply landscape merge mask – to merge landscape towards a central average height deemed to be 0.0 in .world terms
    3. Apply the Worldterrain vertexes merging according to the vertex world terrain merge factor
      - Applies rock values to cliffs and also applies the terrain TGA masks (other underlying geography still applies).


    This post by Makanyane helps explain pictorially the above merge processes (ie the impact of the landscape merge mask and the world terrain merge factor) :-
    http://www.twcenter.net/forums/showt...6#post11133666

    How do you change them using IWTE?
    The features for changing the world terrain are all under tab Terrain1 in the IWTE tool.

    Amend WT Mask TGA paths
    This option brings up a table where you can overwrite the TGA names and change the size associated with the macro and micro files.

    Create Terrain base TGA
    This option creates a TGA of the vertexes (The terrain TGA) and (if it exists) a TGA of the Landscape merge mask. It asks for 3 parameters which only affect the Terrain TGA.
    Greyscale control point – is a grey scale value which controls the conversion of the height to greyscale.
    Height assigned to GCP – This is the height associated with the greyscale value.
    Greyscale increments per height – This is the number of greyscale values per metre height change.
    OK this normally confuses me but what it means is if you use greyscale height 150 has Height assigned 0.0 and greyscale increments is 3.0 then a height of 1.0metres would be greyscale 153 and 2.0 would be greyscale 156 etc
    Always note the values down as you need to enter the same values when you replace the terrain TGA.
    If the height exceeds the parameter settings i.e. requires greyscale above 255 then the colour is changed to blue and if it required a value less than zero it is changed to red.
    The worldterrain merge factor is stored in the alpha channel of this TGA.
    For the TGA of the landscape merge mask this just uses a greyscale value representing the merge. It doesn’t use the alpha channel.

    Replace with Terrain TGA
    This replaces only the Terrain TGA file (the one with the vertex heights and the world terrain merge). You should enter the same parameters as used to create the file in the first place. One thing to note, if a pixel is NOT greyscale it does NOT replace the existing value. This then allows you to concentrate on editing a small piece in detail and leaves the remainder as it was.
    Please remember the TGA is a 32 bit TGA and expects an alpha channel.

    Replace with WT merge TGA
    This replaces the existing Landscape merge mask values with the values from the TGA (Note it doesn’t check for greyscale it simply uses one of the values). It also adds it in if the worldterrain file doesn’t currently contain one.
    Please remember the TGA is a 32 bit TGA and expects an alpha channel even though not used.

    Create Terrain ms3d
    This creates a milkshape file which you can then edit in milkshape. However it only works for sizes up to a maximum of 181 by 181 vertexes after which the milkshape limit is exceeded.
    This file doesn’t allow you adjust the world terrain merge factor.
    The mask TGA path information is held in the model comments. You can amend that (provided you keep the right format) or you can delete it completely.

    Replace with terrain .ms3d
    This replaces the vertex height information with an ms3d file. Like all the read backs it must match the expected file size. Model comments are read back if present but if the format is not correct this will crash. Best to remove the model comment COMPLETELY.

    Amend Terrain in 2D window
    This checks to see if a world file is already held in memory. It displays the height and location of the vertex in the 2d window. You then can drag and select vertexes and set them to specific heights or add a height increment (ie move them up/down x metres). It allows very precise changes and you can view the world file at the same time. It also allows you to set the vertex merge values.
    You need to press OK at the end to save the change.

    Resize world terrain
    This asks for a number of parameters.
    You can set the number of vertexes in each direction (most .world settlements are square but tech trees are often rectangular).
    There is then a flag to decide whether to apply any default merge values. If you set this to on then the default merge values will be generated based on the 4 entries. These 4 entries identify the distance in vertices from that edge over which to generate merge values moving from 0.0 to 1.0.
    You should also always resize the worldvegetation file or the game will crash. There is no need to resize the world pathfinding but its probably best to.

    OK that’s all there is to it.

    So a few tips we find useful
    1. Create the right size world terrain, pathfinding and vegetation first.
    2. We prefer editing generally via the TGA’s. So copy in a general TGA merge alpha and also a standard landscape merge if needed (not needed for tech trees).
    3. TGA blur effects can quickly smooth off terrain if that’s what's needed once basic heights are set.
    4. For fine tuning we use the amend terrain in 2D window
    5. It’s a good idea to think of the placement of settlement shapes from the .world in relation to the vertex positions of the world terrain.
    6. You cannot join reflective planes to other water a gap needs to be maintained eg of approx 8m. If you try it the reflective planes will disappear.


    Link to IWTE tool thread :
    http://www.twcenter.net/forums/showthread.php?t=323503
    Last edited by wilddog; January 18, 2014 at 05:36 AM. Reason: updated with link to Makanyanes posts on the merges

  2. #2
    Campidoctor
    Join Date
    Jun 2006
    Location
    Southampton, UK
    Posts
    1,563

    Default Re: Editing worldterrain files (IWTE)

    Huh, no comments for this yet?

    Well I'll get the ball rolling, this is very appreciated wilddog, keep up the great work!


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

    Default Re: Editing worldterrain files (IWTE)

    Quote Originally Posted by bobbin
    Well I'll get the ball rolling, this is very appreciated wilddog, keep up the great work!
    Hi
    Thanks bobbin. This is all pretty simple stuff. May add info on the vegetation files to this one or create separate tutorial for that dependent on demand/time.

  4. #4

    Default Re: Editing worldterrain files (IWTE)

    i would love vegetation tutorial, as you might know
    Leader of Colonialism Total War
    Thread with first Preview
    First Youtube Trailer


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

    Default Re: Editing worldterrain files (IWTE)

    I probably wasn't precise enough.
    I was only thinking about the worldvegetation file.

    However something on the vegetation.db as well would be useful... except the vegetation,db bits are more closely linked to the geography.db file.

  6. #6
    Lord Hamilton's Avatar Treun anns a' chath
    Join Date
    May 2008
    Location
    California, USA
    Posts
    257

    Default Re: Editing worldterrain files (IWTE)

    Great tutorial Wilddog! Have you considered adding a link to your IWTE tool?

    Cheers
    Former Unit Designer/Artist for War of the West (M2TW)
    Tip-toeing back into modding with ToB - Check out my Normans overhaul here!

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

    Default Re: Editing worldterrain files (IWTE)

    Quote Originally Posted by Lord Hamilton
    Great tutorial Wilddog! Have you considered adding a link to your IWTE tool?
    Hi, I've added a link. Didn't think it was really necessary before as the tool is a sticky in this forum. However now added for completeness.

  8. #8
    Lord Hamilton's Avatar Treun anns a' chath
    Join Date
    May 2008
    Location
    California, USA
    Posts
    257

    Default Re: Editing worldterrain files (IWTE)

    Quote Originally Posted by wilddog View Post
    Hi, I've added a link. Didn't think it was really necessary before as the tool is a sticky in this forum. However now added for completeness.
    Oh boy...don't I look observant FACEPALM

    Thanks for the update link though, and great work on everything! It's incredible the things people are doing with this tool!
    Former Unit Designer/Artist for War of the West (M2TW)
    Tip-toeing back into modding with ToB - Check out my Normans overhaul here!

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

    Default Re: Editing worldterrain files (IWTE)

    For info. Next version of IWTE will allow you to move the world and collision files by rotating through any 90 degree angle and displacing in either an x, y or z direction.

    This will mean the world files can be reorientated on a terrain map without the need for a 3d tool. just means you can move them around depending on the terrain amendments you want to make. It obviously doesn't allow you to change the immediate surface they stand on.

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

    Default Re: Editing worldterrain files (IWTE)

    A an example from a work in progress (there is still a lot of refinement I need to add in terms of textures etc)

    The below view shows a simple manipulation of the terrain to create a nice bend in the river leading up to the settlement edges.

    Also the latest IWTE tool does now allow rotation of settlements and movements without the need to export via a 3d graphics package. You still need to rotate the graphics for the pathfinding and terrain etc via a standard graphics package (i.e. photoshop) but that's pretty simple stuff.
    Last edited by wilddog; October 09, 2011 at 02:10 PM.

  11. #11

    Default Re: Editing worldterrain files (IWTE)

    If this is what I think (a perfect merge of campaign and settlement map water), it's just genious.
    I experimented so many hours to get roughly a good merge for the Osgilaith river, but it is far from your result.

    Can you maybe tell me on which height your "reflective plane" is and what water colour on the campaign you use? I really got a bit crazy on experimenting with that...

    Winner of 'Favorite M2TW Mod' and 'Favorite M2TW Modder' Award 2007 & 2008

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

    Default Re: Editing worldterrain files (IWTE)

    Quote Originally Posted by King Kong
    If this is what I think (a perfect merge of campaign and settlement map water), it's just genious.
    I experimented so many hours to get roughly a good merge for the Osgilaith river, but it is far from your result.

    Can you maybe tell me on which height your "reflective plane" is and what water colour on the campaign you use? I really got a bit crazy on experimenting with that...
    Thanks KK... appreciated given the standards of your work.

    No reflective plane used this is purely using the river. Top center you can see a light terrain patch which is the course the river used to take. I plan to cover that via one of the texture paths. It uses a large base to control the far side of the river and move it further into the tile.

    Main issue I had (and need to check its completely gone) was a weird patch of river which had no ripples. Other than that I ended up rotating the settlement 90 degrees (which is now its correct setting) hence the inclusion in the IWTE release.

  13. #13

    Default Re: Editing worldterrain files (IWTE)

    wow, that's really cool, didn't think that this is possible. But did I understand this right, that you have just edited the map_heights.tga and your settlement .worldterrain file to "force" this river into this position?
    Anyway, thanks for your explanation and your appreciation!

    Really looking forward to the point when you finally preview your castles.

    Winner of 'Favorite M2TW Mod' and 'Favorite M2TW Modder' Award 2007 & 2008

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

    Default Re: Editing worldterrain files (IWTE)

    @KingKong
    Yes that's correct. This is just using the campaign map and then a large based worldterrain.

    The basic problem to watch out for (and the same applies for sea shores) is that the underlying geography remains the same (except for rocks). Consequently on the radar map and on the actual battlemap you will see the geography associated with river even though you have moved the river (or sea) and the new river or sea will be over 'normal geography not associated with the river eg you see the mud sand type geography bits.

    You should be able to use the battlemap masks though to add an overlay to 'correct' that.

    The strat map I used basically has the river flowing down then moving one square to the right then down again.

    We're still way of preluding too much at the moment... you will probably of done another few cities before us ;-)

  15. #15
    wolfslayer's Avatar Senator
    Join Date
    Oct 2007
    Location
    Lexington, South Carolina
    Posts
    1,170

    Default Re: Editing worldterrain files (IWTE)

    The Landscape merge mask

    Yes! Now I understand somewhat how this works.

    This is the key to "mountaintop" forts placed in descr_strat (as long as you have at least one adjacent tile that units can access), and also converting small settlements like villages into alternate ambients for models like large_hamlet and large_farm, etc.

    Filling the wtmerge.tga pure white completely flattened the battlemap to sea level, with only the terrain heights visible when you view the terrain.ms3d rendered.

    Pure black did the opposite, of course, with my pseudo "Gibraltar" fort conforming to the shape of the "mountain" I created with map_heights.tga.My previous version was much "harsher" (looking a bit more like The Rock).

    I had to redo this from scratch, so it still needs adjusting, really just an experiment, you get the main idea from this composite screenie.
    ______________________________________________________________


    Viewing and editing MTW2 textures with MWthumb and DXTbmp









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

    Default Re: Editing worldterrain files (IWTE)

    updated a couple of comments with reference to terrain mesh and reflective planes/water

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

    Default Re: Editing worldterrain files (IWTE)

    minor wording change on section on The worldterrain merge factor - for those that read it!

  18. #18
    makanyane's Avatar Praeses
    Content Emeritus

    Join Date
    Feb 2006
    Posts
    9,093
    Blog Entries
    1

    Default Re: Editing worldterrain files (IWTE)

    am adding some diagrams here to help those new to it understand the effect of the terrain merge factor and also the landscape merge mask plane (if present)

    the red line shows a diagram of a hypothetical terrain profile - the part with buildings is at nominal height above 0 - the edges below 0 - to form a hill effect. The green line shows the shape the battlemap terrain would have formed if the building/terrain wasn't there. The game places the settlement/building terrain so that it's nominal 0 height is at the average height of the battlemap under the terrain area.

    If the terrain didn't have any merge factor applied to the outer vertex points then the result in game would be a cliff edge rising from the end of the red line where the terrain size ends up to the green line. However with a merge factor applied to the outer points so that they blend between 1 and 0 (white to grey on the wtbase.tga alpha) then the amount of effect of the terrain height is multiplied by the merge factor and so as it tends to a merge factor of 0 it blends back in to the battlemap profile, as shown by the dotted lines.


    The effect of having a Landscape Merge Mask plane in the .worldterrain file (as is present in vanilla settlements) is that the 0 level is found from the average of the area under the Landscape Merge Mask size (that is a fixed hard coded size) the landscape merge mask is an entirely flat plane at what the game has determined as the nominal 0 height for the settlement. This plane is represented in the wtmerge.tga produced by the IWTE tool as a 256*256 pixel square. If that was an all white square (i.e. no merging) then you'd get a cliff edge up from where the blue plane ends going up to the green line of the battlemap.
    If the mask is merged off to black, as with vanilla examples, then you get a resultant shape as shown by the dotted lines in the image above.

    The effect of the Landscape Merge Mask plane together with the example terrain is shown below.


    The settlement terrain (red line) still does the same thing, but it now blends with the result of the combination of the Landscape Merge plane and the battlemap.

    NOTE: because the terrain shape is applied over the result of the other two files you'll only actually see an effect from the Landscape Merge Mask plane if the effective* terrain size is smaller than the hardcoded size of the plane, as above we think the plane is equivalent to approx 128 as a terrain size.

    *If the terrain vertexes inside the 128 area of a larger terrain have a low or 0 merge factor then some of the effect of the plane would come through as it will be merging to the result shown in the second pic...

  19. #19

    Default Re: Editing worldterrain files (IWTE)

    Am having trouble getting a smooth merge between my settlement terrain and the battlemap terrain. It's not a problem with the tool or that I don't understand how it should be done, it's more that I suck with GIMP and can't figure out how to get the effect I want.
    Spoiler Alert, click show to read: 






    The area on the right is my main concern, but if you can help with the difference between the terrain textures on the left as well.

    I think my main problem is that I can't figure out how to edit the area in the transparent section, the existing attributes in the transparent section are from an existing settlement. Any help welcome and greatly appreciated.

  20. #20
    makanyane's Avatar Praeses
    Content Emeritus

    Join Date
    Feb 2006
    Posts
    9,093
    Blog Entries
    1

    Default Re: Editing worldterrain files (IWTE)

    I can't figure out any way of directly editing the alpha properly in GIMP (there's a reason why I bought Photoshop!)

    ...but, if you have only one layer in GIMP and then use the Eraser Tool on it that gives black alpha - if you use the same Eraser Tool with 'Anti erase' clicked or with Alt held that gives white on the alpha - change the brush settings (opacity etc) of the eraser to get to greys and more subtle stuff.



    Terrain textures on the left; I think is where the terrain finishes and presumabley you've got a mud mask (or one of the others) that covers the whole area (the mask is amended by alpha only)

    from memory if you mess up the path/name of the masks - so it can't actually find the mask - then that gives the same effect as the mask covering the whole area - double check all the file names/paths in your terrain (Terrain 1 tab 'Amend WT Mask TGA paths' button)

    btw, I think you probably need to increase the size of your terrain (and worldveg) slightly to get a bit more space for the merge to work properly.

Page 1 of 5 12345 LastLast

Posting Permissions

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