Modifying Tileset
From NWN1 Custom Content Guide
[edit] Why Modifying ?
There are a few major cases where you want to modify a tileset :
- bioware tileset do not cover all possibilities you wish to implement in your module/PW : you want sandy coasts in rural, cave entrance in some corner instead of always facing, water in the forest tileset, lava in your caverns, city gates in rural, etc.
- someone released a tileset containing only a few elements you would like to use in your own tileset, or you want to add to bioware tileset.
- someone released some interesting tile models you wish to integrate to your tileset (a tower pack, elven buildings, etc.)
- you found some bug in some tileset (people can walk through a tree, wall, stone, people gets truncated when walking in water, the top of a tile obscurs the player view instead of fading when closing in, walking on water doesn't produce the splash sounds you expect, etc.)
[edit] Notes before starting
Always backup anything you are about to modify ! You don't need to be a 3D artist to do some modification to a tile/tileset. Yet you will probably need GMax and NWMax for most. You should also get a .Set Editor, .ITP editor (or GFF), NWNViewer, NWNExplorer and a good text editor (see Tools). If you get stuck, read this thread on bioware forums, gathering all kind of info about tiles & tilesets.
[edit] Various Modifications
[edit] Change textures of a tile
Check Tilesets:Textures first. Also, Velmar released a 2-parts tutorial "Tileset Retexturing for Dummies". You can find them on the vault, or at http://velmar.dladventures.com under Tutorials.
The textures are TGA or DDS file that 'color up' a model. Those files are referenced from inside the model file. So changing the texture of a tile can be done two ways :
- modify the texture file and keep the same name
- modify the model file to reference new texture files
While the first one is the easiest to do, it will impact all tiles that uses that texture. For example if you rename copy ttf01_cliff01.tga onto ttd01_cliff01.tga and ttf01_cliff02.tga onto ttd01_cliff02.tga (place them in your override folder for example), you will change the color of all desert cliffs to match the color of forest cliffs. You will do this usually when you want to create a new tileset by re-texturing an existing one (like Velmar explain in his tutorial).
The second option (changing the model file) will most probably used for copying tiles from a tileset to another set (like adding the cliff stairs from the desert set into the forest set). You can edit the model with your favorite 3D tool but if you are no 3D artist or if you want to do it fast you can use a search and replace tool that operate on one or more file. For single file you can work with TextPad (or other advanced text editors). For multiple files at once, use a search and replace tool (check Tools#Misc section).
To identify which file is used to texture which part of the tile, I have no better technic than Velmar's in his tutorial :
- look at file names (ttf01_cliff01 is obviously used to paint cliffs right ?)
- use NWN Viewer & NWN Explorer
NWN Viewer let's you identify each object (i.e. part) of a tile. A dropdown lists all objects and selecting one colors it in purple. NWN Explorer let's you view and export model file in ascii. This can be used to find which texture file paints which object of the model. For example (from ttd01_a01_01.mdl as ascii) :
node trimesh Object401 parent ttd01_a01_01 #part-number 17 ambient 1 1 1 diffuse 1 1 1 specular 0 0 0 shininess 1 bitmap ttd01_cliff01 verts 23 ...
The object named Object401 uses texture (bitmap) ttd01_cliff01 (.tga or/and .dds). Go in NWN Viewer, select ttd01_a01_01.mdl, and highlight Object401. See ? easy.
[edit] Copying elements from tile to tile
When you want to change the look of an area (for example you want to make drylands out of the rural set) changing the textures won't be enough. You might want to remove the leaves from some trees, or add cactus to some tiles. Here I'll explain you how to copy a tree from a forest tile to a tile I took from rural and retextured for forest.
You can do so using GMAX, without being a 3D artist.
A few notes for those who don't know GMAX (like me) :
- Do not play around with your mouse (for example to rotate or to zoom like you were used to do in NWNExplorer for example). It will modify the model and that you don't want to.
- The main screen is composed of toolbars, and of 4 areas called 'top', 'front', 'left', and 'perspective' : they are views, they show you what your model look like view looking from front, side, above, etc. The active one is highlighted in white.
- The x/y/z tri-color axis represents horizontal (x), vertical (z) and depth (y). I think it's called a Pivot. When you make some selections, one might appear on the selected object.
- The tools at the bottom right do not modify the models, just the way they are displayed to you (there you find a "hand" to "Move" from where you view the model, a "circle with a 3D axis" to "rorate" the perspective view, a "magnifying glass" for "zooming" your view, and a "blue rectangle over a black one" called "toggle min/max" to make the current view takes the most possible space on screen)
- The toolbar below the menu holds some working tools : selection tools (the white arrow and the few on it's right), texture tools (the balls near the end), etc.
- the toolbox on the right side is to create (the white star with a mouse) or modify your model (the blue 'rainbow').
- GMax saves as .gmax files that can't be used by nwn. NWMax offer Import and Export options that you will have to use.
- A model is a set of polygons (triangle, square, ... to n-side shapes). The sides are called Edges. The dots where the Edge touch are the Vertices (one vertex). Each polygon is cut down to triangles that are called Faces. Adding up all those triangles re-create the polygon.
- It takes some time to get used to the interface : load a model and play around first with rotate, zoom and such. one you are confident with that, close the model (without saving) and start working : follow the steps below.
Steps :
- Extract the mdl+wok files (model and walkmesh), for your tile and for the tile where you want to take the tree from. I'll call the files MDL1 et MDL2 in the following steps.
- Open GMAX (with NWMax).
- (optionnal) before loading models, if you want to see their textures, you have to export all textures (at least those used by the tiles) into some folder, then go to menu Customize > Configure Paths > Bitmaps, and add your folder there.
- Load both tiles in gmax (from the NWMax floating bar > Mdl Loading > Import)
Both tiles will appear on top of eachother. - Use 'select by name' (top toolbar an arrow on some text lines), a dialog box appear showing all objects present in the loaded models.
- Hit 'Display subtree', the list re-organises and shows the model name and below all objects from that nwn model. That's because in NWN every model has a root 'helper' unseen object which goes by the name of the model, which act as a parent for all objects of the model.
- Select MDL2 (the one which hold the tree you want to copy from), and hit 'Select' : the dialog closes and one of your tiles is highlighted in white frames.
- Hit "Select and Move" (top bar, the arrowed double-cross). look at the bottom, below the views you will see 3 textfields : X, Y, and Z. enter 1000 (or more) in X and press 'Enter' on keyboard. That should shift your MDL2 to the right, next to the first one so that we clearly see who is who :)
- Now we want to select from MDL2 everything we need. The easiest is to hide everything we don't need. Hit "Select Object" (top bar, white arrow). Click on parts of MDL2 on any view and right click in the view (a red menu appear), select Hide Selection.
- There were 2 cyan "pixels" floating around my tree, that I got told to hide too, but I don't know what they are.
- Once only the tree remain (in the second tile, don't hide from the first tile :)), hit "Select by Name" (and display subtree) : everything which is not under MDL1 is what remains unhidden from MDL2, so it's your tree. Select all tree parts (hold shift or ctrl to multi select), then "Select" (the dialog closes and your tree is selected).
- Hit "Unlink" (topbar, 2 white squares with a broken red chain). Now your tree is no longer part of MDL2. KEEP the tree selected.
- Hit "Select and Move" (topbar, the double cross), and move the whole selection (with your mouse on any view) where you want the tree to appear on MDL1 tile. Use each view to place your tree correctly (especially use the front or left to make sure the tree is on the ground, a bit below surface - you don't want it to appear flying above ground -, not too much). When you move, it seems you can only move alone one axis at one time : drag the x, y or z axis to move along this axis, release the mouse and drag another axis. I guess it takes quite some time to get used to. I also guess you can rotate the selection (topbar, round arrow).
- Once in place, we want to make the tree part of MDL1. Hit "Link" (topbar, red chain). Dialog opens, and select MDL1 BASE, then "Link". Go back to "Select by Name" and see that your tree pieces are below MDL1 now.
- Now we want to remove the MDL2. Right click the view (red menu) to Unhide All. "Select by Name", select MDL2 and all it's subchildren elements, "Select" then delete by pressing the Del keyboard key.
- At this point you can export your work (becareful, when I did NWMax > Export it didn't save in the directory I picked, but it saved as my original file !! so make backup first)
- Place the mdl+wok in some hak or override and test it in toolset and in game. You will see that you can walk THROUGHT the tree (except if you placed the tree on a non-walkable part).
- Go back to GMax.
- Now we want to select the walkmesh object that lies below the tree, to modify it. I don't know exactly how to recognize the walkmesh from the other object, but it's untextured, and for me it was green (cause green represent NWN Aurora Grass type of ground). And since it's stacked with the normal textured ground, you might have to select (topbar, white arrow) and hide some things until you have your walkmesh selected (well do not hesistate to hide more than necessary, especially what can come in your way : the leaves, the rocks, etc.)
- We will want to edit the walkmesh shape, by drawing a shape around the base of the tree (as close as possible so that players can't walk throught it but can still walk very close, for example to roleplay 'hiding behind a tree' and also to make it easy for monsters to find their way : the less unwalkable the better for them). Then what is inside that shape (below the tree) we will turn to unwalkable ground.
- Enable "Edged Faces" to the perspective view (right-click on the text "Perspective" in the perspective view, a grey menu appear with view display options : Smooth+Highlight, Wireframe, ... etc.) that will draw the edges of your model.
- Switch to "Modify" tab (left toolbox, the blue rainbow). If you selected a walkmesh, you will see AuroraWalkmesh and EditableMesh in the list there. Select EditableMesh : actions appear below. A first box is to select pieces of the mesh (vertices, edges, faces, shapes...), "Edit Geometry" to modify the selection, and "Surface Properties" to modify the type of ground.
- Select "Edge", then "Cut" (in edit geometry), and draw lines in your mesh : click the mouse on one existing edge, then to anywhere you want, this draws a new edge, click a new point, it draws a second edge, etc. when you have all edges you want (you came back to the original point, or on one of the edges you created so that you have a closed shape around your tree), right click to stop drawing.
- Select "Polygon", and click in your newly created surface (hide the tree trunk first to make it easier), go to "Surface properties", in "Material ID" enter the magic 7 (that's NWN code for Non-Walkable, here is the [list]).
- Unhide all, export, and test (don't forget the WOK file which hold the walkmesh infos).
- Tada ! it "should" work :)
Theory is that you could use the same process to copy any kind of element from one tile to another. It's very important when copying tiles TO the forest set since you will want to add some vegetation, but that could be used also to copy some painting/carpet from one room to another, move some rocks around, create new versions of some existing tile, etc.
Other points to consider :
- the surface type (7 for non-walkable, 3 for grass, etc.) will tell the game which footstep sound to make when you walk on it (splashes on water for example), so you might have to change some polygons Material ID (for example if you want to place the Duergar Building entrance to the rural set, you should change the brown dirt ID=1 to some grass ID=3). You can multiselect polygons with ctrl (shift doesn't !). You can hide elements to check whether you have all polygons changed, I know no way to automatically change all polygons with dirt to grass.
[edit] Add a new tile to a set
[edit] Copy tiles from a tileset to another
[edit] Add a loadscreen to a tileset
[edit] Add a custom door to a tileset
[edit] Fixing footstep sounds & effects
Has to do with the type of material assigned to polygons in the walkmesh of the tile.
[edit] Enabling/Disabling Fade effect
Has something to do with adding some trimesh option to the choosen shapes.
[edit] Enabling/Disabling Grass growing on tile
In .set file, but also with the type of material assigned to polygons in the walkmesh of the tile.
[edit] Fixing disappearing leg below water surface
Water surfaces has to be assigned to the A-dummy (animation).
[edit] Adding/Changing light sources of a tile
has something to do with adding tilenameml1, ml2, sl1, and sl2 to a tile (ml for main light = ambient, sl for source light = torches).
[edit] Modifying the palette
I never understood why Bioware made a difference between features and groups (features are groups of 1x1 only ?), and why they mixed terrains and crossers. While the number of elements per bioware tileset is low enough to work fine with the palette they provide, as soon as you start adding all kind of add-ons you find on NWVault you end up with very long list of terrains and groups.
The palette file of a tileset txxnn is called txxnnpalstd.itp. It's a tree structure containing branches/categories ('Terrains', 'Groups') and leaf elements ('Big Tree', 'Wall', ...). You can redesign the palette to have any number of sub-branches (well 3 levels works fine). Just grab an ITP editor (since ITP is a kind of GFF files, you can also use GFF editors).
What you have to know :
- The branch names MUST be a TLK entry (*curses bioware loudly*).
- The leaf names can be TLK entries or non-internationnalized names.
- The palette is ONLY useful to builders, it's never read by a running module. So in theory each builder could create it's own palette, and place it in their override (for some reason, my toolset doesn't read what is in my override, snif).
A branch element has the following attributes :
- STRREF (type UINT32 - unsigned 32bit integer) value being the TLK entry number. It defines the label which will appear in the toolset.
- LIST (type LIST) which act as a container holding all entries (leaves or branches) under that branch
A leaf element has the following attributes :
- STRREF (type UINT32 - unsigned 32bit integer) value being the TLK entry number. It defines the label which will appear in the toolset. This one is optionnal and can be replaced with NAME.
- NAME (type STRING) the label that will appear in the toolset. If both STRREF and NAME are provider STRREF wins.
- RESREF (type RESREF), for terrain, the terrain name given in the .set file, for groups, the model of one of the tiles in the group. Note that this tile must only be used by ONE group. A tile can be used by more than one group as long as it is not this tile you use in the palette.
Both branch and leaves can have the attribute DELETE_ME (type STRING) which can be used for comments. I highly suggest that you place it under every entry that uses TLK entries (STRREF) it makes it much easier for others (or for you when you can back to edit your palette later) to understand what is what.
Category names must be in TLK file. Either bioware, or a custom file. You can use NWNViewer to see the content of dialog.tlk (in your nwn main directory) or in custom tlk (cep.tlk in tlk/ sub-directory). You can search by text (give me all strings which containt 'Forest' : useful to look whether you can pick bioware entries for your branch name) or by number (what is the text for '63390' : useful for reading an existing palette, and find out what is what, since bioware palette do not use comments - DELETE_ME entries). You can create a custom tlk for your palette needs (I am creating a TLK file for Tileset Palette needs - Tileset Palette Helper - soon on the vault). Pay attention that when reading a custom TLK the number that appear are not exaclty the number to use. A custom entry number 0, must be referenced in palette files as 16777216, number 1 is 16777217, and so on (simply add 16777216). That's to make a difference between bioware entries (below 16777216) and user tlk (above that limit). You can use the TLKEditor on the vault, it has an option to toggle display between tlk number and number to use in palette, so that you don't have to add by hand :).
Palette categories MUST be in TLK, but palette leaves CAN be in too. But be aware that you can have only ONE custom TLK used per module, so if you want to create custom entries for your palette, use the CEP and PRC, you will have to create a merged TLK : MyTLK + CEP + PRC. I would suggest instead that you create one palette file per language (for example : txxnnpalstd-fr.itp, the default english palette would be called txxnnpalstd.itp as expected by bioware). A builder who wants a French palette, would simply extract the txxnnpalstd-fr.itp, rename it txxnnpalstd.itp and place it in override directory.
TLK are internationnalized in the way that you can copy the file, keep the numbers and translate the texts (so you would have mytlk-en.tlk, mytlk-fr.tlk, mytlk-de.tlk, etc.). Simply use the right tlk file in your module (Module Properties > Custom Content) to have the palette categories in the right language.
