Optimizing graphics performance 优化图形性能 性能系列1

Optimizing graphics performance 优化图形性能

本文档主要是对Unity官方手册的个人理解与总结(其实以翻译记录为主:>)
仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。
文章中涉及到的操作都是基于Unity2018.3版本
参考链接:https://docs.unity3d.com/Manual/OptimizingGraphicsPerformance.html

Good performance is critical to the success of many games. Below are some simple guidelines for maximizing the speed of your game’s rendering.
良好的性能是许多游戏成功的关键。下面是一些游戏渲染速度最大化的简单指南。

Locate high graphics impact
定位高级图形效果

The graphical parts of your game can primarily impact on two systems of the computer: the GPU and the CPU. The first rule of any optimization is to find where the performance problem is, because strategies for optimizing for GPU vs. CPU are quite different (and can even be opposite - for example, it’s quite common to make the GPU do more work while optimizing for CPU, and vice versa).
游戏的图形部分主要影响计算机的两个系统:GPU和CPU。任何优化的第一条守则就是找出性能问题所在,因为优化GPU和CPU的策略是完全不同的(甚至可能是相反的——例如,优化CPU时让GPU做更多的工作是很常见的,反之亦然)。

Common bottlenecks and ways to check for them:
常见的瓶颈和检查它们的方法:

  • GPU is often limited by fillrate or memory bandwidth.
    GPU经常受到填充率或内存带宽的限制。
    • Lower the display resolution and run the game. If a lower display resolution makes the game run faster, you may be limited by fillrate on the GPU.
      降低显示分辨率运行游戏。如果较低的显示分辨率使游戏运行得更快,您可能会受到GPU上填充率的限制。
  • CPU is often limited by the number of batches that need to be rendered.
    CPU通常受需要渲染的批处理数量的限制。
    • Check “batches” in the Rendering Statistics window. The more batches are being rendered, the higher the cost to the CPU.
      在渲染统计信息窗口中检查“batches”。渲染的批次越多,CPU的成本就越高。

Less-common bottlenecks:
不常见的瓶颈:

  • The GPU has too many vertices to process. The number of vertices that is acceptable to ensure good performance depends on the GPU and the complexity of vertex shaders. Generally speaking, aim for no more than 100,000 vertices on mobile. A PC manages well even with several million vertices, but it is still good practice to keep this number as low as possible through optimization.
    GPU有太多的顶点需要处理。为了保证良好的性能,可以接受的顶点数取决于GPU和顶点着色器的复杂性。一般来说,移动设备上的顶点不超过100,000个。即使有几百万个顶点,PC也能很好地管理,但是通过优化使这个数字尽可能低仍然是一个很好的做法。
  • The CPU has too many vertices to process. This could be in skinned meshes, cloth simulation, particles, or other game objects and meshes. As above, it is generally good practice to keep this number as low as possible without compromising game quality. See the section on CPU optimization below for guidance on how to do this.
    CPU有太多的顶点要处理。这可能是蒙皮网格,布料模拟,粒子,或其他游戏对象和网格造成的。如上所述,在不影响游戏质量的前提下,保持这个数字越低越好。关于如何做到这一点,请参阅下面关于CPU优化的部分。
  • If rendering is not a problem on the GPU or the CPU, there may be an issue elsewhere - for example, in your script or physics. Use the Unity Profiler to locate the problem.
    如果渲染在GPU或CPU上不是问题,那么在其他地方可能也会有问题。例如,在脚本或物理中。可使用Unity Profiler定位问题。

CPU optimization
CPU优化

To render objects on the screen, the CPU has a lot of processing work to do: working out which lights affect that object, setting up the shader and shader parameters, and sending drawing commands to the graphics driver, which then prepares the commands to be sent off to the graphics card.
为了渲染对象到屏幕上,CPU有很多处理工作要做:灯光对对象的影响,设置着色器和着色器参数,发送绘制命令给显卡驱动,然后准备被送到显卡的命令。

All this “per object” CPU usage is resource-intensive, so if you have lots of visible objects, it can add up. For example, if

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值