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 understand the Draw Calls of the game

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "how to understand the Draw Calls of the game". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to understand the Draw Calls of the game".

What is Draw Calls?

Draw Call is just an instruction. The Draw Call command is passed from CPU to GPU to render a mesh. The command only points to a rendered mesh and does not contain any material information. Rendering is doing a huge number of small tasks, such as calculating thousands of vertices and drawing millions of pixels on the screen. Each mesh with a different material requires a separate Draw call.

Then we use the tools that come with unity itself to implement it.

First create a new project and import four pictures. And convert it into a Sprite wizard.

Add four pictures to the scene, properly layout, run the scene, and open the Stats of the Game window. At this time, the Batches is 6, which is 6 due to the existence of Main Camera, directional light and four Sprite.

In the top menu bar Window-Sprite Packer, click Open, because the higher version of Unity has disabled this feature (it seems to be replaced by Sprite Altas), set it up and use Sprite Packer this feature.

Set to always Enabled

Select four Sprite and set their Packing Tag to myTextures (random name) so that they can be packaged together later.

After enabling the Sprite Packer function, once again at the top of the menu bar Window-Sprite Packer, click Open, click pack, and you can package the four pictures together.

Run the scene again, the game objects in the scene are still the same as the previous 6, but the Batches has become 3, as shown in the following figure, because Sprite Packer packages the four Sprite images together. If more Sprite is packaged, the performance optimization effect will be more obvious.

Thank you for your reading, the above is the content of "how to understand the Draw Calls of the game". After the study of this article, I believe you have a deeper understanding of how to understand the Draw Calls of the game, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Development

Wechat

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

12
Report