Fixed function shader
设置单纯颜色的Shader
Shader "Custom/NewShader" { //属性 Properties { //定义颜色 _Color("Main Color",Color) = (0,0,0,0) } SubShader { Pass{ Material{ Diffuse[_Color] } //光照开关,On打开Off关闭 Lighting On } } }
颜色可以自行调整
设置材质的shader
Shader "Custom/NewShader" { //属性 Properties { //定义材质 _MainTex("Base(RGB)",2D)="white"{} //定义颜色 _Color("Main Color",Color) = (0,0,0,0) } SubShader { Pass{ Material{ Diffuse[_Color] } //光照开关,On打开Off关闭 Lighting On //设置材质 SetTexture[_MainTex] { Combine texture *primary//,texture*constant } } } }


设置两张材质的shader
Shader "Custom/NewShader" { //属性 Properties { //定义材质 _MainTex("Base(RGB)",2D)="white"{} //定义第二张材质 _MainTex2("Tex(RGB)",2D) = "white"{} //定义颜色 _Color("Main Color",Color) = (0,0,0,1) } SubShader { Pass{ Material{ Diffuse[_Color] } //光照开关,On打开Off关闭 Lighting On //设置材质 SetTexture[_MainTex] { Combine texture *primary,texture*constant } SetTexture[_MainTex2] { Combine texture*previous } } } }


设置顶点所有光照属性
Shader "Custom/NewShader" { //属性 Properties { _IlluminCol("Self-Illumination color (RGB)",Color) = (1,1,1,1) //定义材质 _MainTex("Base(RGB)",2D)="white"{} //定义第二张材质 _MainTex2("Tex(RGB)",2D) = "white"{} //定义颜色 _Color("Main Color",Color) = (0,0,0,1) //定义规格颜色 _SpecColor("Spec Color",Color) = (0,0,0,0) //定义光泽 _Shininess("Shininess",Range(0.01,1)) = 0.7 //定义发射光 _Emission("Emmisive Color",Color) = (0,0,0,0) } SubShader { Pass{ Material{ Diffuse[_Color] Ambient[_Color] Shininess[_Shininess] Specular[_SpecColor] Emission[_Emission] } //光照开关,On打开Off关闭 Lighting On //设置材质 SetTexture[_MainTex] { constantColor[_IlluminCol] Combine constant lerp(texture) previous //Combine texture *primary,texture*constant } SetTexture[_MainTex2] { Combine texture*previous } } } }



浙公网安备 33010602011771号