In Unity3d, why should we use Sprite Atlas?

Taking NGUI as an example, Sprite Atlas is a large image containing multiple small images, which are called sprites. By using Sprite Atlas, you can combine multiple small images into one large image. Since during rendering, each call requires vertex conversion, texture sampling and other operations, and by sharing the same texture with multiple sprites, Unity can reduce the number of texture switches, thereby reducing the number of DrawCalls and memory usage , thereby improving the game performance and efficiency purposes.

In NGUI, creating a Sprite Atlas is very simple, you can use the built-in atlas maker tool or use a third-party tool to create an atlas. Once you create an atlas, you can include multiple sprites in it and use these sprites in your game to render UI elements.

Another important advantage of using atlas is that related UI elements can be placed in the same atlas for easier management and maintenance. For example, the icons of all game characters can be placed in the same atlas to facilitate unified management and replacement.

Creation of atlas:

Packaged Atlas:

It can be seen that atlas is essentially a picture. When we select the image material, the original Texture data structure request is turned into a relatively simple x, y coordinate request. From this, atlas can be seen as a way to compress and organize image data, making image access and transmission more efficient.

Use atlas:

Guess you like

Origin blog.csdn.net/qingxiu3733/article/details/131877706