Saturday, November 14, 2020

Adding a tintmap to an object

One thing I missed in my tutorial on importing an object into NWN2 is how to add a tintmap and/or normal map.

Since it was requested to be able to make the White Tower from https://neverwintervault.org/project/nwn2/hakpak/original-hakpak/white-tower-nwn2 tintable, I am going to be using that as my example. The download itself comes as a .hak file, so I have NWN2Packer to used unpack the hak into the component files. You can get it from https://neverwintervault.org/project/nwn2/other/tool/nwn2packer-v19

This tutorial assumes you already have either Gmax or Blender installed with the plugins for nwn2 files, see part 1 of my post on importing models here for information on that: http://kamalpoe.blogspot.com/2019/09/nwn2-importing-3d-model-into-game-part-1.html  I prefer gmax, but Blender is more powerful, still supported, and generally much more advanced, so if you are new to all this that's the way to go. While this tutorial shows Gmax, Blender is able to do everything shown here (and more).


Here, I've opened PLC_BC_WTBASE1.MDB in gmax, and opened up the Material Navigator (the button under the mouse icon), you can see the Material Navigator window at bottom left.


There are a number of parts that make up each model ingame, you can see the tutorial on importing for an explanation of them. Since I don't need to work with the collision boxes and walkmesh, I am going to hide them to make it easier to select the pieces of this model, via selecting them, then right-clicking and selecting the "Hide Selection" option


As you can see from the Material Navigator, this model has a lot of parts, and each part has it's own Diffuse and Bump textures, and one has a Self-Illumination texture as well. The Diffuse texture is the basic texture of the model, the Bump is also called the normal map, and provides simulated detail into the model without needing to make a more complicated model. Self-Illumination is glowing parts. Each of these parts will need to have a tintmap applied to it.

By double clicking on the part, I have opened the Material Editor, which allows me to specify the textures used for each piece of the model (as well as some more advanced things like glossiness and inbuilt coloring that are not part of this tutorial, but are shown in the default Material Editor window). Click the Maps option in the Material Editor to open up the actual texture list. 


We've got the list of textures the part uses open. There are a lot of options, but NWN2 can only use four of them. The Diffuse (our basic texture), the Self Illumination (glow), Filter Color (the Tintmap!), and Bump (the normal map). Technically only the Diffuse is needed. If a box is unchecked it will not be used even if there is a texture specified.

 

Click on "None" in the Filter row of the Map column, and the Material Navigator window will open. 


Then select Bitmap, and click the Open button.



A quick word on naming conventions. Here are the texture files for the columns and railings. As you can see the normal map filename is the same basic name but ends with _n and the tintmap ends with _t. While not technically necessary, this is the naming scheme used by the stock game, and it makes it much easier to work with the textures for an object when they are all named according to convention. The easiest way to make the tintmap files is just to make a copy of the basic file, such as PLC_BC_WTCOLUMN, and then give it the _t suffix. If there's a lot a batch renaming program like Renamer (https://www.den4b.com/products/renamer) can do the work for you. Once you have the tintmaps, in Paint or whatever graphics program you prefer, set the coloration to some combination of red, green, and blue. I've used solid colors here but you can blend and mix. These colors determine which tint colors get used in the game as color 1-3 respectively. I just randomly did solid red, green, blue for this tutorial. 


Find the tintmap you want, and select Open. It will be applied to the object when you do this.

The texture we picked will now be listed in the main Material Navigator window. We did it!


Repeat this for every part of the object that has texture files on it. In this case that's a lot of parts, but many objects are simpler and will use only a single texture. You can open the texture options for each piece of the model by double-clicking on it in the Material Navigator. Not that the Self Illumination is much stronger than the tint, so if you tint something like a glowing window, the glowing part is much stronger and the tinting hardly visible ingame. You can of course edit the Self Illumination texture to what you want if needed.



When you're done, export it via File-> Export to wherever you are saving things. Save it as the same filename as what you imported. For this example that was PLC_BC_WTBASE1. Put the model file and the textures somewhere your module can see them such as the campaign folder or hak.



Now try it out ingame and see if you can tint it. Yeah, it's ingame!


Ok, so those are some ugly colors, but they are highly visible for this example.
















No comments:

Post a Comment