Forged Alliance Forever Forged Alliance Forever Forums 2016-08-16T18:48:33+02:00 /feed.php?f=41&t=12918 2016-08-16T18:48:33+02:00 2016-08-16T18:48:33+02:00 /viewtopic.php?t=12918&p=132922#p132922 <![CDATA[Re: Normal Map Texture Compression]]>
Thanks for the link cuddles, I did run into that couple weeks ago, interesting that jon mavor responded.

Thanks for the help guys! Much appreciated.

Statistics: Posted by Mortifero — 16 Aug 2016, 18:48


]]>
2016-08-16T14:17:35+02:00 2016-08-16T14:17:35+02:00 /viewtopic.php?t=12918&p=132903#p132903 <![CDATA[Re: Normal Map Texture Compression]]> http://www.adriancourreges.com/blog/201 ... ics-study/

Statistics: Posted by Cuddles — 16 Aug 2016, 14:17


]]>
2016-08-16T10:22:19+02:00 2016-08-16T10:22:19+02:00 /viewtopic.php?t=12918&p=132887#p132887 <![CDATA[Re: Normal Map Texture Compression]]>
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:
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

Statistics: Posted by ozonex — 16 Aug 2016, 10:22


]]>
2016-08-13T12:25:00+02:00 2016-08-13T12:25:00+02:00 /viewtopic.php?t=12918&p=132754#p132754 <![CDATA[Re: Normal Map Texture Compression]]> I finally figured it all out. It was simple, but completely unobvious. GPG said that they used specificaly DXT5 compression for their normal maps. That bothered me for two days, as dxt5 compression is horrible for normal maps, thats why DXT5nm(normalmap) compression was invented. And i thought that was it xD. It wasnt. GPG really did use plain DXT5 compression. As i explained earlier, i figured that the red channel goes to the alpha channel, the blue is ingored by the engine and the green channel stays as is. Thats where all the confusion came from. I was not using photoshop and was trying to do everything in gimp. But photoshop displays the color channels differently. There is a RGB "channel" and you are supposed to copy the green channel to the RGB. What this does is copy the green channel to all other channels except the alpha one. This step here is what is completely unobvious for no photoshop users. This is what makes the normal map appear "grayscale. Then using either the nvidia photoshop .dds plugin export as DXT5(not DXT5nm).

So by doing all this we did the color channel swizzling that the DXT5nm compression method is supposed to do, but for me export a proper normal map as dxt5nm just didnt work ever in any program i used.




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.

I havent tested this yet in game but i am fairly certain that it works.

Note:
Some people in all kinds of forums(not supcom specific) that they painted the red and blue layers(channels) with black(thus possibly reducing texture size) but that didnt work for me at all, it gave a messed up normal map that wasnt grayscale and i dont think it would work with supcom, but feel free to try it anyways. All that in gimp, didnt do any of the above in photoshop.

Statistics: Posted by Mortifero — 13 Aug 2016, 12:25


]]>
2016-08-13T01:49:03+02:00 2016-08-13T01:49:03+02:00 /viewtopic.php?t=12918&p=132732#p132732 <![CDATA[Re: Normal Map Texture Compression]]>

You can view the hlsl for the pixel shaders used to render it.. That could help u work it out?

Statistics: Posted by nine2 — 13 Aug 2016, 01:49


]]>
2016-08-12T19:10:24+02:00 2016-08-12T19:10:24+02:00 /viewtopic.php?t=12918&p=132719#p132719 <![CDATA[Normal Map Texture Compression]]>
Note:
i havent tried importing to the game any textures yet, so the dxt5nm normal maps from the gimp .dds addon may work, although i dought it.

Statistics: Posted by Mortifero — 12 Aug 2016, 19:10


]]>