BossChange.shader 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
  2. Shader "M/CharacterChange"
  3. {
  4. Properties
  5. {
  6. _Tex("_Tex", 2D) = "black" {}
  7. _Speed("_Speed", Float) = 2
  8. _ColorFresnel("_ColorFresnel", Color) = (1,1,1,1)
  9. _DistValue("_DistValue", Float) = 0
  10. _TexTil("_TexTil", Vector) = (2,1,0,0)
  11. _Diffuse("_Diffuse", 2D) = "black" {}
  12. }
  13. SubShader
  14. {
  15. Tags
  16. {
  17. "Queue"="Geometry"
  18. "IgnoreProjector"="False"
  19. "RenderType"="Opaque"
  20. }
  21. Cull Back
  22. ZWrite On
  23. ZTest LEqual
  24. ColorMask RGBA
  25. Fog{
  26. }
  27. CGPROGRAM
  28. #pragma surface surf BlinnPhongEditor vertex:vert
  29. #pragma target 2.0
  30. sampler2D _Tex;
  31. float _Speed;
  32. float4 _ColorFresnel;
  33. float _DistValue;
  34. float4 _TexTil;
  35. sampler2D _Diffuse;
  36. struct EditorSurfaceOutput {
  37. half3 Albedo;
  38. half3 Normal;
  39. half3 Emission;
  40. half3 Gloss;
  41. half Specular;
  42. half Alpha;
  43. half4 Custom;
  44. };
  45. inline half4 LightingBlinnPhongEditor_PrePass (EditorSurfaceOutput s, half4 light)
  46. {
  47. half3 spec = light.a * s.Gloss;
  48. half4 c;
  49. c.rgb = (s.Albedo * light.rgb + light.rgb * spec);
  50. c.a = s.Alpha;
  51. return c;
  52. }
  53. inline half4 LightingBlinnPhongEditor (EditorSurfaceOutput s, half3 lightDir, half3 viewDir, half atten)
  54. {
  55. half3 h = normalize (lightDir + viewDir);
  56. half diff = max (0, dot ( lightDir, s.Normal ));
  57. float nh = max (0, dot (s.Normal, h));
  58. float spec = pow (nh, s.Specular*128.0);
  59. half4 res;
  60. res.rgb = _LightColor0.rgb * diff;
  61. res.w = spec * Luminance (_LightColor0.rgb);
  62. res *= atten * 2.0;
  63. return LightingBlinnPhongEditor_PrePass( s, res );
  64. }
  65. struct Input {
  66. float2 uv_Diffuse;
  67. float4 screenPos;
  68. float3 viewDir;
  69. float3 sWorldNormal;
  70. };
  71. void vert (inout appdata_full v, out Input o) {
  72. UNITY_INITIALIZE_OUTPUT(Input,o);
  73. float4 VertexOutputMaster0_0_NoInput = float4(0,0,0,0);
  74. float4 VertexOutputMaster0_1_NoInput = float4(0,0,0,0);
  75. float4 VertexOutputMaster0_2_NoInput = float4(0,0,0,0);
  76. float4 VertexOutputMaster0_3_NoInput = float4(0,0,0,0);
  77. o.sWorldNormal = mul((float3x3)unity_ObjectToWorld, SCALED_NORMAL);
  78. }
  79. void surf (Input IN, inout EditorSurfaceOutput o) {
  80. o.Normal = float3(0.0,0.0,1.0);
  81. o.Alpha = 1.0;
  82. o.Albedo = 0.0;
  83. o.Emission = 0.0;
  84. o.Gloss = 0.0;
  85. o.Specular = 0.0;
  86. o.Custom = 0.0;
  87. float4 Tex2D2=tex2D(_Diffuse,(IN.uv_Diffuse.xyxy).xy);
  88. float4 Multiply3=((IN.screenPos.xy/IN.screenPos.w).xyxy) * _TexTil;
  89. float4 Multiply2=_Time * _Speed.xxxx;
  90. float4 UV_Pan0=float4(Multiply3.x,Multiply3.y + Multiply2.x,Multiply3.z,Multiply3.w);
  91. float4 Tex2D1=tex2D(_Tex,((IN.screenPos.xy/IN.screenPos.w).xyxy).xy);
  92. float4 Add1=Tex2D1.aaaa + float4( -0.5,-0.5,-0.5,-0.5 );
  93. float4 Multiply0=Add1 * float4( 2,2,2,2 );
  94. float4 Multiply1=Multiply0 * _DistValue.xxxx;
  95. float4 Add0=UV_Pan0 + Multiply1;
  96. float4 Tex2D0=tex2D(_Tex,Add0.xy);
  97. float4 Multiply4=_ColorFresnel * Tex2D0;
  98. float4 Fresnel0=(1.0 - dot( normalize( float4( IN.viewDir.x, IN.viewDir.y,IN.viewDir.z,1.0 ).xyz), normalize( float4( IN.sWorldNormal.x, IN.sWorldNormal.y,IN.sWorldNormal.z,1.0 ).xyz ) )).xxxx;
  99. float4 Lerp0=lerp(Tex2D2,Multiply4,Fresnel0);
  100. float4 Master0_0_NoInput = float4(0,0,0,0);
  101. float4 Master0_1_NoInput = float4(0,0,1,1);
  102. float4 Master0_3_NoInput = float4(0,0,0,0);
  103. float4 Master0_4_NoInput = float4(0,0,0,0);
  104. float4 Master0_5_NoInput = float4(1,1,1,1);
  105. float4 Master0_7_NoInput = float4(0,0,0,0);
  106. float4 Master0_6_NoInput = float4(1,1,1,1);
  107. o.Emission = Lerp0;
  108. o.Normal = normalize(o.Normal);
  109. }
  110. ENDCG
  111. }
  112. Fallback "Diffuse"
  113. }