版本 |
作者 |
参与者 |
完成日期 |
备注 |
UnityAPI_Shader_V01_1.0 |
严立钻 |
|
2020.05.24 |
|
|
|
|
|
|
立钻哥哥:Unity是一个入门快、提高难的游戏引擎,想要提升能力,至少需要越过3道坎:API+Shader+综合能力;++1、API的积累:对API的合理利用不仅可以减轻自己的编码负担,而且往往可以提高程序的运行效率;这也是钻哥开始“Unity API”独立打造分类的初衷; ++2、Shader编程:想要做出一款精品游戏往往需要有高效的Shader的支持;Unity提供了一套改良的“Shader Lab”系统,优化了繁杂的“Open GL”编程; ++3、综合能力(技术+业务+管理):一款产品的制作除了功能编程外,往往会涉及很多其他领域,例如产品架构、UI交互设计、模型制作等,作为主要的编程人员,对其他相关领域的了解程序往往会影响到产品制作直至最后的产品体验; ++++立钻哥哥一直在推动【VR云游戏=Unity+SteamVR+云技术+5G+AI】,这个只是一个引子,抛砖引玉让大家对整个知识体系有一个明确的落地方向,宝宝们可以根据自己的兴趣方向进行拓展:比如Unity这里是指一种“3D游戏引擎”,也可拓展至“UE4、Cocos2dx”等游戏引擎;SteamVR是一种跨硬件解决方案,也可拓展至“VRTK”等第三方插件;“云技术+5G”是一种跨平台解决方案的核心技术,同样可拓展至其他平台解决方案;AI也是一种先进技术的举例,也可以拓展至任何一种前沿技术; |
++++【Unity API】分类:https://blog.csdn.net/vrunsoftyanlz/category_7637520.html
++++【Unity开发基础】分类:https://blog.csdn.net/vrunsoftyanlz/category_7309057.html
++++【Linux系统编程】分类:https://blog.csdn.net/vrunsoftyanlz/category_9694767.html
++++【C++C铸就生存利器】分类:https://blog.csdn.net/vrunsoftyanlz/category_9325802.html
++++【人工智能AI2026】分类:https://blog.csdn.net/vrunsoftyanlz/category_9212024.html
++++【立钻哥哥CSDN空间】:https://blog.csdn.net/VRunSoftYanlz/
#Shader着色器 |
#Shader着色器++A1、Description描述++B2、Variables变量++C3、Public Function共有函数++D4、Message消息 |
#A1、Description描述 |
++++大多数高级的渲染是通过材质类控制的;Shader类通常仅用于检查一个着色器是否能运行在用户的硬件上(已经支持属性)和通过名称找出某个着色器(Find方法);
立钻哥哥:Shader scripts used for all rendering.
|
#B2、Static Variables静态变量 |
++B2、Static Variables静态变量++++B2.1、globalMaximumLOD++++B2.2、YanlzXREngine.Shader.StaticVariables |
++B2.1、globalMaximumLOD |
static int globalMaximumLOD; |
++++对于所有着色器的细节层次级别;
#C3、Variables变量 |
++C3、Variables变量++++C3.1、isSupported++++C3.2、maximumLOD++++C3.3、renderQueue++++C3.4、YanlzXREngine.Shader.Variables |
++C3.1、isSupported |
bool isSupported; |
++++这个着色器是否能运行在用户终端显卡上(只读)?
++++如果着色器本身或者任何后背设定是受支持的,就返回真;当实现特效时可能会常用;比如:在Unity专业版中,如果着色器不支持时图像特效会自动禁用;
using UnityEngine; using System.Collections; using YanlzXREngine;
public class YanlzShader : MonoBehaviour{
void MyTestFunc(){ if(!renderer.material.shader.isSupported){ renderer.enabled = false; } //立钻哥哥:if(){} } //立钻哥哥:void MyTestFunc(){}
} //立钻哥哥:public class YanlzShader{} |
++C3.2、maximumLOD |
int maximumLOD; |
++++着色器的细节层次级别;
++C3.3、renderQueue |
int renderQueue; |
++++着色器的渲染队列(只读);
#D4、Static Functions静态函数 |
++D4、Static Functions静态函数++++D4.1、DisableKeyword++++D4.2、EnableKeyword++++D4.3、Find++++D4.4、IsKeywordEnabled++++D4.5、PropertyToID++++D4.6、SetGlobalBuffer++++D4.7、SetGlobalColor++++D4.8、SetGlobalFloat++++D4.9、SetGlobalInt++++D4.10、SetGlobalMatrix++++D4.11、SetGlobalTexture++++D4.12、SetGlobalVector++++D4.13、WarmupAllShaders++++D4.14、YanlzXREngine.Shader.StaticFunctions |
++D4.1、DisableKeyword |
static void DisableKeyword(string keyword); |
++++取消设置全局的着色器关键字;
++++着色器能够内部编译成多个变体,然后基于材质的关键字匹配一个(Material.EnableKeyword和Material.DisableKeyword),或者全局设置材质关键词(EnableKeyword和DisableKeyword);
++D4.2、EnableKeyword |
static void EnableKeyword(string keyword); |
++++设置全局的着色器关键字;
++++着色器能够内部编译成多个变体,然后基于材质的关键字匹配一个(Material.EnableKeyword和Material.DisableKeyword),或在全局设置材质关键词(EnableKeyword和DisableKeyword);
++D4.3、Find |
static Shader Find(string name); |
++++通过名字找到着色器;
++++Shader.Find用于在切换到另一个着色器时,不用保持对这个着色器的引用;“/name/”可以在任何材质的着色器弹出菜单上可以看到;基本的名字如:“Diffuse”,“Bumped Diffuse”,“VertexLit”,“Transparent/Diffuse”等等;
++++当构建一个播放器时,如果一个着色器被某个材质指定,这个材质在任何场景中使用过或者这个着色器在“Resources”目录下,这个着色器就会包含在播放器中;
using UnityEngine; using System.Collections; using YanlzXREngine;
public class YanlzShader : MonoBehaviour{
void Start(){ Material material = new Material(Shader.Find(“Transparent/Diffuse”)); Material.color = Color.green; GetComponent<Renderer>().material = material; } //立钻哥哥:void Start(){}
} //立钻哥哥:YanlzShader{} |
++D4.4、IsKeywordEnabled |
static bool IsKeywordEnabled(string keyword); |
++++某个全局的关键字是否启用?
++D4.5、PropertyToID |
static Shader SetGlobalTexture(string name); |
++++为一个着色器属性名获取唯一标识;
++++使用属性标识比将字符串传递给所有材质属性的功能是更有效的;比如,大量调用Material.SetColor或者使用MaterialPropertyBlock,那么最好方式是只需要标识符属性一次;
++++在Unity中每个着色器属性的名字(如_MainTex or _Color)被分配一个唯一的整数数字,整个游戏过程中保持不变;这些数字在不同机器之间的游戏或运行不会重复,所以不要保存或通过网络发送他们;
++D4.6、SetGlobalBuffer |
static void SetGlobalBuffer(string propertyName, ComputeBuffer buffer); |
++++对所有着色器设置全局计算缓冲属性;
++++如果一个着色器需要使用全局属性但材质中没有定义时全局属性将被使用(例如,如果着色器没有暴露在属性块);
++D4.7、SetGlobalColor |
static Shader SetGlobalColor(string propertyName, Color color);static Shader SetGlobalColor(int nameID, Color color); |
++++对所有着色器设置一个全局颜色属性;
++++如果一个着色器需要某个属性,而材质没有定义它们,将使用全局属性(例如:如果着色器不在Properties模块中暴露它们);
++++通常在有一组定义的着色器,所有使用相同的“全局”颜色(例如,太阳的颜色);然后可以从脚本中设置全局属性,并不需要在所有材质中设置相同的颜色;
++D4.8、SetGlobalFloat |
static Shader SetGlobalFloat(string propertyName, float value);static Shader SetGlobalFloat(int nameID, float value); |
++++为所有着色器设置一个全局浮点数;
++++如果一个着色器需要某个属性,但材质没有定义它们将使用全局属性(例如:如果着色器不在Properties模块中暴露它们);
++++通常在一组定义的着色器,全部使用相同的“全局”浮点数(例如:一些雾类型的密度);然后可以从脚本中设置全局属性,并不需要在所有的材质中设置相同的浮点数;
++D4.9、SetGlobalInt |
static void SetGlobalInt(string propertyName, int value);static void SetGlobalInt(int nameID, int value); |
++++为所有着色器设置一个全局整型数;
++++在着色器内部浮点数和整数属性完全相同的处理,所以这个函数是SetGlobalFloat一个别名;
++D4.10、SetGlobalMatrix |
static void SetGlobalMatrix(string propertyName, Matrix4x4 mat);static void SetGlobalMatrix(int nameID, Matrix4x4 mat); |
++++对所有着色器设置一个全局的整矩阵属性;
++++如果一个着色器需要某个属性,但材质没有定义它们,将使用全局属性(例如:如果着色器没有暴露在属性块);
++D4.11、SetGlobalTexture |
static void SetGlobalTexture(string propertyName, Texture tex);static void SetGlobalTexture(int nameID, Texture tex); |
++++为所有着色器设置一个全局纹理;
++++如果一个着色器需要某个属性,但材质没有定义它们,将使用全局属性(例如:如果着色器不在Properties模块中暴露它们);
++++通常在一组定义的着色器,全部使用相同的“全局”为(例如:自定义diffuse-lighting立方图);然后可以从脚本中设置全局属性,并不需要在所有的材质中设置相同的纹理;
++D4.12、SetGlobalVector |
static void SetGlobalVector(string propertyName, Vector4 vec);static void SetGlobalVector(int nameID, Vector4 vec); |
++++为所有着色器设置一个全局向量;
++++如果一个着色器需要某个属性,但材质没有定义它们将使用全局属性(例如:如果着色器不在Properties模块中暴露它们);
++++通常在一组定义的着色器,全部使用相同的“全局”向量(例如:风的方向);然后可以从脚本中设置全局属性,并不需要在所有的材质中设置相同的向量;
++D4.13、WarmupAllShaders |
static void WarmupAllShaders(); |
++++完全加载所有着色器,以防止将来性能卡顿;
++++通常显卡驱动程序不实际预加载着色器,直到第一次需要;然而,当某些物体是第一次被渲染一个以前未使用的着色器,可能有卡顿(游戏画面停顿),因为显卡驱动程序正编译/优化着色器;在移动平台,这可能相当明显;
++++调用这个函数将执行虚拟one-invisible-triangle渲染,所有当前加载的着色器队列;这可能需要一些时间,但有助于避免在未来的卡顿;一般最好使用ShaderVariantCollection更细粒度的着色器预热控制;
++++注意:这个函数只会预热当前加载着色器;如果使用Resources.Load加载着色器,需要再次调用WarmupAllShaders;
#E5、立钻哥哥对Shader类的拓展 |
++++【Unity API】分类:https://blog.csdn.net/vrunsoftyanlz/category_7637520.html
++++【Unity开发基础】分类:https://blog.csdn.net/vrunsoftyanlz/category_7309057.html
++++【Linux系统编程】分类:https://blog.csdn.net/vrunsoftyanlz/category_9694767.html
++++【C++C铸就生存利器】分类:https://blog.csdn.net/vrunsoftyanlz/category_9325802.html
++++【人工智能AI2026】分类:https://blog.csdn.net/vrunsoftyanlz/category_9212024.html
++++【立钻哥哥CSDN空间】:https://blog.csdn.net/VRunSoftYanlz/
立钻哥哥推荐的拓展学习链接(Link_Url) |
++++立钻哥哥Unity 学习空间: http://blog.csdn.net/VRunSoftYanlz/
++++虚拟现实VR资讯: https://blog.csdn.net/VRunSoftYanlz/article/details/89165846
++++HTC_VIVE开发基础:https://blog.csdn.net/VRunSoftYanlz/article/details/81989970
++++Oculus杂谈:https://blog.csdn.net/VRunSoftYanlz/article/details/82469850
++++Oculus安装使用:https://blog.csdn.net/VRunSoftYanlz/article/details/82718982
++++Unity+SteamVR=>VR:https://blog.csdn.net/VRunSoftYanlz/article/details/88809370
++++Unity减少VR晕眩症:https://blog.csdn.net/VRunSoftYanlz/article/details/89115518
++++SteamVR简介:https://blog.csdn.net/VRunSoftYanlz/article/details/86484254
++++SteamVR脚本功能分析:https://blog.csdn.net/VRunSoftYanlz/article/details/86531480
++++SteamVR2.0开发指南:https://blog.csdn.net/VRunSoftYanlz/article/details/86618187
++++SteamVR2.2.0开发指南:https://blog.csdn.net/VRunSoftYanlz/article/details/88784527
++++SteamVR2.2.0快速入门:https://blog.csdn.net/VRunSoftYanlz/article/details/88833579
++++SteamVR2.2.0交互系统:https://blog.csdn.net/VRunSoftYanlz/article/details/89199778
++++SteamVR2.2.0传送机制:https://blog.csdn.net/VRunSoftYanlz/article/details/89390866
++++SteamVR2.2.0教程(一):https://blog.csdn.net/VRunSoftYanlz/article/details/89324067
++++SteamVR2.2.0教程(二):https://blog.csdn.net/VRunSoftYanlz/article/details/89894097
++++SteamVR_Skeleton_Poser:https://blog.csdn.net/VRunSoftYanlz/article/details/89931725
++++SteamVR实战之PMCore:https://blog.csdn.net/VRunSoftYanlz/article/details/89463658
++++SteamVR/Extras:https://blog.csdn.net/VRunSoftYanlz/article/details/86584108
++++SteamVR/Input:https://blog.csdn.net/VRunSoftYanlz/article/details/86601950
++++OpenXR简介:https://blog.csdn.net/VRunSoftYanlz/article/details/85726365
++++VRTK杂谈:https://blog.csdn.net/VRunSoftYanlz/article/details/82562993
++++VRTK快速入门(杂谈):https://blog.csdn.net/VRunSoftYanlz/article/details/82955267
++++VRTK官方示例(目录):https://blog.csdn.net/VRunSoftYanlz/article/details/82955410
++++VRTK代码结构(目录):https://blog.csdn.net/VRunSoftYanlz/article/details/82780085
++++VRTK(SceneResources):https://blog.csdn.net/VRunSoftYanlz/article/details/82795400
++++VRTK_ControllerEvents:https://blog.csdn.net/VRunSoftYanlz/article/details/83099512
++++VRTK_InteractTouch:https://blog.csdn.net/VRunSoftYanlz/article/details/83120220
++++虚拟现实行业应用:https://blog.csdn.net/VRunSoftYanlz/article/details/88360157
++++Steam平台上的VR:https://blog.csdn.net/VRunSoftYanlz/article/details/88960085
++++Steam平台热销VR:https://blog.csdn.net/VRunSoftYanlz/article/details/89007741
++++VR实验:以太网帧的构成:https://blog.csdn.net/VRunSoftYanlz/article/details/82598140
++++实验四:存储器扩展实验:https://blog.csdn.net/VRunSoftYanlz/article/details/87834434
++++FrameVR示例V0913:https://blog.csdn.net/VRunSoftYanlz/article/details/82808498
++++FrameVR示例V1003:https://blog.csdn.net/VRunSoftYanlz/article/details/83066516
++++SwitchMachineV1022:https://blog.csdn.net/VRunSoftYanlz/article/details/83280886
++++PlaySceneManagerV1022:https://blog.csdn.net/VRunSoftYanlz/article/details/83280886
++++Unity5.x用户手册:https://blog.csdn.net/VRunSoftYanlz/article/details/81712741
++++Unity面试题ABC:https://blog.csdn.net/vrunsoftyanlz/article/details/78630687
++++Unity面试题D:https://blog.csdn.net/VRunSoftYanlz/article/details/78630838
++++Unity面试题E:https://blog.csdn.net/vrunsoftyanlz/article/details/78630913
++++Unity面试题F:https://blog.csdn.net/VRunSoftYanlz/article/details/78630945
++++Cocos2dx面试题:https://blog.csdn.net/VRunSoftYanlz/article/details/78630967
++++禅道[zentao]:https://blog.csdn.net/VRunSoftYanlz/article/details/83964057
++++Lua快速入门篇(Xlua拓展):https://blog.csdn.net/VRunSoftYanlz/article/details/81173818
++++Lua快速入门篇(XLua教程):https://blog.csdn.net/VRunSoftYanlz/article/details/81141502
++++Lua快速入门篇(基础概述):https://blog.csdn.net/VRunSoftYanlz/article/details/81041359
++++框架知识点:https://blog.csdn.net/VRunSoftYanlz/article/details/80862879
++++游戏框架(UI框架夯实篇):https://blog.csdn.net/vrunsoftyanlz/article/details/80781140
++++游戏框架(初探篇):https://blog.csdn.net/VRunSoftYanlz/article/details/80630325
++++.Net框架设计:https://blog.csdn.net/VRunSoftYanlz/article/details/87401225
++++从零开始学架构:https://blog.csdn.net/VRunSoftYanlz/article/details/88095895
++++设计模式简单整理:https://blog.csdn.net/vrunsoftyanlz/article/details/79839641
++++专题:设计模式(精华篇):https://blog.csdn.net/VRunSoftYanlz/article/details/81322678
++++U3D小项目参考:https://blog.csdn.net/vrunsoftyanlz/article/details/80141811
++++Unity小游戏算法分析:https://blog.csdn.net/VRunSoftYanlz/article/details/87908365
++++Unity案例(Vehicle):https://blog.csdn.net/VRunSoftYanlz/article/details/82355876
++++UML类图:https://blog.csdn.net/vrunsoftyanlz/article/details/80289461
++++PowerDesigner简介:https://blog.csdn.net/VRunSoftYanlz/article/details/86500084
++++Unity知识点0001:https://blog.csdn.net/vrunsoftyanlz/article/details/80302012
++++Unity知识点0008:https://blog.csdn.net/VRunSoftYanlz/article/details/81153606
++++U3D_Shader编程(第一篇:快速入门篇):https://blog.csdn.net/vrunsoftyanlz/article/details/80372071
++++U3D_Shader编程(第二篇:基础夯实篇):https://blog.csdn.net/vrunsoftyanlz/article/details/80372628
++++Unity引擎基础:https://blog.csdn.net/vrunsoftyanlz/article/details/78881685
++++Unity面向组件开发:https://blog.csdn.net/vrunsoftyanlz/article/details/78881752
++++Unity物理系统:https://blog.csdn.net/vrunsoftyanlz/article/details/78881879
++++Unity2D平台开发:https://blog.csdn.net/vrunsoftyanlz/article/details/78882034
++++UGUI基础:https://blog.csdn.net/vrunsoftyanlz/article/details/78884693
++++UGUI进阶:https://blog.csdn.net/vrunsoftyanlz/article/details/78884882
++++UGUI综合:https://blog.csdn.net/vrunsoftyanlz/article/details/78885013
++++Unity动画系统基础:https://blog.csdn.net/vrunsoftyanlz/article/details/78886068
++++Unity动画系统进阶:https://blog.csdn.net/vrunsoftyanlz/article/details/78886198
++++Navigation导航系统:https://blog.csdn.net/vrunsoftyanlz/article/details/78886281
++++Unity特效渲染:https://blog.csdn.net/vrunsoftyanlz/article/details/78886403
++++Unity数据存储:https://blog.csdn.net/vrunsoftyanlz/article/details/79251273
++++Unity中Sqlite数据库:https://blog.csdn.net/vrunsoftyanlz/article/details/79254162
++++WWW类和协程:https://blog.csdn.net/vrunsoftyanlz/article/details/79254559
++++Unity网络:https://blog.csdn.net/vrunsoftyanlz/article/details/79254902
++++Unity资源加密:https://blog.csdn.net/VRunSoftYanlz/article/details/87644514
++++PhotonServer简介:https://blog.csdn.net/VRunSoftYanlz/article/details/86652770
++++编写Photon游戏服务器:https://blog.csdn.net/VRunSoftYanlz/article/details/86682935
++++C#事件:https://blog.csdn.net/vrunsoftyanlz/article/details/78631267
++++C#委托:https://blog.csdn.net/vrunsoftyanlz/article/details/78631183
++++C#集合:https://blog.csdn.net/vrunsoftyanlz/article/details/78631175
++++C#泛型:https://blog.csdn.net/vrunsoftyanlz/article/details/78631141
++++C#接口:https://blog.csdn.net/vrunsoftyanlz/article/details/78631122
++++C#静态类:https://blog.csdn.net/vrunsoftyanlz/article/details/78630979
++++C#中System.String类:https://blog.csdn.net/vrunsoftyanlz/article/details/78630945
++++C#数据类型:https://blog.csdn.net/vrunsoftyanlz/article/details/78630913
++++Unity3D默认的快捷键:https://blog.csdn.net/vrunsoftyanlz/article/details/78630838
++++游戏相关缩写:https://blog.csdn.net/vrunsoftyanlz/article/details/78630687
++++UnityAPI.Rigidbody刚体:https://blog.csdn.net/VRunSoftYanlz/article/details/81784053
++++UnityAPI.Material材质:https://blog.csdn.net/VRunSoftYanlz/article/details/81814303
++++UnityAPI.Android安卓:https://blog.csdn.net/VRunSoftYanlz/article/details/81843193
++++UnityAPI.AndroidJNI安卓JNI:https://blog.csdn.net/VRunSoftYanlz/article/details/81879345
++++UnityAPI.Transform变换:https://blog.csdn.net/VRunSoftYanlz/article/details/81916293
++++UnityAPI.WheelCollider轮碰撞器:https://blog.csdn.net/VRunSoftYanlz/article/details/82356217
++++UnityAPI.Resources资源:https://blog.csdn.net/VRunSoftYanlz/article/details/83155518
++++JSON数据结构:https://blog.csdn.net/VRunSoftYanlz/article/details/82026644
++++CocosStudio快速入门:https://blog.csdn.net/VRunSoftYanlz/article/details/82356839
++++Unity企业内训(目录):https://blog.csdn.net/VRunSoftYanlz/article/details/82634668
++++Unity企业内训(第1讲):https://blog.csdn.net/VRunSoftYanlz/article/details/82634733
++++Unity企业内训(第2讲):https://blog.csdn.net/VRunSoftYanlz/article/details/82861180
++++Unity企业内训(第3讲):https://blog.csdn.net/VRunSoftYanlz/article/details/82927699
++++Unity企业内训(第4讲):https://blog.csdn.net/VRunSoftYanlz/article/details/83479776
++++Unity企业内训(第5讲):https://blog.csdn.net/VRunSoftYanlz/article/details/83963811
++++Unity企业内训(第6讲):https://blog.csdn.net/VRunSoftYanlz/article/details/84207696
++++钻哥带您了解产品原型:https://blog.csdn.net/VRunSoftYanlz/article/details/87303828
++++插件
++++计算机组成原理(教材篇):https://blog.csdn.net/VRunSoftYanlz/article/details/82719129
++++5G接入:云计算和雾计算:https://blog.csdn.net/VRunSoftYanlz/article/details/88372718
++++云计算通俗讲义:https://blog.csdn.net/VRunSoftYanlz/article/details/88652803
++++立钻哥哥Unity 学习空间: http://blog.csdn.net/VRunSoftYanlz
--_--VRunSoft:lovezuanzuan--_--