惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园_首页
V
Visual Studio Blog
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
月光博客
月光博客

博客园 - mcwind

Unity3d 如何使用程序集(续) Unity 几个Mesh特效的例子 Unity动态载入文本数据的方法归类 Unity动态载入可执行代码的方法 Unity几个有用的游戏运动特效 Unity——Export/Import Package功能和项目管理的研究 三维游戏引擎——Unity 角色模型优化要点续:换肤和导入 三维游戏引擎——Unity 角色模型优化要点 3D游戏引擎——Unity 如何绘制反面 3D游戏引擎——Unity中网格合并示例研究 资源:三维CAD二次开发网站 [收藏]你想成为一名游戏策划吗? [收藏]学习:游戏策划入门 如何让你开发的游戏赚钱 如何更改MapleTr登录页面和标题 Some Useful Articles Of TDD (Test Driven Development) On MSDN 第一次试用Live Writer手记 收藏:航空航天院所 倒腾sql2005数据表内容的方法 - mcwind - 博客园
Unity开发IOS游戏的优化建议
mcwind · 2011-06-08 · via 博客园 - mcwind

Posted on 2011-06-08 15:43  mcwind  阅读(1410)  评论()    收藏  举报

    最近社团筹划开发IOS平台上的游戏。考虑到设备性能的局限性,为此专门做了些研究。本文主要讲图形美术方面的注意事项,对编程等方面的建议我会陆续出文。

    Unity官网针对IOS开发有比较好的建议,我总结了翻译如下,后面附上原文。

  • 尽量控制定点数量(注意所谓顶点不是建模时的顶点,而是引擎渲染时的顶点。例如,模型一个顶点如果设置了2个法向,那么对引擎来说就是2个顶点) :
    • 对Iphone3或更高设备,每帧渲染的顶点不超过4万个
    • 对更早的设备,每帧渲染的顶点不超过1万个
  • 场景所用的材质尽量减少。即使是不同的物件,也尽量采用同一个材质。
  • 将固定的场景物件设置为静态(static)。
  • 尽量使用PVRTC(这是Apple推荐的一种格式)纹理,不行的话,也尽量用16位纹理取代32位的。
  • 不要在shader中使用multi-pass,通过用混合或者像素shader来合并不同的纹理以达到相同效果。
  • 如果自行编写shader,尽量避免使用浮点数。下面是建议的类型:
    • fixed/lowp——适用于颜色,光照等
    • half/mediump——适用于纹理UV
    • float/highp——避免在像素shader里使用,可以在顶点shader里面用于计算顶点位置
  • 在像素shader中尽量少用复杂的数学计算,例如幂函数、三角函数等。
  • 没必要的话不要使用像素光照(Pixel Lights)
  • 不要使用动态光照,用烘焙的lightmap
  • 不要使用alpha测试,用alpha混合来代替
  • 不要使用雾
  • 大场景中使用Occlusion culling来削减不可见区域。关卡设计时考虑到实施 Occlusion culling 的便利性
  • 使用sky box 来实现远景

 原文如下:

  • Keep vertex count below:
    • 40K per frame when targeting iPhone 3GS and newer devices (with SGX GPU)
    • 10K per frame when targeting older devices (with MBX GPU)
  • Keep the number of different materials per scene low - share as many materials between different objects as possible.
  • Set Static property on a non-moving objects to allow internal optimizations.
  • Use PVRTC formats for textures when possible, otherwise choose 16bit textures over 32bit.
  • Use combiners or pixel shaders to mix several textures per fragment instead of multi-pass approach.
  • If writing custom shaders, always use smallest possible floating-point types:
    • fixed / lowp -- perfect for color, lighting information and normals,
    • half / mediump -- for texture UV coordinates,
    • float / highp -- avoid in pixel shaders, fine to use in vertex shader for vertex position calculations.
  • Minimize use of complex mathematical operations such as pow, sin, cos etc in pixel shaders.
  • Do not use Pixel Lights when it is not necessary -- choose to have only a single (preferably directional) pixel light affecting your geometry.
  • Do not use dynamic lights when it is not necessary -- choose baking lighting instead.
  • Choose to use less textures per fragment.
  • Avoid alpha-testing, choose alpha-blending instead.
  • Do not use fog when it is not necessary.
  • Learn benefits of Occlusion culling and use it to reduce amount of visible geometry and draw-calls in case of complex static scenes with lots of occlusion. Plan your levels to benefit from Occlusion culling.
  • Use skyboxes to "fake" distant geometry.