MagicCoverAdd.shader 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. // Shader created with Shader Forge v1.38
  2. // Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
  3. // Note: Manually altering this data may prevent you from opening it in Shader Forge
  4. /*SF_DATA;ver:1.38;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,cgin:,lico:1,lgpr:1,limd:1,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,imps:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:2,bsrc:0,bdst:0,dpts:2,wrdp:False,dith:0,atcv:False,rfrpo:True,rfrpn:Refraction,coma:15,ufog:False,aust:True,igpj:True,qofs:0,qpre:3,rntp:2,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.2089552,fgcg:0.2089552,fgcb:0.2089552,fgca:1,fgde:0.005,fgrn:0,fgrf:2000,stcl:False,atwp:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False,fsmp:False;n:type:ShaderForge.SFN_Final,id:2432,x:33174,y:33389,varname:node_2432,prsc:2|spec-8291-OUT,gloss-2843-OUT,emission-4105-OUT;n:type:ShaderForge.SFN_Fresnel,id:870,x:31809,y:34162,varname:node_870,prsc:2|EXP-4721-OUT;n:type:ShaderForge.SFN_Multiply,id:7162,x:32319,y:34066,varname:node_7162,prsc:2|A-2547-RGB,B-870-OUT,C-4999-OUT;n:type:ShaderForge.SFN_Color,id:2547,x:31809,y:33998,ptovrint:False,ptlb:Fresnel_Color,ptin:_Fresnel_Color,varname:node_2547,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.4882137,c2:0.6204242,c3:0.6323529,c4:1;n:type:ShaderForge.SFN_Tex2d,id:5840,x:31809,y:33420,ptovrint:False,ptlb:LiangBian,ptin:_LiangBian,varname:node_5840,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:b41226c8f8703264492ad35ed04087aa,ntxv:0,isnm:False|UVIN-9058-OUT;n:type:ShaderForge.SFN_Panner,id:1198,x:30880,y:33699,varname:node_1198,prsc:2,spu:0,spv:1|UVIN-8670-UVOUT,DIST-8321-OUT;n:type:ShaderForge.SFN_Time,id:2859,x:30210,y:33579,varname:node_2859,prsc:2;n:type:ShaderForge.SFN_Multiply,id:7673,x:30435,y:33712,varname:node_7673,prsc:2|A-2859-T,B-4849-OUT;n:type:ShaderForge.SFN_RemapRange,id:8321,x:30654,y:33712,varname:node_8321,prsc:2,frmn:0,frmx:1,tomn:-1,tomx:1|IN-7673-OUT;n:type:ShaderForge.SFN_TexCoord,id:8670,x:30654,y:33568,varname:node_8670,prsc:2,uv:0,uaff:False;n:type:ShaderForge.SFN_TexCoord,id:639,x:30880,y:33264,varname:node_639,prsc:2,uv:0,uaff:False;n:type:ShaderForge.SFN_Add,id:9058,x:31578,y:33567,varname:node_9058,prsc:2|A-9780-UVOUT,B-7512-OUT;n:type:ShaderForge.SFN_Tex2d,id:327,x:31178,y:33702,ptovrint:False,ptlb:WenLi,ptin:_WenLi,varname:node_327,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:36d868b8507e91c41ac90186b80d2265,ntxv:0,isnm:False|UVIN-1198-UVOUT;n:type:ShaderForge.SFN_Multiply,id:7512,x:31388,y:33685,varname:node_7512,prsc:2|A-327-R,B-1808-OUT;n:type:ShaderForge.SFN_Panner,id:9780,x:31388,y:33445,varname:node_9780,prsc:2,spu:1,spv:1|UVIN-639-UVOUT,DIST-947-OUT;n:type:ShaderForge.SFN_Multiply,id:2320,x:30654,y:33436,varname:node_2320,prsc:2|A-2859-T,B-1357-OUT;n:type:ShaderForge.SFN_RemapRange,id:947,x:30880,y:33436,varname:node_947,prsc:2,frmn:0,frmx:1,tomn:2,tomx:1|IN-2320-OUT;n:type:ShaderForge.SFN_Add,id:2348,x:32657,y:33496,varname:node_2348,prsc:2|A-314-OUT,B-7162-OUT;n:type:ShaderForge.SFN_Multiply,id:7099,x:32036,y:33395,varname:node_7099,prsc:2|A-3643-OUT,B-5840-RGB,C-8416-RGB;n:type:ShaderForge.SFN_Color,id:6741,x:31626,y:33127,ptovrint:False,ptlb:LB_Color,ptin:_LB_Color,varname:node_6741,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.7205882,c2:0.8728195,c3:1,c4:1;n:type:ShaderForge.SFN_Tex2d,id:8416,x:31809,y:33611,ptovrint:False,ptlb:TuoWei,ptin:_TuoWei,varname:node_8416,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:979bf89439b012441bfcf63ba98be444,ntxv:0,isnm:False|UVIN-9058-OUT;n:type:ShaderForge.SFN_Add,id:314,x:32302,y:33501,varname:node_314,prsc:2|A-7099-OUT,B-1841-OUT;n:type:ShaderForge.SFN_Multiply,id:1841,x:32032,y:33760,varname:node_1841,prsc:2|A-8416-RGB,B-2010-OUT;n:type:ShaderForge.SFN_Color,id:798,x:31571,y:33760,ptovrint:False,ptlb:TW_Color,ptin:_TW_Color,varname:node_798,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.6764706,c2:0.8929007,c3:1,c4:1;n:type:ShaderForge.SFN_ValueProperty,id:4721,x:31618,y:34196,ptovrint:False,ptlb:Fresnel_Val,ptin:_Fresnel_Val,varname:node_4721,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:3;n:type:ShaderForge.SFN_ValueProperty,id:1808,x:31178,y:33917,ptovrint:False,ptlb:WenLi_qiangdu,ptin:_WenLi_qiangdu,varname:node_1808,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0.1;n:type:ShaderForge.SFN_ValueProperty,id:4849,x:30220,y:33746,ptovrint:False,ptlb:WenLi_yundong,ptin:_WenLi_yundong,varname:node_4849,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0.05;n:type:ShaderForge.SFN_ValueProperty,id:1357,x:30435,y:33612,ptovrint:False,ptlb:LB/TW_yundong,ptin:_LBTW_yundong,varname:node_1357,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0.3;n:type:ShaderForge.SFN_Color,id:4430,x:32658,y:33160,ptovrint:False,ptlb:GaoGuang_Color,ptin:_GaoGuang_Color,varname:node_4430,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.3088235,c2:0.7711966,c3:1,c4:1;n:type:ShaderForge.SFN_Multiply,id:8291,x:32884,y:33244,varname:node_8291,prsc:2|A-4430-RGB,B-2086-OUT;n:type:ShaderForge.SFN_ValueProperty,id:2086,x:32658,y:33334,ptovrint:False,ptlb:GaoGuang_qiangdu,ptin:_GaoGuang_qiangdu,varname:node_2086,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0.1;n:type:ShaderForge.SFN_ValueProperty,id:2843,x:32658,y:33423,ptovrint:False,ptlb:GaoGuangFanWei,ptin:_GaoGuangFanWei,varname:node_2843,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:0.5;n:type:ShaderForge.SFN_Tex2d,id:9190,x:32657,y:33664,ptovrint:False,ptlb:Mask,ptin:_Mask,varname:node_9190,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:4f10ce2aba63c4f4bb49937209e1cf03,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Multiply,id:4105,x:32878,y:33570,varname:node_4105,prsc:2|A-2348-OUT,B-9190-A;n:type:ShaderForge.SFN_Multiply,id:3643,x:31809,y:33219,varname:node_3643,prsc:2|A-6741-RGB,B-1595-OUT;n:type:ShaderForge.SFN_ValueProperty,id:1595,x:31626,y:33343,ptovrint:False,ptlb:LB_ColorVal,ptin:_LB_ColorVal,varname:node_1595,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:1;n:type:ShaderForge.SFN_Multiply,id:2010,x:31809,y:33830,varname:node_2010,prsc:2|A-798-RGB,B-6612-OUT;n:type:ShaderForge.SFN_ValueProperty,id:6612,x:31571,y:33939,ptovrint:False,ptlb:TW_ColorVal,ptin:_TW_ColorVal,varname:node_6612,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:1;n:type:ShaderForge.SFN_ValueProperty,id:4999,x:31809,y:34322,ptovrint:False,ptlb:FresnelColorVal,ptin:_FresnelColorVal,varname:node_4999,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:1;proporder:6741-1595-5840-798-6612-8416-1357-327-4849-1808-2547-4999-4721-4430-2086-2843-9190;pass:END;sub:END;*/
  5. Shader "effect/MagicCoverAdd" {
  6. Properties {
  7. _LB_Color ("LB_Color", Color) = (0.7205882,0.8728195,1,1)
  8. _LB_ColorVal ("LB_ColorVal", Float ) = 1
  9. _LiangBian ("LiangBian", 2D) = "white" {}
  10. _TW_Color ("TW_Color", Color) = (0.6764706,0.8929007,1,1)
  11. _TW_ColorVal ("TW_ColorVal", Float ) = 1
  12. _TuoWei ("TuoWei", 2D) = "white" {}
  13. _LBTW_yundong ("LB/TW_yundong", Float ) = 0.3
  14. _WenLi ("WenLi", 2D) = "white" {}
  15. _WenLi_yundong ("WenLi_yundong", Float ) = 0.05
  16. _WenLi_qiangdu ("WenLi_qiangdu", Float ) = 0.1
  17. _Fresnel_Color ("Fresnel_Color", Color) = (0.4882137,0.6204242,0.6323529,1)
  18. _FresnelColorVal ("FresnelColorVal", Float ) = 1
  19. _Fresnel_Val ("Fresnel_Val", Float ) = 3
  20. _GaoGuang_Color ("GaoGuang_Color", Color) = (0.3088235,0.7711966,1,1)
  21. _GaoGuang_qiangdu ("GaoGuang_qiangdu", Float ) = 0.1
  22. _GaoGuangFanWei ("GaoGuangFanWei", Float ) = 0.5
  23. _Mask ("Mask", 2D) = "white" {}
  24. }
  25. SubShader {
  26. Tags {
  27. "IgnoreProjector"="True"
  28. "Queue"="Transparent"
  29. "RenderType"="Transparent"
  30. }
  31. LOD 200
  32. Pass {
  33. Name "FORWARD"
  34. Tags {
  35. "LightMode"="ForwardBase"
  36. }
  37. Blend One One
  38. Cull Off
  39. ZWrite Off
  40. CGPROGRAM
  41. #pragma vertex vert
  42. #pragma fragment frag
  43. #define UNITY_PASS_FORWARDBASE
  44. #include "UnityCG.cginc"
  45. #pragma multi_compile_fwdbase
  46. #pragma only_renderers d3d9 d3d11 glcore gles gles3 metal d3d11_9x xboxone ps4 psp2 n3ds wiiu
  47. #pragma target 3.0
  48. uniform float4 _LightColor0;
  49. uniform float4 _Fresnel_Color;
  50. uniform sampler2D _LiangBian; uniform float4 _LiangBian_ST;
  51. uniform sampler2D _WenLi; uniform float4 _WenLi_ST;
  52. uniform float4 _LB_Color;
  53. uniform sampler2D _TuoWei; uniform float4 _TuoWei_ST;
  54. uniform float4 _TW_Color;
  55. uniform float _Fresnel_Val;
  56. uniform float _WenLi_qiangdu;
  57. uniform float _WenLi_yundong;
  58. uniform float _LBTW_yundong;
  59. uniform float4 _GaoGuang_Color;
  60. uniform float _GaoGuang_qiangdu;
  61. uniform float _GaoGuangFanWei;
  62. uniform sampler2D _Mask; uniform float4 _Mask_ST;
  63. uniform float _LB_ColorVal;
  64. uniform float _TW_ColorVal;
  65. uniform float _FresnelColorVal;
  66. struct VertexInput {
  67. float4 vertex : POSITION;
  68. float3 normal : NORMAL;
  69. float2 texcoord0 : TEXCOORD0;
  70. };
  71. struct VertexOutput {
  72. float4 pos : SV_POSITION;
  73. float2 uv0 : TEXCOORD0;
  74. float4 posWorld : TEXCOORD1;
  75. float3 normalDir : TEXCOORD2;
  76. };
  77. VertexOutput vert (VertexInput v) {
  78. VertexOutput o = (VertexOutput)0;
  79. o.uv0 = v.texcoord0;
  80. o.normalDir = UnityObjectToWorldNormal(v.normal);
  81. o.posWorld = mul(unity_ObjectToWorld, v.vertex);
  82. float3 lightColor = _LightColor0.rgb;
  83. o.pos = UnityObjectToClipPos( v.vertex );
  84. return o;
  85. }
  86. float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
  87. float isFrontFace = ( facing >= 0 ? 1 : 0 );
  88. float faceSign = ( facing >= 0 ? 1 : -1 );
  89. i.normalDir = normalize(i.normalDir);
  90. i.normalDir *= faceSign;
  91. float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
  92. float3 normalDirection = i.normalDir;
  93. float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
  94. float3 lightColor = _LightColor0.rgb;
  95. float3 halfDirection = normalize(viewDirection+lightDirection);
  96. ////// Lighting:
  97. float attenuation = 1;
  98. float3 attenColor = attenuation * _LightColor0.xyz;
  99. ///////// Gloss:
  100. float gloss = _GaoGuangFanWei;
  101. float specPow = exp2( gloss * 10.0 + 1.0 );
  102. ////// Specular:
  103. float NdotL = saturate(dot( normalDirection, lightDirection ));
  104. float3 specularColor = (_GaoGuang_Color.rgb*_GaoGuang_qiangdu);
  105. float3 directSpecular = attenColor * pow(max(0,dot(halfDirection,normalDirection)),specPow)*specularColor;
  106. float3 specular = directSpecular;
  107. ////// Emissive:
  108. float4 node_2859 = _Time;
  109. float2 node_1198 = (i.uv0+((node_2859.g*_WenLi_yundong)*2.0+-1.0)*float2(0,1));
  110. float4 _WenLi_var = tex2D(_WenLi,TRANSFORM_TEX(node_1198, _WenLi));
  111. float2 node_9058 = ((i.uv0+((node_2859.g*_LBTW_yundong)*-1.0+2.0)*float2(1,1))+(_WenLi_var.r*_WenLi_qiangdu));
  112. float4 _LiangBian_var = tex2D(_LiangBian,TRANSFORM_TEX(node_9058, _LiangBian));
  113. float4 _TuoWei_var = tex2D(_TuoWei,TRANSFORM_TEX(node_9058, _TuoWei));
  114. float node_870 = pow(1.0-max(0,dot(normalDirection, viewDirection)),_Fresnel_Val);
  115. float4 _Mask_var = tex2D(_Mask,TRANSFORM_TEX(i.uv0, _Mask));
  116. float3 emissive = (((((_LB_Color.rgb*_LB_ColorVal)*_LiangBian_var.rgb*_TuoWei_var.rgb)+(_TuoWei_var.rgb*(_TW_Color.rgb*_TW_ColorVal)))+(_Fresnel_Color.rgb*node_870*_FresnelColorVal))*_Mask_var.a);
  117. /// Final Color:
  118. float3 finalColor = specular + emissive;
  119. return fixed4(finalColor,1);
  120. }
  121. ENDCG
  122. }
  123. Pass {
  124. Name "FORWARD_DELTA"
  125. Tags {
  126. "LightMode"="ForwardAdd"
  127. }
  128. Blend One One
  129. Cull Off
  130. ZWrite Off
  131. CGPROGRAM
  132. #pragma vertex vert
  133. #pragma fragment frag
  134. #define UNITY_PASS_FORWARDADD
  135. #include "UnityCG.cginc"
  136. #include "AutoLight.cginc"
  137. #pragma multi_compile_fwdadd
  138. #pragma only_renderers d3d9 d3d11 glcore gles gles3 metal d3d11_9x xboxone ps4 psp2 n3ds wiiu
  139. #pragma target 3.0
  140. uniform float4 _LightColor0;
  141. uniform float4 _Fresnel_Color;
  142. uniform sampler2D _LiangBian; uniform float4 _LiangBian_ST;
  143. uniform sampler2D _WenLi; uniform float4 _WenLi_ST;
  144. uniform float4 _LB_Color;
  145. uniform sampler2D _TuoWei; uniform float4 _TuoWei_ST;
  146. uniform float4 _TW_Color;
  147. uniform float _Fresnel_Val;
  148. uniform float _WenLi_qiangdu;
  149. uniform float _WenLi_yundong;
  150. uniform float _LBTW_yundong;
  151. uniform float4 _GaoGuang_Color;
  152. uniform float _GaoGuang_qiangdu;
  153. uniform float _GaoGuangFanWei;
  154. uniform sampler2D _Mask; uniform float4 _Mask_ST;
  155. uniform float _LB_ColorVal;
  156. uniform float _TW_ColorVal;
  157. uniform float _FresnelColorVal;
  158. struct VertexInput {
  159. float4 vertex : POSITION;
  160. float3 normal : NORMAL;
  161. float2 texcoord0 : TEXCOORD0;
  162. };
  163. struct VertexOutput {
  164. float4 pos : SV_POSITION;
  165. float2 uv0 : TEXCOORD0;
  166. float4 posWorld : TEXCOORD1;
  167. float3 normalDir : TEXCOORD2;
  168. LIGHTING_COORDS(3,4)
  169. };
  170. VertexOutput vert (VertexInput v) {
  171. VertexOutput o = (VertexOutput)0;
  172. o.uv0 = v.texcoord0;
  173. o.normalDir = UnityObjectToWorldNormal(v.normal);
  174. o.posWorld = mul(unity_ObjectToWorld, v.vertex);
  175. float3 lightColor = _LightColor0.rgb;
  176. o.pos = UnityObjectToClipPos( v.vertex );
  177. TRANSFER_VERTEX_TO_FRAGMENT(o)
  178. return o;
  179. }
  180. float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
  181. float isFrontFace = ( facing >= 0 ? 1 : 0 );
  182. float faceSign = ( facing >= 0 ? 1 : -1 );
  183. i.normalDir = normalize(i.normalDir);
  184. i.normalDir *= faceSign;
  185. float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
  186. float3 normalDirection = i.normalDir;
  187. float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
  188. float3 lightColor = _LightColor0.rgb;
  189. float3 halfDirection = normalize(viewDirection+lightDirection);
  190. ////// Lighting:
  191. float attenuation = LIGHT_ATTENUATION(i);
  192. float3 attenColor = attenuation * _LightColor0.xyz;
  193. ///////// Gloss:
  194. float gloss = _GaoGuangFanWei;
  195. float specPow = exp2( gloss * 10.0 + 1.0 );
  196. ////// Specular:
  197. float NdotL = saturate(dot( normalDirection, lightDirection ));
  198. float3 specularColor = (_GaoGuang_Color.rgb*_GaoGuang_qiangdu);
  199. float3 directSpecular = attenColor * pow(max(0,dot(halfDirection,normalDirection)),specPow)*specularColor;
  200. float3 specular = directSpecular;
  201. /// Final Color:
  202. float3 finalColor = specular;
  203. return fixed4(finalColor * 1,0);
  204. }
  205. ENDCG
  206. }
  207. Pass {
  208. Name "ShadowCaster"
  209. Tags {
  210. "LightMode"="ShadowCaster"
  211. }
  212. Offset 1, 1
  213. Cull Off
  214. CGPROGRAM
  215. #pragma vertex vert
  216. #pragma fragment frag
  217. #define UNITY_PASS_SHADOWCASTER
  218. #include "UnityCG.cginc"
  219. #include "Lighting.cginc"
  220. #pragma fragmentoption ARB_precision_hint_fastest
  221. #pragma multi_compile_shadowcaster
  222. #pragma only_renderers d3d9 d3d11 glcore gles gles3 metal d3d11_9x xboxone ps4 psp2 n3ds wiiu
  223. #pragma target 3.0
  224. struct VertexInput {
  225. float4 vertex : POSITION;
  226. };
  227. struct VertexOutput {
  228. V2F_SHADOW_CASTER;
  229. };
  230. VertexOutput vert (VertexInput v) {
  231. VertexOutput o = (VertexOutput)0;
  232. o.pos = UnityObjectToClipPos( v.vertex );
  233. TRANSFER_SHADOW_CASTER(o)
  234. return o;
  235. }
  236. float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
  237. float isFrontFace = ( facing >= 0 ? 1 : 0 );
  238. float faceSign = ( facing >= 0 ? 1 : -1 );
  239. SHADOW_CASTER_FRAGMENT(i)
  240. }
  241. ENDCG
  242. }
  243. }
  244. FallBack "Diffuse"
  245. CustomEditor "ShaderForgeMaterialInspector"
  246. }