> 记录一些shader的优化项,不断更新中
32位 高精度 运算慢
16位 中低精度 适合uv,色值 等一些数据的存放。 运算速度一般
11位 低精度 部分GPU不支持此类型。 运算最快. 例图中包括了不支持的显卡型号。
1.尽量少声明变量
2.尽量复用变量
关闭其他不需要使用的选项,以下原文来自UNITY3D文档。
1 | Code generation options - by default generated surface shader code tries to handle all possible lighting/shadowing/lightmap scenarios. However in some cases you know you won’t need some of them, and it is possible to adjust generated code to skip them. This can result in smaller shaders that are faster to load. |
example :
1
#pragma surface surf HelloWorld exclude_path:prepass noshadow noforwardadd nofog
减少StandShader的使用
减少StandShader的使用
减少StandShader的使用
重要事情要说三遍!
本文标题:Shader优化项
文章作者:Keyle
发布时间:2016-04-26
最后更新:2024-08-20
原始链接:https://vrast.cn/posts/ef3f08e1/
版权声明:©Keyle's Blog. 本站采用署名-非商业性使用-相同方式共享 4.0 国际进行许可