当前位置:网站首页>Unity technical manual - preliminary performance optimization
Unity technical manual - preliminary performance optimization
2022-06-30 19:22:00 【Hua Weiyun】
About author
as everyone knows , Life is a long process , Constantly overcome difficulties , Constantly reflect on the process of progress . In this process, there will be a lot of questions and thoughts about life , So I decided to put my thinking , Share all your experiences and stories , To find resonance !!!
Focus on Android/Unity And various game development skills , And all kinds of resource sharing ( Website 、 Tools 、 material 、 Source code 、 Games etc. )
Welcome to the official account 【 Mr. Kong Ming 】 Get more resources and communication !
Premise
This is what Xiao Kong insisted on writing Unity Novice series , Welcome to taste .
Xiao Kong, for the convenience of more people ( Novice ) See through , Chinese characters used , Try to use English rules for real projects .
Novice (√√√)
bosses (√)
The particle section is a series of articles , And the introduction was very detailed , Suggest Collection .
Practice process
Why can cross platform ? Why is the package released so big ?
because Unity Built in Mono virtual machine , The reason why she can cross platform is because you wrote Unity The procedure is in Mono Running on a virtual machine . Virtual machines are cross platform . While being convenient, it will also increase resources , This may lead to subsequent worries about the operation card .
for instance : If you don't wear clothes , Do you just stay at home and don't go out ? At this time, you weigh so little , But you suddenly put on your clothes , At this time, you can go to any place outside , Correspondingly, you gained a little weight when you weighed .
Xiaozhi : What is? Draw call?
She is CPU The call of graphic drawing interface ,CPU By calling the graphics library (DirectX、OpenGL) Interface , command GPU Render , therefore Drawcall The greater the number of times, the greater the performance consumption .
So what is the reason for the consumption ?
In this era of parallelism ,CPU and GPU It is also an independent and independent parallel work , Maintain a queue through a buffer ,CPU Give orders ,GPU Carry out orders . The difference lies in :
CPU Calling DrawCall front , It takes a series of physical labor to prepare .
GPU Her own computing ability is her strong point ( Artificial intelligence training is widely used GPU The calculation verifies this point )- So the rendering task is completed very quickly .
It's like printing with a printer , You need to prepare the contents to be printed in advance ( This is time-consuming ), Then just send the pages to be printed to the printer , The printer will handle the printing itself .CPU Just as you prepare the printed content DrawCall The content of , then CPU Will be ready to draw “ page ” Pass to GPU
So it will cause a strange phenomenon :
GPU: come quick , come quick , I'm too busy , I also want , I'm ready to absorb , Let it go .
CPU: no way , no way , I'm so tired , Too much work , A little empty .
Xiaozhi : How to optimize the ?
Now that we know it is CPU under pressure , And what causes stress is DrawCall On the preparation of , So the starting point of optimization is to reduce DrawCall.
Will be made of the same material , Same map , Same as shader Try to merge the meshes of
Avoid using a large number of small meshes , if necessary , Consider merging
Avoid using too many materials , Try to share
Consolidation is also a cost , Try not to merge at run time
Mesh merge vertices have an upper bound
Xiaozhi : Elder brother , I know everything , But the key is how to operate , How about something practical .
Xiaozhi : Is this really the case ?
Xiaokong : Otherwise it is , Reduce DrawCall It's a more general statement .
Xiaozhi : Then you farted for a long time .
Xiaokong : Although lower DrawCall It works , but drawcall It's not unity A direct measure of efficiency is actually ,drawcall Of itself call The process consumption is relatively low , The high cost is drawcall The change process of the object set and the processing process of each object in the set , such as dynamicbatch and staticbatch identical drawcall The performance varies greatly .
stay Unity The statistics box of has a 【SetPass calls】 Of , It is more accurate to use this to measure performance .
author : Xiaokong and Xiaozhi Xiaokong
Reprint note - Be sure to indicate the source : sesame seeds My personal homepage - special column - Nuggets (juejin.cn)
This Taoist friend, please stay ️, I think you have great bearing , There is a king's domineering spirit in his speech , There will be a great achievement in the future !!! There's a little like collection next to it. It's passed to you today , Have you ordered it , Your success in the future ️, I don't take a penny , If it doesn't work ️, Or come back to me .
边栏推荐
- Introduction to Po mode "suggestions collection"
- 小球大小随机,随机运动碰撞
- 20220528【聊聊假芯片】贪便宜往往吃大亏,盘点下那些假的内存卡和固态硬盘
- Swin-transformer --relative positional Bias
- torch stack() meshgrid()
- Influence and requirements of different manufacturing processes on the pad on PCB
- Development: how to install offline MySQL in Linux system?
- mysql修改数据类型_MySQL修改字段类型[通俗易懂]
- Develop those things: how to add text watermarks to videos?
- 「经验」爬虫在工作中的实战应用『理论篇』
猜你喜欢

不同制造工艺对PCB上的焊盘的影响和要求

Nodejs installation and introduction

《所谓情商高,就是会说话》读书笔记

Opencv data type code table dtype

熵-条件熵-联合熵-互信息-交叉熵

Swin-transformer --relative positional Bias

Opengauss database source code analysis series articles -- detailed explanation of dense equivalent query technology (Part 1)

Video content production and consumption innovation

Nodejs 安装与介绍

云上“视界” 创新无限 | 2022阿里云直播峰会正式上线
随机推荐
如何利用 xUnit 框架对测试用例进行维护?
Four tips tell you how to use SMS to promote business sales?
嵌入式软件开发新趋势:DevOps
商业智能BI与业务管理决策思维之四:业务成本分析
Lenovo Yoga 27 2022, full upgrade of super configuration
Memory Limit Exceeded
拓維信息使用 Rainbond 的雲原生落地實踐
云上“视界” 创新无限 | 2022阿里云直播峰会正式上线
链表中环的入口结点-链表专题
rust配置国内源
浏览器窗口切换激活事件 visibilitychange
「杂谈」如何改善数据分析工作中的三大被动局面
Construction and practice of full stack code test coverage and use case discovery system
How does rust implement dependency injection?
视频内容生产与消费创新
法国A+ 法国VOC标签最高环保级别
Influence and requirements of different manufacturing processes on the pad on PCB
VMware16安装Win11虚拟机(最全步骤+踩坑)
German agbb VOC hazardous substances test
年复一年,为什么打破数据孤岛还是企业发展的首要任务