Mortifero wrote:Now for gimp users the process is dead simple to achieve the above: After creating your "normal" purple(ish) normal map,
Goto Color->Components->Decompose, click then select RGBA! instead of RGB. After that, all color channels should appear as grayscale layers. So select red layer ctrl+A and ctrl + C then select the alpha layer and paste it with ctrl+V. Now select the green layer and copy paste it on the red layer as well as the blue layer. Then goto color->components->compose, choose RGBA! and with the gimp .dds plugin export it as DXT5.
Process in Photoshop looks almost the same, but there is no need to "Decompose", because in Photoshop all channels are always accessible.
When I was working on Map Editor and I waited code for reading dds files from FA, I found out that not all normal maps use DXT5 compression. Sometimes is BGRA32, and I also found one with RGB24. All data about how it will be converted to RGBA is written in DDS Header so I'm not sure if changing compression method will swap channels.
For some engines only Red and Alpha channels are used, so if engine reads normalmap directly, then they can clean G and B channels.
Maybe this can be usefull. Here is code where I gets loaded DDS textures RGBA pixels and convert it to Unity's Normal Map. Interesting is that only Red and Green channels are used. But maybe they are somehow swapped (when its RGBA instead of ARGB), then it will be Alpha and Red channel.
- Code: Select all
for(int i = 0; i < Pixels.Length; i++){
theColour.r = Pixels[i].r;
theColour.g = Pixels[i].g;
theColour.b = 1;
theColour.a = Pixels[i].g;
Pixels[i] = theColour;
}
Here is file with that code:
https://github.com/ozonexo3/FAForeverMapEditor/blob/master/Assets/Scripts/Ozone%20SCMAP%20Code/GetGamedataFile.cs