Min's http://www.klayge.org/2012/09/21/%E5%8E%8B%E7%BC%A9tangent-frame/
This was done in and, and the problem of UV mirror was solved by storing handedness with tangent. W.
I didn't expect that we still had such deep knowledge about vertex data compression, So we modified the max plug-in according to the data, and the effect was far beyond our imagination.
Currently, unsigned char x 4 is used to store normal, tangent, and short x 2 to store texcoord.
Previously, it was normal = float x 3, tangent = float x 4, texcoord = float x 2 (also see several layers of UV), a total of 12 + 16 + 8 = 36
After compression, it becomes normal = unsigned char x 4, tangent = unsigned char x 4, texcoord = short X 2, which is 4 + 4 + 4 = 12
Each vertex is reduced from 36 bytes to 12 bytes, more than half. By observing a 20000-faceted model, the mesh size is reduced from 1388kb to 552kb, Which is 0.39 times the original size after compression.
Tangent frame is not compressed to 8 bytes as described in this article.
The advantage is that the amount of data is greatly reduced, so that the vertex cache hit rate will increase, and it is observed that the FPS has increased by about 5%.
The disadvantage is that the calculation amount in vs is slightly increased, and compression causes loss of precision.
Float F = 0.1234567f ;
Unsigned Char UC = (unsigned Char ) (F * 0.5f + 0.5f )* 255 );
Short S = ( Short ) (F * 0.5f + 0.5f )* 32767.0f );
FloatUnpackuc = UC *2.0f/255.0f-1.0f;
FloatUnpacks = S *2.0f/32767.0f-1.0f;
Unpackuc =0.12156863
Unpacks =0.12344737
References:
Http://www.humus.name/Articles/Persson_CreatingVastGameWorlds.pdf
Http://www.crytek.com/download/izfrey_siggraph2011.pdf
Http://fabiensanglard.net/dEngine/index.php
http://oddeffects.blogspot.com/