Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the Compression of U3D Map format by Unity3D

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to achieve U3D mapping format compression by Unity3D. I hope you will get something after reading this article. Let's discuss it together.

Basic knowledge points:

The DXT format is provided by Nvidia Tegra, ETC is native to Android, and OPNEGL2.0 supports it. ETC2 is only supported by OPENGL3.0, PVRTC is provided by Imagination PowerVR and ATC is provided by Qualcomm Snapdragon. Generally speaking, IOS only supports the compressed format of PVRTC. Once the corresponding mapping format is not compatible, U3D automatically converts it to RGB (A) format. The best compatibility is for GPU packaging, for example, for Xiaomi are all in ATC format, but the general development can not do too detailed choice. All devices have good support for RGB 16BITS/ARGB 16BITS/RGB A16BITS/RGB 24BITS/ARGB 32BITS, etc., but these formats are uncompressed and very unfriendly to memory and rendering consumption.

With regard to the compressed storage size, assuming that the high definition (ARGB32) size is 1, the data is roughly as follows:

RGB PVRTC 4BITS:0.25

ARGB PVRTC 4BITS:0.25

RGB PVRTC 2BITS:0.13

ARGB PVRTC 2BITS:0.13

RGBA ETC2 4BITS:0.25

RGBA ETC2 8BITS:0.25

RGB + 1-bit ALPHA ETC2 8BITS:0.2

DXT1: 0.3

DXT5: 0.6

ARGB 16BITS:0.33

RGB 16BITS:0.5

RGB 24BITS:0.85

ARGB 32BITS:1

Of course, each is different according to the picture, the above is only general data, not accurate data.

Test method: the file changed to this format is typed into ASSETBUNDLE size separately.

The big questions about this are ARGB 16 and RGB 16. I feel that there may be BUG in U3D BUNDLE here.

For the size in memory, assuming that the ARGB32 size is 1, the approximate data is as follows:

RGB PVRTC 2BITS:0.0625

ARGB PVRTC 2BITS:0.0625

RGB PVRTC 4BITS:0.125

ARGB PVRTC 4BITS:0.125

RGBA ETC2 4BITS:0.125

RGBA ETC2 8BITS:0.25

RGB + 1-bit ALPHA ETC2 8BITS:0.125

DXT1: 0.125

DXT5: 0.25

ARGB 16BITS:0.5

RGB 16BITS:0.5

RGB 24BITS:0.8

ARGB 32BITS:1

The recommendations are as follows:

Generally speaking, when we compress the map in 3D games, we will divide the map into UI map and scene model map, mainly because of multi-sampling. Generally speaking, 3D games take different sampling sizes depending on the size of the camera. If there is no multi-texture sampling, there will be a lot of white noise in the distance.

2D games, all do not need to check multi-sampling, with 3D nature of the map, we all need to check the GENERATE MIP MAPS, which will increase the size of the map by 25%.

Square maps should also be distinguished from non-square maps. Non-square maps have only 16-bit compression (equivalent to halving true color), so it's best to have square maps in the game. The following are some rules for personal choice of map compression format, you can refer to it, if you have any questions, you can communicate together.

Square map:

Under IOS:

a. Normal opacity: RGB PVRTC 4BITS

b. Normal transparency: RGBA PVRTC 4BITS

Under Android:

a. Normal opacity: RGB ETC 4BITS

b. Normal transparency:

Since there is no universal and most compatible format, it is common to use RGBA 16BIT or targeted DXT5/ATC8 BITS/ETC2 8BITS. If there is technical support, you can use RGB ETC 4BITS plus an ALPHA 8 map to achieve transparency.

Non-square map:

Generally use 16-bit compression, 16-bit will bring color loss, but if the original art is painted by 16BITS, there will be no loss, many mobile games in Japan are painted by 16BITS. Such games are generally less gradual and more colorful, which is easier to see.

a. Opacity map: RGB 16BITS

d. Transparency maps: RGBA 16BITS

HD does not compress the map:

RGBA 32BIT

In addition:

For unimportant maps and low-ambiguity maps, it is recommended not only to compress pixels, but also to compress their size directly. Such as Lightmap pressing to 512 or 256. For example, the original picture of the background is pressed directly to 1024. It's fine if the player doesn't notice.

After reading this article, I believe you have a certain understanding of "how to achieve U3D mapping format compression in Unity3D". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report