Vertex Data Compression

Source: Internet
Author: User

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.