As alluded to previously, tint files hold a series of colours that are applied to a model in a manner that is defined by a tint mask. Each channel of the tint mask is used to define a specific area of the parent texture to apply the associated tint. While tint masks have 4 channels (RGB+A), it’s mostly only face textures and related things like hair and tattoos use all 4. Everything else tends just to use the RGB channels. As you would have seen, the metal armour tints extracted previously have a pair of colours, diffuse and specular, for each of the three tint mask channels (thus 6 colours in total). The diffuse is what actually colours the base texture, the specular is the “shininess” – the colour of highlights caused by light reflection. A specific type of armour generally shares a single model (well, one model per sex per race, not counting scaled LOD variants). There are usually 4 (occasionally 5) texture variants, and these are diversified further into actual item variations through the use of tints. As an example, I’ll use two texture variants of male medium armour (as with faces, armour models share a common UV map across races, although armour is split into male and female variants, aside from massive armour).
If you haven’t previously unpacked or browsed through the armour textures, you can find them in <install directory>\packages\core\textures\high\texturepack.erf. We’ll use variant A, pm_arm_meda_0d.dds, and variant D, pm_arm_medd_0d.dds. Notice the _0d suffix. This denotes the diffuse (colour) map at the highest, or 0, level of detail (LOD). You’ll see two other textures with the _0dl2 and _0dl3 suffixes. These are the second and third LOD diffuse textures, respectively. LOD0 is the highest resolution (in this case 1024x1024), LOD2 is a quarter of that size (512x512), and LOD3 is a quarter the size again (256x256). You don’t have to worry about this for our current purposes, but just be aware that any time you make physical changes to a diffuse map (or any other map with scaling LOD, like tints) that is going to override the default, you’ll want to make multiple LOD versions. You’ll see a number of associated textures with the same base filename as the diffuse maps. Those with the _0n suffix are the normal maps, those with _0s are the specular maps, and the ones we want, _0t, the tint masks. Extract the two diffuse maps and the two tint masks to a working directory and open them.
You’ll see that the diffuse maps are just bog standard colour textures, albeit a tad dull. The tint masks, at first impression, look to be horrible technicolour nightmares. Change to the channels tab however and you’ll see how they work. Think of each channel as a separate alpha mask. Black is 100% transparency, white is 100% opacity, and shades of grey denote values in between. If we lay out the channels of the tint mask as 3 separate images and compare them to the parent diffuse map, we get the following for the two texture variants:

If you look at the first image, variant A, you’ll see that the red channel of the tint mask is confined to areas of metal banding, the green channel to other metal areas like buckles and trim, and the blue channel to areas of leather. Variant D is a similar story, the red and green channels being confined to metal, the blue to leather. Because all three classes of metal armour (medium, heavy, massive) use a universal set of tints based on material type, if you look at the other metal armour tint masks you’ll see that this is the pattern that they all more or less conform to – the red channel is the primary metal area tint, the green channel the secondary metal area tint, the blue channel the leather/cloth/misc area tint (the “misc” mostly refers to the massive armours, which don’t have any leather or cloth and instead use the blue channel for decorative filigree patterns and the like).
Now that we know what each channel of the tint mask does, we can edit our tint file appropriately. As we did previously, load the tint file you want to edit into the material editor. I’ll use the dragonbone tint, T3_ARM_DRB.tnt, for this example. Now when I am working with tints, I only use the material editor to quickly experiment with colours. The whole “Post to Local” process is far too clunky for my tastes, and it can also lead to problems if you have the single player module open (which you have to do in order to be able to export tints in my experience). Instead, I edit the file directly in the GFF editor. You can do this in the toolset (by just going to File->Open and loading the TNT file) but I prefer to use the standalone GFF editor in the toolset directory, GffEditor.exe. You may find it handy to associate this program with all GFF file types so that you can quickly edit a particular file just by double clicking on it. With the TNT file open in the GFF editor, you’ll see something like this:

Although it’s confusing at first, you’ll see it’s conveying the same basic information as that in the material editor, just in a more concise (and less visually intuitive) format. The thing to note is that you have a series of numbers, each in what is known as a vector 4 array. For each set of 4 numbers, the first 3 are RGB values. Rather than the usual 0-255 value, the RGB is on a scale of 0 to 1 (i.e. a percentage). So, for instance, a V4 RGB value of 1,1,1 is the same as 255,255,255 (white). The 4th number in a V4 array is presumably an alpha value, but playing with it doesn’t seem to yield much in the way of results, so leave it at 1 which is what most tint files seem to use. However, to complicate matters, there’s also an “intensity” value for each colour that is on a scale of 0.1-10. In the material editor you’ll notice that original tint file had the intensity of diffuse tints set to 1 but had pretty high intensities of 5.22 and 3.8 for the Red and Green channel speculars respectively. There’s no row for intensity in the GFF editor though, so where are these values? Well if you go back and look at the specular values for the Red and Green channel, you’ll see the RGB values are all above 1. What it is doing is multiplying each of the RGB values (between 0 and 1) by the intensity value. So you can see the GFF editor shows the Red channel specular V4 is 3.06,3.78,5.22,1 but the material editor says the RGB is 0.59,0.72,1.00. If you multiply the RGB values by the intensity (5.22) you get the same as in the GFF editor (well more or less anyway). I assume it is deriving the 4 unknowns (RGB + intensity) with simultaneous equations, but I’m a biologist not a mathematician, so I’ll leave that discussion to someone else.
Getting back to the more general overview, you’ll see the file is laid out firstly with the diffuse values for the tint mask’s RGB channels, then the specular values for the RGB channels. Diffuse and specular for the tint mask’s Alpha channel is next, but as I said earlier this is not normally used, so in most cases both diffuse and specular will be set to 1,1,1,1. Finally, you have the opacity for both the diffuse and specular tints. Here the V4 is a set of opacity values for each channel of the tint mask, RGBA. This time it’s on a scale of 0 to 2. Generally though, most tints stick to values of 1 and below. As before, the Alpha channel isn’t always used, so in those cases it’s set to 0.
Now let’s look at the tint file in the material editor. We’ll use this to tweak the colours to our liking, then copy the values across to the file in the GFF editor. If you click on each colour you’ll get a button on the right that pops up a colour picker for easy tweaking. If you are using the dragonbone tint file from earlier, it will be using the colour values from the silverite or steel tints, which are bluish grey. I don’t know what colour dragonbone is supposed to be, but for this example I’ll change it to some brownish colours, as follows:

So now we have our set of colours. You’ll see next to the little colour square, the material editor gives you the RGB V4 values. We need to copy and paste these into the appropriate rows in the GFF editor, remembering to append a 1 to the end. So for example the Red channel value of 0.75,0.74,0.44 gets pasted as 0.75,0.74,0.44,1. If you try and paste just the 3 values, the editor will complain about it not being a proper V4 array. Based on our exploration of the tint masks earlier, we know that the Red and Green channels are for metal, so these get the boney colour we want along with a fairly bright colour for specular. Given that this is supposed to be bone and not metal, I probably should have used a darker colour instead which would give a flatter specular highlight, as opposed to the sharp, close to white, specular highly reflective materials like metal have. However the fact that the intensity value is being reduced to 1 (by just pasting the RGB values directly) should counteract this. The Blue channel gets a darkish brown with a dark specular, as that is for any leather and cloth. Save the TNT file and we are ready to test it in the game. Reusing the example scene from the original tint override:

OK, so not exactly the most thrilling tint in the world, but hopefully it demonstrates the principle. In particular, notice the reduction in the specular highlights between the two tints as a result of dropping the intensity. If you are trying to make a shiny metal then crank the intensity up, if making cloth, leather or some other flat, dull material (bone?) then crank it down. Adjust your specular colours to suit as well. The higher the intensity, the closer to white it should be.
An additional note for those that wish to only use the material editor. As I said, it seems to only want to export tints when in the single player module. You could try a module that extends the single player campaign as I haven’t done that, but it definitely doesn’t work in a standalone module. You have to save the material file (*.MATPROJ) somewhere, then you can do a Post to Local to export the TNT. I would strongly advise
not leaving the single player module set as the active module. You can potentially screw your game doing so – you have been warned.
Modifié par DarthParametric, 14 janvier 2010 - 10:02 .