Factors affecting performance in Unity

Original link: https://blog.csdn.net/Mq110m/article/details/130435557

Rendering optimization in Unity

Features of mobile platforms

Compared with PC platforms, the GPU architecture on mobile platforms is very different. Due to limitations in processing resources and other conditions, the GPU architecture on mobile devices focuses on using smaller bandwidth and functions as much as possible, which also brings about many phenomena that are completely different from those on the PC platform. For example, in order to remove as many hidden surfaces as possible and reduce overdraw (i.e. one pixel is drawn multiple times), the PowerVR chip (commonly used on iOS devices and some Android devices) uses tile-based deferred rendering (Tiled-based Deferred Rendering (TBDR) architecture, all rendered images are loaded into tiles, and then the hardware finds the visible fragments, and only these visible fragments will execute the fragment shader. Other tile-based GPU architectures, such as Adreno (Qualcomm chips) and Mali (ARM chips), will use Early-Z or similar technology to perform a low-precision depth detection to eliminate those tiles that do not need to be rendered. Yuan. There are also some GPUs, such as Tegra (Nvidia's chip), which use traditional architecture designs, so on these devices, overdraw is more likely to cause a performance bottleneck.

Factors affecting performance

First of all, before learning how to optimize, we need to understand the factors that affect game performance so that we can prescribe the right medicine. For a game, it mainly requires the use of two computing resources: CPU and GPU. They work together to make our game work at the expected frame rate and resolution. Among them, the CPU is mainly responsible for ensuring the frame rate , and the GPU is mainly responsible for some resolution-related processing . Based on this, we can divide the main causes of game performance bottlenecks into the following aspects. (1) Too many
CPU draw calls. Complex scripts or physics simulations. (2) GPU. Vertex handling ➢ Too many vertices ➢ Too many per-vertex calculations. Fragment processing ➢ Excessive fragment processing (may be caused by resolution or overdraw). ➢ Excessive fragment-by-fragment calculation (3) Bandwidth uses large and uncompressed textures. · Framebuffer with too high resolution.











(1) CPU optimization.
·Use batch processing technology to reduce the number of draw calls.
(2) GPU optimization.
1 Reduce the number of vertices that need to be processed.
➢ Optimize geometry.
➢ Use the LOD (Level of Detail) technology of the model.
➢ Use Occlusion Culling technology.
2 Reduce the number of fragments that need to be processed
➢ Control the drawing order.
➢ Be wary of transparent objects.
➢ Reduce real-time lighting.
3 Reduce computational complexity.
➢ Use Shader’s LOD (Level of Detail) technology.
➢ Code optimization.
(3) Save memory bandwidth. ·
Reduce texture size.
· Take advantage of resolution scaling

Rendering analysis tools in Unity

Insert image description here
Insert image description here

Insert image description here
Insert image description here
Open the performance analyzer
Insert image description here
to display various CPU and GPU running process status data.
Insert image description here
Frame debugging panel
Insert image description here
to view draw call information and related shader occupancy.
Insert image description here

Reduce the number of draw calls

Reduce the number of vertices that need to be processed

Reduce the number of fragments that need to be processed

Reduce bandwidth

Reduce computational complexity

Guess you like

Origin blog.csdn.net/weixin_45810196/article/details/130709778