UnityForIOS
2012-02-29 13:57
113 查看
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.
尽量控制定点数量(注意所谓顶点不是建模时的顶点,而是引擎渲染时的顶点。例如,模型一个顶点如果设置了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.
相关文章推荐
- 【Ios】 Unity for iOS 打开相册、相机及保存图片到相册
- Unity- 实现 Building Plugins for iOS(含Demo)
- Unity for iOS 调用UIDatePicker
- ARKit support for iOS via Unity-ARKit-Plugin
- ShareSDK for Unity iOS平台接入遇到的问题
- Unity for iOS 打开相册、相机及保存图片到相册
- 用ShareSDK for Unity分享屏幕截图(android和ios平台)
- MEMORY OPTIMIZATION FOR IOS APPS DEVELOPED IN UNITY
- unity3d Optimising with Unity for iOS
- Unity打包iOSFailed to resolve base type System.ServiceModel.Configuration.BehaviorExtensionElement for
- Unity For Android iOS 的本地推送
- 关于16年2月14日以后上传AppStore出现:Missing iOS Distribution signing identity for...的问题
- Unity3D iOS 平台放弃 WWW 采用 UnityWebRequest
- 50 Tips for Working with Unity (Best Practices)
- iOS 错误"This class is not key value coding-compliant for the key"解决方案
- How To Write A Simple PHP/MySQL Web Service for an iOS App
- 1、IOS编译报之:streamStatus only defined for abstract class
- iOS开发 [NSBundle mainBundle] 通过pathForResource返回路径为空.
- unity IOs读写txt文件
- ionic preparing for ios 9