移动设备有多大的功能?应该如何相应规划游戏?如果游戏运行缓慢,且性能分析器表明游戏存在渲染瓶颈,那么如何知道应该修改什么?如何让游戏既有好看的外观又能快速运行?本页面将专门就这些方法做一般性和非技术性的说明。如果需要了解具体细节,请参阅渲染优化页面。
Shadowgun 是体现当前移动端硬件能力的令人印象深刻的例子。但更确切地说,这款游戏充分说明了移动端硬件的限制以及如何克服这些限制。特别是因为这款游戏的一小部分已在此博客文章中公开发布,所以得出了这样的结论。
下面概要列出了 Shadowgun 为了确保性能而进行的优化:
此演示旨在展示 Unity 在高端 Android 设备上的功能。
越是遵从和理解移动设备的局限性,游戏外观就越好,而且表现也会越流畅。如果要制作一款适用于移动设备的高规格游戏,您将会因为了解 Unity 的图形管线并能够编写自己的着色器而受益。但是如果想要立即使用某些现成的着色器,ShadowGun 的着色器(可从此处获取)是一个很好的起点。
游戏试图遵循自然规律是没有问题的。每个抛射物的抛射运动以及闪亮铬金属每个像素的颜色都是从先用于模拟现实世界观察结果的公式推导而来的。但是,游戏的一部分涉及科学模拟,另一部分涉及图形绘制。您不会因为物理上准确的渲染就能在移动市场中赢得竞争;如果试图自始至终模拟现实世界,硬件根本就不存在,最终游戏会变得很受限、单调和迟钝。
必须充分利用多边形和混合模式,就像它们是画笔一样。
Shadowgun 中显示的烘焙凹凸贴图就是很好的例子。纹理中已经存在镜面高光,人眼不会注意到它们实际上没有与反射光和视图方向对齐,它们只是纹理上的高对比度细节,完全是伪造的,但最终看起来很棒。这是一种常见的作弊技术,已在许多成功的游戏中使用。通过比较曾经发布的第一个 Halo 截屏中的头盔罩与此发布截屏中的头盔罩,看起来头盔顶部突起的盔甲在头盔罩中反射,但实际上反射被烘焙到头盔罩纹理中。在《英雄联盟》中,魔法效果似乎附加了像素光源,但实际上是一个混合平面,其纹理可能是通过对地面上闪烁的像素光源进行截屏而生成的。
请参阅渲染优化页面。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.