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

Thread: IWTE - Vegetation editing

  1. #1

    Default IWTE - Vegetation editing

    General notes on vegetation and geography .db's

    The vegetation.db is found at data/vegetation/vegetation.db
    it has similar content to data/descr_vegetation.txt, which is a useful guide to the original contents of the .db, unfortunately changing the .txt file does not update the .db - the later versions of wilddog's IWTE tool allow reading and re-writing to the .db so changes can be made.

    Vanilla unpacked games contain descr_geography_new.db and descr_geography_new.txt. If you add ;
    [misc]
    rebuild_geography_db = true
    to the .cfg file then the text file will be re-used to re-build the geography.db on each launch, this method is however not recommended. Instead delete or rename the descr_geography_new.txt file and use IWTE to amend descr_geography_new.db file.


    Add a new model to the vegetation.db

    To add a new vegetation model to the .db list, download IWTE_v14_07_A.exe or later, place the .exe somewhere convenient near copies of your vegetation files. Launch IWTE and use 'veg' tab and 'Read VegDB binary' to load the .db, use 'Edit Vegmodel List' to add model. Press 'Add New Vegetation model' type in name of model and sprite, i.e.
    new_tree.vege_model &
    new_tree.vege_sprite
    paths are not used, the game assumes .vege_models are in vegetation/models and .vege_sprites in vegetation/sprites, once done press 'OK'

    to assign the new model to a climate select
    'Edit VegGroup List' and select the climate, season and vegetation type you want to change, select 'confirm group' and then either replace an existing model or add in an unused slot (unused slots should be at the bottom of list - no more than four models are possible per group), when done press 'OK'

    then select 'Write VegDB binary' and choose file name for the new file. To get the new veg.db in game re-name it and use in place of the existing file.


    Components needed to add new vegetation model

    new parts needed shown in bold, example file names in italics;

    vegetation/models/new_tree.vege_model
    .vege_model contains reference to textures/new_texture_name
    so the corresponding file is needed;

    vegetation/models/textures/new_texture_name.texture

    vegetation/sprites/new_tree.vege_sprite
    .vege_sprite contains reference to diffuse and normal map, i.e.

    diffuse_maps/new_tree_diff.texture &
    normal_maps/new_tree_norm.texture

    those paths are relative to the sprite positions so the following files are required;

    vegetation/sprites/diffuse_maps/new_tree_diff.texture
    vegetation/sprites/normal_maps/new_tree_norm.texture

    NB: IWTE sprite files use different .texture names than vanilla M2TW sprites, we've added the _diff and _norm parts to make the files easier to identify and let them exist in same output folder, do not change the name of the IWTE sprite textures (unless you also edit the .vege_sprite)

    Creating new .vege_model
    IWTE converts from .ms3d only. The conversion is on 'Veg' tab 'Convert ms3d to Vegmodel'. The ms3d file needs to have the required texture name in the format
    textures/texture_name.texture
    in the 'Model' 'Comment' section, see pic;.
    If you want to adapt an existing model you can use 'Convert Vegmodel to ms3d' - if you want to use a RTW model you can use that process to convert the first listed model of the climate (re-name the RTW .vege file to .vege_model). If you have access to RTW .cas files you can convert most .cas's by using IWTE's "Strat Map" tab "Read Strat Cas" > "Write Strat Cas to MS3D". (You can also run the RTW veg process to make separate .vege files for each .cas if you adapt the RTW descr_vegetation.txt file - or use 3ds max to export the .cas in obj format for import to milkshape)

    Tips on creating new models;
    In game the vegetation models display both sides of a plane, i.e. backfaces are shown, but the lighting is always displayed as whatever the lighting would be on the front face... So the best method of creating a plane that needs to be viewed from both sides is to create a double sided structure by duplicating the plane, reversing the vertex order for one part, then welding the common vertexes together and getting IWTE to create new normals, see post 2 for details. Cylindrical things like trunks, should just be constructed normally and not be double sided.

    Old advice spoilered;
    Spoiler Alert, click show to read: 
    therefore it's best to avoid planes that have a marked light or dark appearance when displayed 'flat shaded' in milkshape, starting with mid toned 'curved' surfaces and not allowing 'auto smooth' in milkshape is best - or borrowing similar bits of existing models. Using 3ds and using the explicit normal settings and converting to ms3d via obj might work but I haven't tested...



    Do not
    overlap the uv co-ordinates beyond the extent of the texture - in milkshape this shows up as looking OK with the texture just tiled around, but in game the overlap actually tiles onto the next model (hence the silly hollow looking bits in some of the vanilla 'unused' climate rocks)

    The .dds / minimap / texture conversion bit of the texture process tends to mean that what you think is background colour under the alpha'd out bit of a texture actually appears as a halo around your model as you zoom out. For best results set the background colour of the texture to match the visible bits.

    Creating new .vege_sprite
    To get IWTE to do this you need to use 'Veg' tab and 'Create VegSprite',
    select the .vege_model you want a sprite for, to get this to work you need to have a .tga version of the .texture that is listed within the vege_model in the appropriate place, i.e. the /textures/ folder.

    The tool will then create a binary file called
    vege_model_name_new.vege_sprite - (this contains the file path to the sprite .textures assuming they have the same name as the model with _diff and _norm added, and that they will be placed in the diffuse_maps and normal_maps folders, it also contains other information about the bits of the .textures to be displayed for various angles, the scaling and the origin points, hopefully that should all work from the default generated from the tool)

    the tool will also produce .tga's called
    vege_model_name_diff.tga
    &
    vege_model_name_norm.tga
    in the same folder as the model - you need to rename the .vege_sprite file to whatever you called the sprite in the db and place it in the vegetation/sprites/folder
    the .texture file names are contained within the sprite in binary format and shouldn't be changed. The sprite .tga's need to be converted to .dds and then to .texture and placed in the appropriate folders. The _diff version needs to have the alpha saved, the _norm version doesn't.

    With wilddog's latest version of the sprite generator the .tga's generated are pretty good, even possibly a bit better than vanilla . I wouldn't recommend trying to fiddle with the normal unless you know a lot more about it than wilddog managed to discover (it's nothing like the nvidia filter used for unit/building texture normals, but based on the model vertex tangents) - you could if you wished fiddle with the _diff part which represents the projection based on texture colour and alpha, rather than the model shape. However, the sprite tga size should stay at 256 pixels high, attempting to mix in other heights of tga may result in the sprites overlapping onto the next sprites in the climate.

  2. #2

    Default Re: Vegetation editing

    Converting RTW style .cas to M2TW suitable model.

    The in game lighting works differently on trees in M2TW than it did in RTW - to improve the appearance of converted RTW models you need to change any flat planes to double sided with coplanar normals. The following shows how to do that using Milkshape and IWTE (example tree .cas supplied by Gigantus).

    Viewing Normals
    (At this stage we don't want to have textures loading for the models so don't include them in textures folder.)

    First of all in IWTE to see what we're aiming at click the "Views" tab, and also select "Show 3D windows" and "Show Normals" - go to
    "Veg/GeogDB" tab and select "View Vegmodel", navigate to one of the vanilla M2TW models like the Conicalpine;
    look at the 3d window and twiddle it around a bit, you'll see that the normals (red lines) stick out in the same direction as the 'branch' planes would continue, i.e. they're colplanar with them, the normals for the trunk section stick out perpendicular to the planes in the trunk - this is what you want to achieve;
    Click image for larger version. 

Name:	conical_pine.jpg 
Views:	20 
Size:	18.0 KB 
ID:	314660

    Taking the example .cas model and converting to .ms3d using the function on the "Strat Map" tab, and then converting the MS3D to .vege_model using "Veg/GeogDB" tab "From ms3d/Create normals" and then using "View Vegmodel" again we get;
    Click image for larger version. 

Name:	example_tree1.jpg 
Views:	12 
Size:	14.0 KB 
ID:	314661
    here you'll see that both the flat planes for the 'branches' and the cylinder for the 'trunk' have the normals perpendicular to the planes, we need to change that for the branches...

    Amending Model in Milkshape
    Open the .ms3d file in Milkshape, it'll have everything selected. Go to "Model" tab, click "select" "face" and tick "by vertex"
    left click anywhere in any of the windows to de-select everything. Right click in any of the windows where you'd like to change the view type, 'wireframe' or something with 'wireframe overlay' will be easiest.

    Now we're trying to select all the faces in the trunk, hold down 'shift' on your keyboard, and with left mouse button depressed draw a box around the vertexes (dots) at the bottom of the trunk.
    Click image for larger version. 

Name:	select.jpg 
Views:	22 
Size:	88.7 KB 
ID:	314662
    that's selected the faces that are attached to them, they've turned red.

    Now holding down shift button again, select the vertexes at the top of that section. If you can't see them clearly scroll in necessary using 'shift' and mouse scroll wheel, & to move view use 'Ctrl' key and mouse left button drag. Again use 'shift' and box drawn with left mouse button to select additional vertexes and their linked faces.
    Click image for larger version. 

Name:	select2.jpg 
Views:	8 
Size:	144.5 KB 
ID:	314663
    If you lose your original selection and need to go back use Ctrl + Z on your keyboard to go back a step. If you select too much and want to de-select it hold down shift and use right mouse button to select the vertex.

    When you think you've got all the trunk bits experiment by selecting 'move' and dragging them away. You might also want to view the model with texture at this stage.
    Go to "materials" tab and select material0, then the first texture name tag, click it and browse to the texture which needs to be in a format milkshape can read. (The actual texture name to be used in game needs to be included in "Model" "Comment" see 1st post). Right click in the 3d window and set it to 'textured' with 'wire frame overlay', twiddle the view around in there by dragging with mouse left button.
    Click image for larger version. 

Name:	test.jpg 
Views:	24 
Size:	115.1 KB 
ID:	314664
    If that looks OK and you've got the trunk and branches separated correctly use Ctrl+Z or "Edit" "undo move" to put the trunk back in its original position.

    With the trunk bits still selected go to "Groups" tab and hit "Regroup" then hit the "Hide" button immediately above that. The selected trunk bits will disappear.
    Click image for larger version. 

Name:	duplicate.jpg 
Views:	8 
Size:	212.0 KB 
ID:	314665
    Then hit Ctrl+A or "Edit" "Select All" to select the remaining visible bits
    then Ctrl+D or "Edit" "Duplicate Selection" to make an exact duplicate of them.

    That will leave you with a new group, the duplicate, that is the only thing still selected.
    With it still selected go to "Face" and use "Reverse Vertex Order" or Ctrl+Shift+F shortcut
    Click image for larger version. 

Name:	reverse.jpg 
Views:	13 
Size:	205.3 KB 
ID:	314675
    you will now have a double sided version of the branches.

    To get things back together ready for the IWTE conversion, use
    "edit" "unhide all" or Ctrl+Shift+H
    and
    "edit" "select all" or Ctr+A
    go back to "Groups" tab and hit "Regroup" (it doesn't matter what group is called but there must only be one of them)

    To end up with nice shared normal we need to weld the duplicated vertexes of our double sided structure back into single vertexes. With everything selected (Ctrl+A)
    go to "Vertex" and use "Weld Together" or Ctrl+W
    Click image for larger version. 

Name:	weld.jpg 
Views:	14 
Size:	187.9 KB 
ID:	314676
    Save the ms3d file with the name you want to use in game, e.g. my_tree.ms3d

    Make Vege_model with IWTE
    In IWTE use "Veg/GeogDB" tab and "From ms3d/Create normals" this will generate the .vege_model
    (Always use the 'create normals' option unless you've done something, much more sophisticated than this, like using individually adjusted explicit normals in 3ds max and managed to get that coverted to ms3d!)

    Use "View Vegmodel" as before to view the normals,
    twiddle the 3d view around and you should see that they're all now in line with the planes the project from;
    Click image for larger version. 

Name:	new-normals.jpg 
Views:	10 
Size:	20.8 KB 
ID:	314677

    you can also see the difference in effect if you create the sprite .tga's with the 'before' and 'after' versions of the ms3d

    The top 'before' version might look like fun, but will come out with excessive and inappropriate contrast in game.

    Top version here is the single sided version (without any attempt to try and neutralise things);
    Click image for larger version. 

Name:	in-game.jpg 
Views:	83 
Size:	184.2 KB 
ID:	314680
    Lower version is the one that's had the double sided fix described above.
    Last edited by makanyane; September 26, 2014 at 09:57 AM. Reason: model tutorial added

  3. #3

  4. #4

    Default Re: Vegetation editing

    grass editing section moved here;
    http://www.twcenter.net/forums/showt...-vegetation-db
    Attached Thumbnails Attached Thumbnails summer-texture-ps.jpg   silly-colours.jpg   texture-changeonly.jpg   geographydb.jpg   bluegrass.jpg  

    texture co-ordinates.jpg   groups.jpg   high grassdetail.jpg   lowgrassdetail.jpg  
    Last edited by makanyane; June 27, 2014 at 09:08 AM.

  5. #5

    Default Re: Vegetation editing

    wow, just saw this, the promised tutorial...

    Eventhough i don't plan on working again on this before some time, I really appreciate the work put into this.

    I am repeating myself, but thanks makanyane

  6. #6
    ThatOtherGuy's Avatar Tiro
    Join Date
    Mar 2012
    Location
    Denver or Seattle, Depends on the time of year.
    Posts
    255

    Default Re: Vegetation editing

    So I followed exactly what this tutorial said and I am getting this mess of "ew".

    Spoiler Alert, click show to read: 


    Along with that disgusting bleed the sprites themselves (not shown for odd reasons) are greyed out. I checked out the uvs and the only uvs that are overlapping are the leaves, which CA's trees do as well. Are there any further comments that need to be looked at in Milkshape, like materials and groups?

  7. #7

    Default Re: Vegetation editing

    The milkshape model should only have one group. The group doesn't need a comment. You need a .tga version (not .tga.dds) version of the texture to get the sprite process to work.

    UV's can overlap each other just don't go off the edge of the texture map... I know some of CA's do that, but they are also buggy and can end up showing bits of the next tree/rock in the climate.


    If that doesn't help please upload the files somewhere and pm me the link and I'll have a look (ms3d and textures)




    Have remembered I need to update the model making tips bit - there's a better way of getting the smoothing to work now - basically;
    create any flat planes as single sided planes in milkshape - duplicate them - reverse the vertex order on the duplicate (so you now have a two sided version) - 'weld all' in milkshape and use the "From ms3d/Create normals" button to create the vegemodel... that sorts some of the lighting problems. I'll try and write that up properly later, but need to re-install ms3d first, am still trying to fix computer after a complete re-format last week!

  8. #8

    Default Re: Vegetation editing

    I'm aware that my request is off topic, but I didn't find where else to ask. I'm trying to replace some tree models in the Campaign map. I have modelled the trees from scratch, assigned them a texture (.tga with alpha), I have given them a unique name and then I have put the .cas filke inside the "tree_model" directory of the mod and the texture in its subdirectory "textures".

    Changed the descr_climates.txt in which I put the name of the new model into a coup,e of climates. It happens that the game seems to read and open the new files ()at least, no errors reported at trace level), but the map crashes as soon as I move the mouse. By the way, the map looks completely empty (no trees, no roads). Only agents.

    Is there a guide, tutorial I can read to learn how to add correctly new tree models on Campaign map? Of course, if you have suggestions they are more than welcome.

    Thanks in advance

  9. #9

    Default Re: Vegetation editing

    odd... normally either you've got the .cas name wrong, in which case the tree just doesn't appear, or you've got the texture name wrong in which case the game crashes (but normally before the campaign map loads)

    I'd check the texture name/type first. If you're doing it in a mod-folder you should be using .tga's not .tga.dds's.

    You can open the .cas file to view it with either a text editor or preferably a Hex editor - scroll down to near the bottom and you'll see the texture name in normal type.
    It should look like
    textures\my_tree.tga
    check the folder and file name and that it's got .tga on the end


    only other thing I can think of is if you made it insanely huge, either in poly numbers or in scale, check that too

  10. #10

    Default Re: Vegetation editing

    Thank you for the reply.

    I have checked everything as you suggested: the model is 642 poly and 1.057 vertices, so I guess is not that huge, and it is scaled the same size of an existing tree (birch_a.cas). Is there any "rule" to name a cas file? I have used for the cas "betulla_01.cas" and for the texture "betulla_01.tga" (targa type 2, 32 bit with alpha, 256 x 256 pixels, 256 kb). They are both in the correct directory. According to the log (set on trace again), both the file and the texture are found and opened from the mod directory, but it says that the texture "betulla.01.tga.dds" is missing.

    Anyway, same story. The game loads and as soon as I move mouse, it crashes to desktop. And there are no trees anywhere around, but all the other strat models appear regularly.

  11. #11

    Default Re: Vegetation editing

    It'll always look for a tga.dds after finding the .tga but they're not actually needed except if you're desperate to reduce file size (and create 1px .tga) and for some really odd bits (cliffs) where it's necessary to force the mod-folder to be read.


    OK, try some bug hunting techniques. Save a copy of your .cas and texture somewhere safe.

    Choose a .cas which you know was in use in the vanilla game and make a new copy of it, just by file copy and paste in windows, then re-name the copy betulla_01.cas.
    See if that loads, if it doesn't then your problem is something you've done to descr_climates or something elsewhere in the mod.

    If that does work then put your .cas back in but make a similar copy and paste version of a vanilla texture and call it betulla_01.tga,
    if that crashes problem should be in the .cas if it works problem should be in the texture.

  12. #12

    Default Re: Vegetation editing

    Thank you for your kind help. The problem is definitely with the .cas file. Maybe too many poly or vertices, I truly don't know whether for these kind of strat model there is a limit. Just another question: before parenting to the scene root, I have attached all the meshes together, I mean the leves to the trunk. Is it better to keep them separate and to link one by one independently?

  13. #13

    Default Re: Vegetation editing

    Quote Originally Posted by Karadjordjevic View Post
    Just another question: before parenting to the scene root, I have attached all the meshes together, I mean the leves to the trunk. Is it better to keep them separate and to link one by one independently?
    From that it sounds like you're probably using 3ds Max and the old RTW .cas creation script within that... I'm not familiar with that method, or whether it creates problems with M2TW strat trees. I'm more involved in IWTE which has a Milkshape to ms3d to 'cas' conversion see here; http://www.twcenter.net/forums/showt...ed-tutorial%29

    If you can't resolve your problem could you post the .cas file here for me to have a look? I can do the conversion back to milkshape and see if there's anything obviously weird...

  14. #14

    Default Re: Vegetation editing

    After some trials and the great help of robomanus who guided me like a a father with a baby, I have managed to have my model in the Campaign map. Sadly, even if I have connected it to the scene root of a watch tower, that cursed animation is still there.... The problem was the amount of vertices: staying around 350 solved the problem.

  15. #15
    paradamed's Avatar Praepositus
    Join Date
    Jun 2006
    Location
    Brasília, Brasil
    Posts
    5,806

    Default Re: IWTE - Vegetation editing

    Great tutorial Mak! Thanks!

  16. #16
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Re: IWTE - Vegetation editing

    At long last my cherry blossom trees will get into the RotK mod


    Edit: to convert TGA to TEXTURE you may want to have a look at my Creating a World – LOD reduction without texture loss - it sets up the M2TW\export folder with an easy to use 1,2,3 procedure for it.
    Last edited by Gigantus; September 24, 2014 at 08:43 AM.










  17. #17
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Re: IWTE - Vegetation editing

    I am running into a road block here. Using version IWTE_v14_08_A.

    When I click 'Read VegDB text' it first asks for the DB file and then for a TXT file. I obviously don't have the TXT file so I go back and click 'Write VegDB Text'.
    Now back to 'Read VegDB text' and after reading both files I click 'Edit Vegmodel List' and the 4 items in the left column 'grey out' and I haven't got a clue how to proceed further.

    Now I discovered I have to activate the 'Main Process' window - because the 'Painter Process' window is active by default.

    Exchanged one model, clicked 'Write VegDB Text' and hoping for the best in game










  18. #18

    Default Re: IWTE - Vegetation editing

    @Gig for simple things you don't need to use the VegDB text at all... you'd only use that if you want to mess around with the grass (see separate tutorial) or experiment with some of the unknown values... you don't actually use the IWTE generated Veg TXT file in game (and game doesn't use the vanilla version either)
    the DB file is the only one used by the game. The IWTE Veg TXT file is just there to allow the DB to be converted to and from a human readable/editable version for the more complex things not covered by the tool buttons.

    you should just be using ReadDB - do whatever to vegmodel list/assignment - WriteDB

    EDIT: and yeah that 'main process' window thing will be fixed in next version

  19. #19
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,096
    Blog Entries
    35

    Default Re: IWTE - Vegetation editing

    I think I need to first find a better way about the models. They are actually RTW models and I converted them from CAS to OBJ via autodesk and the plug in and then from OBJ to Milkshape.
    Looks like something didn't work the way it should.
    I simply replaced the date_palm model with mine (after abandoning the DB method because it wasn't necessary) - guess I messed something up when doing the sprite\normal files. The actual model doesn't look that hot either.



    I used a different model which looks much better, but the problem of the squares remains. It looks like a LOD issue because the squares appear at a certain (rather short) distance.

    Edit: just before I closed IWTE I saw an error message: [path to texture tga file - it's in the 'textures' sub directory of the model] Not read correctly so ignored. I wonder if that may have to do with it.
    Last edited by Gigantus; September 24, 2014 at 10:44 AM.










  20. #20

    Default Re: IWTE - Vegetation editing

    In M2tw vegetation there aren't any LODs you just have model then sprite then nothing

    your black squares are the sprite - they've come out black because it hasn't found the texture
    the tree texture has to be in tga format and in the 'textures' sub-directory.

    your sprites are square and not tree shaped because your sprite.diff texture has lost it's alpha channel - the tool produces a .tga which you need to convert to the .dds DXT5 type which retains the alpha information and then convert to texture.


    http://www.twcenter.net/forums/showt...1#post13489853
    is where I was explaining to someone else about converting RS2 vegetation - you should be able to use IWTE's "strat map" convert .cas to .ms3d function to get from their .cas's without going through .obj files, which tend to cause problems (I say should because there seem to be infinite versions of ways .cas's can be written and every now and again we find one that breaks things...)


    That particular tree I don't think is going to look good in M2... generally they are already a bit more detailed - those sort of vertical planes revolved around the trunk things don't work that well... the RS2 stuff should work better but see above post about duplicating/welding/resetting normals, as they'll still need that.

Page 1 of 5 12345 LastLast

Tags for this Thread

Posting Permissions

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