当前位置:网站首页>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 .
边栏推荐
猜你喜欢

Huaxing Securities: kitex practice under the original hybrid Cloud Architecture

链表中环的入口结点-链表专题

浏览器窗口切换激活事件 visibilitychange

opencv数据类型代码表 dtype
![[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform](/img/56/9f3370eac60df182971607aa642dc2.jpg)
[Collection - industry solutions] how to build a high-performance data acceleration and data editing platform

德国AgBB VoC有害物质测试

Personally test the size of flutter after packaging APK, quite satisfied

Cobbler is easy to use

联想YOGA 27 2022,超强配置全面升级

视频内容生产与消费创新
随机推荐
Go redis connection pool
mysql函数获取全路径
TCP粘包问题
Browser window switch activation event visibilitychange
Influence and requirements of different manufacturing processes on the pad on PCB
NBI visual platform quick start tutorial (V) introduction to editor functions and operations
MySQL download and installation tutorial
一套十万级TPS的IM综合消息系统的架构实践与思考
Evolution of screen display technology
Kalman filter -- Derivation from Gaussian fusion
Sqlserver SQL Server Management Studio and transact SQL create accounts and create read-only users to access the specified database
Is it safe to open an account for goucai? Is it reliable?
Unity技术手册-初探性能优化
一点比较有意思的模块
openGauss数据库源码解析系列文章—— 密态等值查询技术详解(上)
商业智能BI与业务管理决策思维之四:业务成本分析
Mipi protocol in RFFE
js 字符串截取方法汇总
Vs common shortcut key commands
年复一年,为什么打破数据孤岛还是企业发展的首要任务