LiZi01.shader 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. // Shader created with Shader Forge v1.37
  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.37;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:True,dith:0,atcv:False,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:False,qofs:0,qpre:2,rntp:3,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,stcl: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:4013,x:33035,y:32715,varname:node_4013,prsc:2|diff-4199-OUT,emission-4199-OUT,clip-3423-A;n:type:ShaderForge.SFN_Color,id:1304,x:32387,y:32638,ptovrint:False,ptlb:Color,ptin:_Color,varname:node_1304,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:1,c2:1,c3:1,c4:1;n:type:ShaderForge.SFN_Tex2d,id:3423,x:32325,y:32833,ptovrint:False,ptlb:node_3423,ptin:_node_3423,varname:node_3423,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False|UVIN-123-UVOUT;n:type:ShaderForge.SFN_Multiply,id:4199,x:32663,y:32737,varname:node_4199,prsc:2|A-1304-RGB,B-3423-RGB;n:type:ShaderForge.SFN_TexCoord,id:129,x:31725,y:32688,varname:node_129,prsc:2,uv:0,uaff:False;n:type:ShaderForge.SFN_Panner,id:123,x:32086,y:32729,varname:node_123,prsc:2,spu:0,spv:0.01|UVIN-129-UVOUT,DIST-6203-OUT;n:type:ShaderForge.SFN_Slider,id:7551,x:31746,y:33139,ptovrint:False,ptlb:node_7551,ptin:_node_7551,varname:node_7551,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:1,max:1;n:type:ShaderForge.SFN_Slider,id:7419,x:31561,y:32996,ptovrint:False,ptlb:node_7419,ptin:_node_7419,varname:node_7419,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:12;n:type:ShaderForge.SFN_Time,id:8662,x:31702,y:32847,varname:node_8662,prsc:2;n:type:ShaderForge.SFN_Multiply,id:6203,x:31928,y:32867,varname:node_6203,prsc:2|A-8662-T,B-7419-OUT;proporder:1304-3423-7551-7419;pass:END;sub:END;*/
  5. Shader "Shader Forge/LiZi01" {
  6. Properties {
  7. _Color ("Color", Color) = (1,1,1,1)
  8. _node_3423 ("node_3423", 2D) = "white" {}
  9. _node_7551 ("node_7551", Range(0, 1)) = 1
  10. _node_7419 ("node_7419", Range(0, 12)) = 0
  11. [HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
  12. }
  13. SubShader {
  14. Tags {
  15. "Queue"="AlphaTest"
  16. "RenderType"="TransparentCutout"
  17. }
  18. Pass {
  19. Name "FORWARD"
  20. Tags {
  21. "LightMode"="ForwardBase"
  22. }
  23. Blend One One
  24. Cull Off
  25. CGPROGRAM
  26. #pragma vertex vert
  27. #pragma fragment frag
  28. #define UNITY_PASS_FORWARDBASE
  29. #include "UnityCG.cginc"
  30. #include "AutoLight.cginc"
  31. #pragma multi_compile_fwdbase_fullshadows
  32. #pragma multi_compile_fog
  33. #pragma only_renderers d3d9 d3d11 glcore gles gles3 metal d3d11_9x xboxone
  34. #pragma target 3.0
  35. uniform float4 _LightColor0;
  36. uniform float4 _TimeEditor;
  37. uniform float4 _Color;
  38. uniform sampler2D _node_3423; uniform float4 _node_3423_ST;
  39. uniform float _node_7419;
  40. struct VertexInput {
  41. float4 vertex : POSITION;
  42. float3 normal : NORMAL;
  43. float2 texcoord0 : TEXCOORD0;
  44. };
  45. struct VertexOutput {
  46. float4 pos : SV_POSITION;
  47. float2 uv0 : TEXCOORD0;
  48. float4 posWorld : TEXCOORD1;
  49. float3 normalDir : TEXCOORD2;
  50. LIGHTING_COORDS(3,4)
  51. UNITY_FOG_COORDS(5)
  52. };
  53. VertexOutput vert (VertexInput v) {
  54. VertexOutput o = (VertexOutput)0;
  55. o.uv0 = v.texcoord0;
  56. o.normalDir = UnityObjectToWorldNormal(v.normal);
  57. o.posWorld = mul(unity_ObjectToWorld, v.vertex);
  58. float3 lightColor = _LightColor0.rgb;
  59. o.pos = UnityObjectToClipPos( v.vertex );
  60. UNITY_TRANSFER_FOG(o,o.pos);
  61. TRANSFER_VERTEX_TO_FRAGMENT(o)
  62. return o;
  63. }
  64. float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
  65. float isFrontFace = ( facing >= 0 ? 1 : 0 );
  66. float faceSign = ( facing >= 0 ? 1 : -1 );
  67. i.normalDir = normalize(i.normalDir);
  68. i.normalDir *= faceSign;
  69. float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
  70. float3 normalDirection = i.normalDir;
  71. float4 node_8662 = _Time + _TimeEditor;
  72. float2 node_123 = (i.uv0+(node_8662.g*_node_7419)*float2(0,0.01));
  73. float4 _node_3423_var = tex2D(_node_3423,TRANSFORM_TEX(node_123, _node_3423));
  74. clip(_node_3423_var.a - 0.5);
  75. float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
  76. float3 lightColor = _LightColor0.rgb;
  77. ////// Lighting:
  78. float attenuation = LIGHT_ATTENUATION(i);
  79. float3 attenColor = attenuation * _LightColor0.xyz;
  80. /////// Diffuse:
  81. float NdotL = max(0.0,dot( normalDirection, lightDirection ));
  82. float3 directDiffuse = max( 0.0, NdotL) * attenColor;
  83. float3 indirectDiffuse = float3(0,0,0);
  84. indirectDiffuse += UNITY_LIGHTMODEL_AMBIENT.rgb; // Ambient Light
  85. float3 node_4199 = (_Color.rgb*_node_3423_var.rgb);
  86. float3 diffuseColor = node_4199;
  87. float3 diffuse = (directDiffuse + indirectDiffuse) * diffuseColor;
  88. ////// Emissive:
  89. float3 emissive = node_4199;
  90. /// Final Color:
  91. float3 finalColor = diffuse + emissive;
  92. fixed4 finalRGBA = fixed4(finalColor,1);
  93. UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
  94. return finalRGBA;
  95. }
  96. ENDCG
  97. }
  98. Pass {
  99. Name "FORWARD_DELTA"
  100. Tags {
  101. "LightMode"="ForwardAdd"
  102. }
  103. Blend One One
  104. Cull Off
  105. CGPROGRAM
  106. #pragma vertex vert
  107. #pragma fragment frag
  108. #define UNITY_PASS_FORWARDADD
  109. #include "UnityCG.cginc"
  110. #include "AutoLight.cginc"
  111. #pragma multi_compile_fwdadd_fullshadows
  112. #pragma multi_compile_fog
  113. #pragma only_renderers d3d9 d3d11 glcore gles gles3 metal d3d11_9x xboxone
  114. #pragma target 3.0
  115. uniform float4 _LightColor0;
  116. uniform float4 _TimeEditor;
  117. uniform float4 _Color;
  118. uniform sampler2D _node_3423; uniform float4 _node_3423_ST;
  119. uniform float _node_7419;
  120. struct VertexInput {
  121. float4 vertex : POSITION;
  122. float3 normal : NORMAL;
  123. float2 texcoord0 : TEXCOORD0;
  124. };
  125. struct VertexOutput {
  126. float4 pos : SV_POSITION;
  127. float2 uv0 : TEXCOORD0;
  128. float4 posWorld : TEXCOORD1;
  129. float3 normalDir : TEXCOORD2;
  130. LIGHTING_COORDS(3,4)
  131. UNITY_FOG_COORDS(5)
  132. };
  133. VertexOutput vert (VertexInput v) {
  134. VertexOutput o = (VertexOutput)0;
  135. o.uv0 = v.texcoord0;
  136. o.normalDir = UnityObjectToWorldNormal(v.normal);
  137. o.posWorld = mul(unity_ObjectToWorld, v.vertex);
  138. float3 lightColor = _LightColor0.rgb;
  139. o.pos = UnityObjectToClipPos( v.vertex );
  140. UNITY_TRANSFER_FOG(o,o.pos);
  141. TRANSFER_VERTEX_TO_FRAGMENT(o)
  142. return o;
  143. }
  144. float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
  145. float isFrontFace = ( facing >= 0 ? 1 : 0 );
  146. float faceSign = ( facing >= 0 ? 1 : -1 );
  147. i.normalDir = normalize(i.normalDir);
  148. i.normalDir *= faceSign;
  149. float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
  150. float3 normalDirection = i.normalDir;
  151. float4 node_8662 = _Time + _TimeEditor;
  152. float2 node_123 = (i.uv0+(node_8662.g*_node_7419)*float2(0,0.01));
  153. float4 _node_3423_var = tex2D(_node_3423,TRANSFORM_TEX(node_123, _node_3423));
  154. clip(_node_3423_var.a - 0.5);
  155. float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
  156. float3 lightColor = _LightColor0.rgb;
  157. ////// Lighting:
  158. float attenuation = LIGHT_ATTENUATION(i);
  159. float3 attenColor = attenuation * _LightColor0.xyz;
  160. /////// Diffuse:
  161. float NdotL = max(0.0,dot( normalDirection, lightDirection ));
  162. float3 directDiffuse = max( 0.0, NdotL) * attenColor;
  163. float3 node_4199 = (_Color.rgb*_node_3423_var.rgb);
  164. float3 diffuseColor = node_4199;
  165. float3 diffuse = directDiffuse * diffuseColor;
  166. /// Final Color:
  167. float3 finalColor = diffuse;
  168. fixed4 finalRGBA = fixed4(finalColor * 1,0);
  169. UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
  170. return finalRGBA;
  171. }
  172. ENDCG
  173. }
  174. Pass {
  175. Name "ShadowCaster"
  176. Tags {
  177. "LightMode"="ShadowCaster"
  178. }
  179. Offset 1, 1
  180. Cull Off
  181. CGPROGRAM
  182. #pragma vertex vert
  183. #pragma fragment frag
  184. #define UNITY_PASS_SHADOWCASTER
  185. #include "UnityCG.cginc"
  186. #include "Lighting.cginc"
  187. #pragma fragmentoption ARB_precision_hint_fastest
  188. #pragma multi_compile_shadowcaster
  189. #pragma multi_compile_fog
  190. #pragma only_renderers d3d9 d3d11 glcore gles gles3 metal d3d11_9x xboxone
  191. #pragma target 3.0
  192. uniform float4 _TimeEditor;
  193. uniform sampler2D _node_3423; uniform float4 _node_3423_ST;
  194. uniform float _node_7419;
  195. struct VertexInput {
  196. float4 vertex : POSITION;
  197. float2 texcoord0 : TEXCOORD0;
  198. };
  199. struct VertexOutput {
  200. V2F_SHADOW_CASTER;
  201. float2 uv0 : TEXCOORD1;
  202. };
  203. VertexOutput vert (VertexInput v) {
  204. VertexOutput o = (VertexOutput)0;
  205. o.uv0 = v.texcoord0;
  206. o.pos = UnityObjectToClipPos( v.vertex );
  207. TRANSFER_SHADOW_CASTER(o)
  208. return o;
  209. }
  210. float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
  211. float isFrontFace = ( facing >= 0 ? 1 : 0 );
  212. float faceSign = ( facing >= 0 ? 1 : -1 );
  213. float4 node_8662 = _Time + _TimeEditor;
  214. float2 node_123 = (i.uv0+(node_8662.g*_node_7419)*float2(0,0.01));
  215. float4 _node_3423_var = tex2D(_node_3423,TRANSFORM_TEX(node_123, _node_3423));
  216. clip(_node_3423_var.a - 0.5);
  217. SHADOW_CASTER_FRAGMENT(i)
  218. }
  219. ENDCG
  220. }
  221. }
  222. FallBack "Diffuse"
  223. CustomEditor "ShaderForgeMaterialInspector"
  224. }