zoukankan      html  css  js  c++  java
  • Unity官网针对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 powsincos 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.
  • 相关阅读:
    服务管理命令
    软件管理
    Qt软件打包与发布(windeployqt工具)
    03
    第一章 BP神经网络
    代理模式 与 Spring AOP
    java 回调机制
    HashTable 实现
    实现Singleton模式
    BST 汇总
  • 原文地址:https://www.cnblogs.com/softimagewht/p/3231185.html
Copyright © 2011-2022 走看看