查看: 1492|回复: 0
打印 上一主题 下一主题

Unity官网针对IOS开发有比较好的建议【转】

[复制链接]

1602

主题

1

听众

2万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
24658
精华
6

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2012-8-10 16:25:09 |只看该作者 |倒序浏览
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.
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2025-6-15 11:45 , Processed in 0.069530 second(s), 28 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部