IceFrozen.shader 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. 
  2. Shader "Omm/IceFrozen"
  3. {
  4. Properties
  5. {
  6. _MainTex ("Base (RGB)", 2D) = "white" {}
  7. _AlphaTex ("Base (RGB)", 2D) = "white" {}
  8. _RandomTex ("Base (RGB)", 2D) = "white" {}
  9. _RimColor ("Rim Color", Color) = (1, 0, 0, 1)
  10. _Color("_Color", Color) = (0.5,0.5,0.5,1)
  11. _Rampage("_Rampage", Float) = 0
  12. _Frezz("_Frezz", Range(0, 1)) = 0
  13. }
  14. SubShader
  15. {
  16. Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  17. Pass
  18. {
  19. cull off
  20. Blend SrcAlpha OneMinusSrcAlpha
  21. CGPROGRAM
  22. // Upgrade NOTE: excluded shader from DX11 and Xbox360; has structs without semantics (struct v2f members pos1)
  23. // #pragma exclude_renderers d3d11 xbox360
  24. #pragma target 2.0
  25. #pragma vertex vert
  26. #pragma fragment frag
  27. #include "UnityCG.cginc"
  28. struct appdata
  29. {
  30. float4 vertex : POSITION;
  31. float3 normal : NORMAL;
  32. float2 texcoord : TEXCOORD0;
  33. };
  34. struct v2f
  35. {
  36. half4 pos : SV_POSITION;
  37. half2 uv : TEXCOORD0;
  38. fixed3 color : COLOR;
  39. };
  40. uniform fixed4 _RimColor;
  41. uniform fixed _Rampage;
  42. uniform fixed _Frezz;
  43. v2f vert(appdata_base v)
  44. {
  45. v2f o;
  46. o.pos = UnityObjectToClipPos(v.vertex);
  47. if (_Rampage == 1)
  48. {
  49. fixed3 viewDir = normalize(ObjSpaceViewDir(v.vertex));
  50. fixed dotProduct = 1 - dot(v.normal, viewDir);
  51. o.color = smoothstep(0, 1, dotProduct);
  52. o.color *= _RimColor;
  53. }
  54. float3 normal = mul(SCALED_NORMAL, (float3x3)unity_WorldToObject);
  55. fixed dotProduct = dot(normal, fixed3(0, 1, 0)) / 2;
  56. if (dotProduct <= 0)
  57. {
  58. dotProduct = 0;
  59. }
  60. o.color += dotProduct.xxx;
  61. o.uv = v.texcoord.xy;
  62. return o;
  63. }
  64. uniform sampler2D _MainTex;
  65. uniform sampler2D _AlphaTex;
  66. uniform sampler2D _RandomTex;
  67. uniform fixed4 _Color;
  68. fixed4 frag(v2f i) : COLOR
  69. {
  70. fixed4 texcol = tex2D(_MainTex, i.uv);
  71. fixed4 alpha = tex2D(_AlphaTex, i.uv);
  72. float ClipTex = tex2D(_RandomTex, i.uv).r;
  73. float ClipAmount = (_Frezz - ClipTex) / 2 + 0.5;
  74. if (ClipAmount < 0)
  75. {
  76. ClipAmount = 0;
  77. }
  78. if (ClipAmount > 1)
  79. {
  80. ClipAmount = 1;
  81. }
  82. if (_Rampage == 1)
  83. {
  84. texcol.rgb += i.color;
  85. }
  86. texcol = texcol * ClipAmount + alpha * (1 - ClipAmount);
  87. texcol.a = alpha.a;
  88. clip(texcol.a - 0.5);
  89. texcol *= _Color;
  90. return texcol;
  91. }
  92. ENDCG
  93. }
  94. }
  95. FallBack "Legacy Shaders/Transparent/Cutout/VertexLit"
  96. }