What are mobile devices capable of? How should you plan your game accordingly? If your game runs slow, and the profiler indicates that it's a rendering bottleneck, how do you know what to change, and how to make your game look good but still run fast? This page is dedicated to a general and non-technical exposition of the methods. If you are looking for the specifics, see the Rendering Optimizations page.

移动设备能够做到什么?如何相应地策划你的游戏?如果游戏的运行速度慢,并且分析器表明这是一个渲染瓶颈,你如何得知要改变什么?以及如何保障你的游戏很好看的同时仍然运行得很快?此页面专门阐述一般和非技术方法。如果你正在寻找具体细节,请参阅 渲染优化页面。

What you can reasonably expect to run on current consumer mobiles:
你可以合理地预期在当前消费者手机上的运行状况:

  • Lightmapped static geometry. But beware of:
    光照贴图的静态几何。要注意:

    • Using a lot of alpha-test shaders 
      使用大量alpha测试着色器
    • Bumpmapping, especially using built-in shaders. 
      凹凸贴图,尤其在使用内置着色器的时候
    • High polygon count 
      高多边形数
  • Animated characters, even with fancy shaders! But beware of:
    动画角色,甚至那些使用花哨着色器(的角色)!要注意:

    • Massive crowds or high-poly characters 
      大量人群或高聚角色
  • 2D games with sprites. But beware of:
    使用精灵的2D游戏,要注意:

    • Overdraw, or, lots of layers drawn on top of eachother. 
      超量绘制,或者,绘制在彼此顶部的大量图层。
  • Particle effects. But beware of:
    粒子效果。要注意:

    • High density on large particles. (Lots of particles drawn on top of each other. This is another overdraw situation) 
      较大粒子的高密度(情况)。(大量的粒子在彼此的顶部绘制。这是另一个中超量绘制的情况)
    • Ridiculous numbers of particles, or particle colliders. 
      粒子或粒子碰撞器出现的荒谬数量。
  • Physics. But beware of:
    物理。要注意:

    • Mesh colliders. 网格碰撞器。
    • Lots of active bodies. 大量的激活对象。

What you CANNOT reasonably expect to run on current consumer mobiles:
那些你无法合理预期在当前消费者手机上的运行(情况):

  • Fullscreen screen image effects like glow and depth of field. 
    全屏屏幕效果,像发光和景深。
  • Dynamic per-pixel lighting (multiple lights marked Important and not baked into the lightmap)
    动态逐像素光照(多个灯光标记为“重要”,而不是烘焙到光照贴图)

    • Every affected object is drawn an additional time for every dynamic light you use, and this gets slow quickly. 
      每个受影响的对象会由于你所使用的每个动态灯光而绘制更多的时间,这将很快变得比较缓慢。
  • Real time shadows on everything
    所有物体的实时阴影

    • Unity 4 offers native support for real time shadows on mobile platforms, but their use must be very judicious, and likely limited to higher-end devices. 
      Unity 4在移动平台上为实时阴影提供了原生支持,但他们的使用必须是非常明智的,而且很可能受限于高端设备。

Examples - How top-notch mobile games are made
示例 - 如何打造一款顶尖游戏

Shadowgun 暗影之枪

Shadowgun is an impressive example of what can be done on current mobile hardware. But more specifically, it's a good example of what cannot be done, and how to get around the limitations. Especially because a small part of the game has been made publicly available in this blog post.

暗影之枪是一款展现了可以在当前手机硬件做到什么程度的令人印象深刻的例子。但更确切地说,它是一款说明了什么不能做,以及如何绕开限制的较好示例。更特别的是,游戏的一小部分已经在这个 博客帖子 公之于众。

Here's a basic rundown of things that Shadowgun does in order to keep performance up:

以下是暗影之枪为了保持性能的基本纲要:

  • Dynamic lighting - barely used. 动态照明 - 几乎不用。

    • Blob shadows and Lightmaps are used instead of any real shadows. 
      使用blob阴影和光照贴图,而不是任何真实的阴影。
    • Lightprobes, instead of real lights, are used on their characters.
      在角色上使用光探头,而不是真正的灯光。

      • Muzzle flashes added into the lightprobe data via script. 
        通过脚本给光探针加入枪口闪烁。
    • The only dynamic per-pixel lighting is an arbitrary light direction used to calculate a BRDF on the characters.
      唯一的动态逐像素光照是一个用来计算双向反射分布函数的特征的任意光照方向。
  • Bumpmapping - barely used. 凹凸贴图 - 几乎不使用。
    • Real bumpmapping only used on characters. 
      真正的凹凸贴图只有在角色上才会使用。
    • As much contrast and detail as possible is baked into the diffuse texture maps. Lighting information from bumpmaps is baked in. 
      尽可能多的对比度和细节被烘焙成漫反射纹理贴图。来自凹凸贴图的照明信息被烘焙。
    • A good example is their statue texture, or their shiny wall, as seen on the right. No bumpmaps are used to render these, the specularity is faked by baking it into the texture. Lightmapping is combined with a vertex-lighting-based specular highlight to give these models a shiny look. 
      有一个很好的示例就是他们的雕像质地,或是那闪亮的墙,如右图所示。没有使用凹凸贴图来渲染这些,镜面反射是通过烘焙到纹理伪造的。光照贴图结合了一个基于顶点光照的镜面高光来给这些模型一个闪亮的外观。
    • If you want to learn how to create textures like this one, check out the Rendering Optimizations page. 
      如果你想学习如何创建一个像这样的纹理,查看 渲染优化页面。
  • Dense particles - avoided. 密集的粒子 - 要避免。
    • UV-scrolling textures used instead of dense particle effects. 
      使用UV滚动纹理来代替密集的粒子效果。
  • Fog effects - avoided. 雾化效果 - 要避免。
    • Their god rays are hand-modeled. 游戏中神的光线都是手工建模。
    • Single planes that fade in and out are used to achieve cinematic fog effects without actually rendering any fog.
      单个平面的淡入淡出可用来实现电影雾化效果,而无需实际渲染任何雾。

      • This is faster because the planes are few and far between, and it means that fog doesn't have to be calculated on every pixel and in every shader. 
        这样更快,因为平面少之又少,并且这意味着雾化不需要在每个着色器的每个像素进行计算。
  • Glow - avoided. 辉光 - 要避免。
    • Blended sprite planes are used to give the appearance of a glow on certain objects. 
      混合精灵平面用于给特定的平面以辉光外观。

Sky Castle Demo 天空城堡演示

This demo was designed to show what Unity is capable of on high-end Android devices.

这个demo旨在展现Unity能够适用于Android高端设备。

  • Dynamic lighting - not used. 动态照明 - 不使用。

    • Lightmaps only. 仅用光照贴图。
  • Bumpmapping - used 凹凸贴图 - 使用
    • The bricks are all bumpmapped, lit by directional lightmaps. This is where the "high-end devices" part comes into play. 
      砖块全部使用的是凹凸贴图,点亮由平行光照贴图实现。这里就是“高端设备”使用的地方。
  • Real time reflections - limited. 实时反射 - 有限的。
    • They carefully placed their real-time reflecting surfaces separately and in isolated areas, so that only one runs at a time, and the environment that needs to be rendered twice can be easily culled. 
      它们被小心地单独摆放在它们的实时反射面,并且是在一个独立的区域,因此仅仅需要运行一次,环境需要渲染两次后就可以被轻松地拣选出来。

Bottom line - What this means for your game
底线 - 这对你的游戏而言意味着什么

The more you respect and understand the limitations of the mobile devices, the better your game will look, and the smoother it will perform. If you want to make a high-class game for mobile, you will benefit from understanding Unity's graphics pipeline and being able to write your own shaders. But if you want something to grab to use right away, ShadowGun's shaders, available here, are a good place to start.

你越尊重和理解移动设备的局限性,你的游戏会看起来很好,运行起来也会更流畅。如果你想做一款高档的手机游戏,更好地理解Unity图形渲染管线并能够编写自己的着色器会使你受益匪浅。但是,如果你想要抓住某些东西马上使用,暗影之枪的着色器在 这里 提供,这是一个好的开端。 不要模仿它,烘焙它!

Don't Simulate It, Bake It !

There is no question that games attempt to follow the laws of nature. The movement of every parabolic projectile and the color of every pixel of shiny chrome is derived by formulas first written to mimic observations of the real world. But a game is one part scientific simulation and one part painting. You can't compete in the mobile market with physically accurate rendering; the hardware simply isn't there yet, if you try to imitate the real world all the way, your game will end up limited, drab, and laggy.

毫无疑问,游戏应遵循自然规律。每个抛弹的运动和闪亮镀铬的每一像素颜色都源于首先写好的用于模拟现实世界观测的公式。但一款游戏只是(使用)科学模拟和绘画的一部分。你不能使用物理上的准确渲染在移动市场上竞争;硬件现在还没有到位,如果你尝试模拟现实世界中的所有方式,你的游戏会因为受限、单调和延迟而宣告结束。

You have to pick up your polygons and your blend modes like they're paintbrushes.

你必须拾起多边形和混合模式把它们当成画笔。

The baked bumpmaps shown in Shadowgun are great examples of this. There are specular highlights already in the texture - the human eye doesn't notice that they don't actually line up with the reflected light and view directions - they are simply high-contrast details on the texture, completely faked, yet they end up looking great. This is a common cheating technique which has been used in many successful games. Compare the visor in the first Halo screenshot ever released with the visor from this release screenshot. It appears that the armor protrusions from the top of the helmet are reflected in the visor, but the reflection is actually baked into the visor texture. In League of Legends, a spell effect appears to have a pixel-light attached to it, but it actually is a blended plane with a texture that was probably generated by taking a screenshot of a pixel light shining on the ground.

暗影之枪 烘焙的凹凸贴图 就是很好的例子。有些已经在纹理中的镜面高光-人眼不会注意到它们实际上没有与反射光和视图方向排成一行-它们只是高对比度的细节纹理,完全是伪造的,但它们最终看起来很赞。这是一种常见的作弊技术,它已被用于许多成功的游戏。比较 第一个发布过的光环游戏截图 中的面罩和 这个版本截图 中的面罩。看起来从头盔顶部的盔甲突出是反射到面罩的,但反射实际是烘焙到面罩贴图上。英雄联盟里面,一个魔法效果 似乎有一个连接到它的像素光,但它实际上是由可能产生的照射在地面上的像素光截图纹理形成的混合平面。

What works well: 行之有效的做法:

  • Lightmapped static geometry 静态几何体光照贴图

    • Dramatic lighting and largely dynamic environments don't mix. Pick one or the other. 
      舞台照明和大量动态环境不要混用。选择前者或者后者。
  • Lightprobes for moving objects 移动对象使用灯光探测器
    • Current mobile hardware is not really cut out for lots of dynamic lights, and it can't do shadows. Lightprobes are a really neat solution for complex game worlds with static lighting. 
      当前手机硬件是不能真的切除大量的动态灯,也不能做阴影。光探针为使用静态灯光的复杂游戏世界提供了很好的解决方案。
  • Specialized shaders and detailed, high-contrast textures
    专门着色器和详细的、高对比纹理。

    • The shaders in ShadowGun minimize per-pixel calculations and exploit complex and high-quality textures. See our Rendering Optimizationspage for information on how to make textures that look great even when the shader is simple. 
      暗影之枪的着色器减少了每个像素的计算量、开发复杂度和高质量纹理。如何使纹理看起来很棒,即使是使用简单的着色器,参看我们的 渲染优化页面。
  • Cartoon Graphics 卡通图形
    • Who says your game has to look like a photo? If you make lighting and atmosphere the responsibility of the texture artist, not the engine, you hardly even have to worry about optimizing rendering. 
      谁说你的游戏看起来像一张照片?如果你让纹理贴图师而不是引擎(工程师)负责光照和氛围,你就不必担心渲染优化了。

What does not work: 不会起什么作用的做法:

  • Glow and other Post processing effects 发光和其他后期处理效果

    • Approximate such effects when possible by using blended quads, check out the Shadowgun project for an example of this. 
      通过使用混合四边形可能实现近似的效果,查阅暗影之枪工程的此示例。
  • Bumpmapping, especially with the built-in shaders 凹凸贴图,尤其是内置着色器
    • Use it sparingly, only on the most important characters or objects. Anything that can take up the whole screen probably shouldn't be bumpmapped. 
      只在最重要的角色或物体上有节制地使用它。任何会占据整个屏幕的事物不应该使用凹凸贴图。
    • Instead of using bump maps, bake more detail and contrast into the diffuse texture. The effect from League of Legends is an interesting example of this being used successfully in the industry. 
      烘焙更多的细节和对比度到漫反射纹理,来代替凹凸贴图的使用。英雄联盟的效果就是在行业中成功使用的一个有趣的例子。

But how do I actually do it? 但我实际上应该怎么做?

See our Rendering Optimizations page.

参看我们的 渲染优化页面。

优化手机的实用指南 - 图形方法相关推荐

  1. 删除文件过一会又回来_手机文件误删除如何恢复?教你实用的找回方法!

    手机文件误删除如何恢复?很多时候大家都有过不小心删除文件的经历,尤其是存在于手机中的文件,很容易在使用手机管家清理内存的时候,顺手把一些文件给清理掉了,很多文件对于我们来说都是有重要的作用的,那么有很 ...

  2. 机器学习实用指南:如何从数据可视化中发现数据规律?

    点击上方"AI有道",选择"置顶"公众号 重磅干货,第一时间送达 本系列为<Scikit-Learn 和 TensorFlow 机器学习指南>的第四 ...

  3. Python 无监督学习实用指南:1~5

    原文:Hands-on unsupervised learning with Python 协议:CC BY-NC-SA 4.0 译者:飞龙 本文来自[ApacheCN 深度学习 译文集],采用译后编 ...

  4. 【CV】ShuffleNet V2:高效 CNN 架构设计的实用指南

    论文名称:ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design 论文下载:https://arxiv.or ...

  5. React-Native 开发实用指南

    [CSDN 编者按]本文主要介绍 React-Native 的实际使用经验,对于想要快速入门的同学是有帮助的. 作者 | 佐玉 出品 | CSDN(ID:CSDNnews) 整体介绍 首先说, Rea ...

  6. Python 无监督学习实用指南:6~10

    原文:Hands-on unsupervised learning with Python 协议:CC BY-NC-SA 4.0 译者:飞龙 本文来自[ApacheCN 深度学习 译文集],采用译后编 ...

  7. Unity优化手机游戏学习教程

    流派:电子学习| MP4 |视频:h264,1280×720 |音频:AAC,48.0 KHz 语言:英语+中英文字幕(根据原英文字幕机译更准确)|大小解压后:3.69 GB |时长:6h 44m 创 ...

  8. 交互设计实用指南系列 – 我们眼中的交互设计

    交互设计(Interaction Design, 缩写 IxD 或者 IaD),是定义.设计人造系统的行为的设计领域.人造物,即人工制成物品,例如,软件.移动设备.人造环境.服务.可佩带装置以及系统的 ...

  9. 机器学习实用指南_机器学习方法:实用指南

    机器学习实用指南 by Karlijn Willems 通过Karlijn Willems 机器学习方法:实用指南 (How Machines Learn: A Practical Guide) Yo ...

最新文章

  1. Answer:关于C#连续赋值的面试题
  2. ssl2647-线段树练习4【线段树】
  3. jboss eap 6.2 ear包 下使用log4j日志
  4. 在 Intellij IDEA 里使用 OpenJFX (JavaFX)
  5. c6011取消对null指针的引用_C++| 函数的指针参数如何传递内存?
  6. mysql数据库自动化脚本备份_mysql 自动化脚本备份
  7. 今天用充QQ币的时候,发现选择网银的时候,竟然会跳出一个错误
  8. web测试和app测试相关
  9. 复杂性思维中文第二版 六、生命游戏
  10. MonGoDB 常见操作, 设置管理员和用户登入
  11. Java 获取两个日期之间的日期
  12. spring之httpclient doget请求
  13. 剑指offer最新版_剑指offer第二版速查表
  14. php 字符串长度判断_php 字符串长度判断更高效的方法
  15. 64qam带宽计算_滚降系数为0.5的64QAM信号,数据速率若为_____,则带宽为______。
  16. 计算机主板显卡接口,【我想给电脑加个显卡,但是不知道这个主板的显卡接口是什么类型的?】.请大家帮忙...
  17. (XWZ)的Python学习笔记Ⅱ------面向对象编程
  18. 硼替佐米大鼠血清白蛋白RSA纳米粒|布立尼布小麦麦清白蛋白纳米粒|马赛替尼豆清白蛋白纳米粒(齐岳)
  19. zeros什么意思_zeros:zeros还是zeroes?4)是什么意思?
  20. java获取时间(今天,昨天,上周第一天,本周第一天,本周最后一天)

热门文章

  1. 判断一个字符串是否为全字母句
  2. 智能时代为什么需要区块链技术?
  3. win10 2016企业版激活,遇到非核心版本的计算机问题
  4. 在CentOS 6.3中安装拼音输入法 详细出处参考:http://www.jb51.net/os/RedHat/73029.html
  5. 成功解决failed: The TLS connection was non-properly terminated
  6. php网页ico更改,favicon.ico图片该如何修改
  7. 华为大数据HCIA题目1
  8. Faster RCNN layer.py
  9. 最新2019版个税计算器(5000起征点 + 个税专项扣除项)
  10. 织梦网站数据入库接口(实现图片本地化,自动图片打水印)【原创】