Specular, Ambient and Normal Maps in TW3 - The Beginner's Guide.
This is not in any way an official guideline - it was created through experimentation. And it's from the original modkit, not the one released in October 2015. So if there's something incorrect just say so and I'll edit the post.
I'm sure most of the experienced modders already know this, but I had to spend a lot of trial and error working out exactly HOW the maps all worked together, so I thought I may as well share.
Specular Map - s01 - usually 1024x1024, RGB with no alpha channel. This is ADDITIVE to the diffuse map.
Influenced by:
- Ambient Map (see below)
- Alpha Channel in the Normal Map (varies the amount of specularity based on height.)
- The values in the mesh XML file for SpecularColor for the material concerned. (Probably other stuff too, but this is all I looked at)
The specular colour you will see on the final version can be calculated by ADDING the number from the diffuse, specular map and SpecularColor from the XML
So if diffuse is 17,2,0, the specular map is 48.42.42 and the SpecularColor value is 47,44,40 the final specular value will be 112,88,82.
The deeply-shaded occluded colour you will see on the final version can be calculated by adding the diffuse and specular map values, and then SUBTRACTING the SpecularColor value, so on the same example, it would be 18, 0, 2
Tiny changes in the numbers make a big difference.
So:
If you want the shine and the shadow BOTH to be the same colour as the original:
- Specular Map should be of a similar colour to the diffuse. (so if the diffuse is reddish, the specular map should also be reddish)
- The ratio between R, G and B should be similar on the Specular Map and on SpecularColor in the XML.
- The values for R, G and B on SpecularColor should all be HIGHER than they are in the Specular Map
If you want the shine and the shadow to be DIFFERENT colours to the original:
- A colour shift in SpecularColor (XML) will INCREASE that colour in the specular, but DECREASE it in shade.
- A colour shift in the Specular Map will INCREASE that colour in both specular and shade.
If you want to see the effect in Photoshop, you can see it by adding layers for the specular map and for SpecularColor on top of the Diffuse. Set the Specular Map layer to Linear Dodge and SpecularColor to either LinearDodge or Difference.
Ambient Map - a01 - usually 2048x2048, RGB with no alpha channel. Red uses the full greyscale, Green is always 0, Blue is usually either 0 or 255 but may be greyscale.
I'm not 100% sure on this, but from testing:
- Blue impacts on the specularity and shade that comes from texture "grain" in the normal maps. It determines the blend between two DetailNormal maps (see the XML file). If there's no blue, Normal2 is used. If blue is 255, Normal1 is used. Values between this blend the two maps (I think). If the material only has one DetailNormal map, then setting the value to 0 will give you a smooth surface with no detail.
As well as being used for blending, this is used where a material needs two different textures, for example a cloth fabric jacket with a leather trim, or the striped jackets where the fabric weave is different.
- Red is used to indicate the amount of shadow/occlusion. Unless you're modifying normal maps, you probably won't want to touch this.
- Green doesn't do anything.
The Normal Map is RGBA, usually 2048x2048. The only part I'm covering here is the alpha channel.
Dark pixels in the alpha channel result in increased specularity, so this is presumably SUBTRACTED from the other specularity information.
The alpha in the Normal Map is NOT apparently used for height information, so as long as you stay clear of the RGB channels, you shouldn't mess anything up.
Problem with Normal Maps, specularity and wcc_lite
From personal experience only. YMMV. I've had the problem using all three main Normal Map image formats (TGA, DDS and PNG). The workround is tested only with TGA. This is an "amateur solution", I'm sure there are better ways of dealing with it, but it worked for me
Problem: If you re-import a normal map into a mod, even if you haven't changed anything on it, the specular goes crazy - very bright specular patches even in places where it should be minimal.
Workround:
Edit the alpha channel in the normal map to filter out very high and very low values. In Photoshop, I used levels to do it, with output values in the range 100 - 220, but you'll need to play around with it. The important thing is to make it a LOT paler without losing too much data.
If there are areas on the map that must be very bright, in theory you should be able to mask them out first, but I found that if there were any dark pixels at all, it imported incorrectly.
You'll probably need to play around with the specular map and the XML parameters to fix whatever is now too dull.
If the model you're working on doesn't have a specular map, you can create one and add it to get more control over the detail. Adding one does mean more edits on the XML parameters though - use another XML file as your guideline for what parameters need to be set. (you may also need to use a different pbr file as base, so watch for that.)
EDIT: THIS MAY HAVE BEEN FIXED IN THE MODKIT UPDATE - PLEASE POST IF YOU HAVE NEWER INFO
This is not in any way an official guideline - it was created through experimentation. And it's from the original modkit, not the one released in October 2015. So if there's something incorrect just say so and I'll edit the post.
I'm sure most of the experienced modders already know this, but I had to spend a lot of trial and error working out exactly HOW the maps all worked together, so I thought I may as well share.
Specular Map - s01 - usually 1024x1024, RGB with no alpha channel. This is ADDITIVE to the diffuse map.
Influenced by:
- Ambient Map (see below)
- Alpha Channel in the Normal Map (varies the amount of specularity based on height.)
- The values in the mesh XML file for SpecularColor for the material concerned. (Probably other stuff too, but this is all I looked at)
The specular colour you will see on the final version can be calculated by ADDING the number from the diffuse, specular map and SpecularColor from the XML
So if diffuse is 17,2,0, the specular map is 48.42.42 and the SpecularColor value is 47,44,40 the final specular value will be 112,88,82.
The deeply-shaded occluded colour you will see on the final version can be calculated by adding the diffuse and specular map values, and then SUBTRACTING the SpecularColor value, so on the same example, it would be 18, 0, 2
Tiny changes in the numbers make a big difference.
So:
If you want the shine and the shadow BOTH to be the same colour as the original:
- Specular Map should be of a similar colour to the diffuse. (so if the diffuse is reddish, the specular map should also be reddish)
- The ratio between R, G and B should be similar on the Specular Map and on SpecularColor in the XML.
- The values for R, G and B on SpecularColor should all be HIGHER than they are in the Specular Map
If you want the shine and the shadow to be DIFFERENT colours to the original:
- A colour shift in SpecularColor (XML) will INCREASE that colour in the specular, but DECREASE it in shade.
- A colour shift in the Specular Map will INCREASE that colour in both specular and shade.
If you want to see the effect in Photoshop, you can see it by adding layers for the specular map and for SpecularColor on top of the Diffuse. Set the Specular Map layer to Linear Dodge and SpecularColor to either LinearDodge or Difference.
Ambient Map - a01 - usually 2048x2048, RGB with no alpha channel. Red uses the full greyscale, Green is always 0, Blue is usually either 0 or 255 but may be greyscale.
I'm not 100% sure on this, but from testing:
- Blue impacts on the specularity and shade that comes from texture "grain" in the normal maps. It determines the blend between two DetailNormal maps (see the XML file). If there's no blue, Normal2 is used. If blue is 255, Normal1 is used. Values between this blend the two maps (I think). If the material only has one DetailNormal map, then setting the value to 0 will give you a smooth surface with no detail.
As well as being used for blending, this is used where a material needs two different textures, for example a cloth fabric jacket with a leather trim, or the striped jackets where the fabric weave is different.
- Red is used to indicate the amount of shadow/occlusion. Unless you're modifying normal maps, you probably won't want to touch this.
- Green doesn't do anything.
The Normal Map is RGBA, usually 2048x2048. The only part I'm covering here is the alpha channel.
Dark pixels in the alpha channel result in increased specularity, so this is presumably SUBTRACTED from the other specularity information.
The alpha in the Normal Map is NOT apparently used for height information, so as long as you stay clear of the RGB channels, you shouldn't mess anything up.
Problem with Normal Maps, specularity and wcc_lite
From personal experience only. YMMV. I've had the problem using all three main Normal Map image formats (TGA, DDS and PNG). The workround is tested only with TGA. This is an "amateur solution", I'm sure there are better ways of dealing with it, but it worked for me
Problem: If you re-import a normal map into a mod, even if you haven't changed anything on it, the specular goes crazy - very bright specular patches even in places where it should be minimal.
Workround:
Edit the alpha channel in the normal map to filter out very high and very low values. In Photoshop, I used levels to do it, with output values in the range 100 - 220, but you'll need to play around with it. The important thing is to make it a LOT paler without losing too much data.
If there are areas on the map that must be very bright, in theory you should be able to mask them out first, but I found that if there were any dark pixels at all, it imported incorrectly.
You'll probably need to play around with the specular map and the XML parameters to fix whatever is now too dull.
If the model you're working on doesn't have a specular map, you can create one and add it to get more control over the detail. Adding one does mean more edits on the XML parameters though - use another XML file as your guideline for what parameters need to be set. (you may also need to use a different pbr file as base, so watch for that.)
EDIT: THIS MAY HAVE BEEN FIXED IN THE MODKIT UPDATE - PLEASE POST IF YOU HAVE NEWER INFO
Last edited: