SHTranslucent.shader 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "Camera/Translucent"
  3. {
  4. Properties
  5. {
  6. _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
  7. _MainTex ("Particle Texture", 2D) = "white" {}
  8. _InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
  9. }
  10. Category
  11. {
  12. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
  13. Blend SrcAlpha OneMinusSrcAlpha
  14. AlphaTest Greater .01
  15. ColorMask RGB
  16. Cull Off Lighting Off ZWrite Off
  17. BindChannels
  18. {
  19. Bind "Color", color
  20. Bind "Vertex", vertex
  21. Bind "TexCoord", texcoord
  22. }
  23. // ---- Fragment program cards
  24. SubShader
  25. {
  26. Pass
  27. {
  28. CGPROGRAM
  29. #pragma vertex vert
  30. #pragma fragment frag
  31. #pragma fragmentoption ARB_precision_hint_fastest
  32. #pragma multi_compile_particles
  33. #include "UnityCG.cginc"
  34. sampler2D _MainTex;
  35. fixed4 _TintColor;
  36. struct appdata_t
  37. {
  38. float4 vertex : POSITION;
  39. fixed4 color : COLOR;
  40. float2 texcoord : TEXCOORD0;
  41. };
  42. struct v2f
  43. {
  44. float4 vertex : POSITION;
  45. fixed4 color : COLOR;
  46. float2 texcoord : TEXCOORD0;
  47. #ifdef SOFTPARTICLES_ON
  48. float4 projPos : TEXCOORD1;
  49. #endif
  50. };
  51. float4 _MainTex_ST;
  52. v2f vert (appdata_t v)
  53. {
  54. v2f o;
  55. o.vertex = UnityObjectToClipPos(v.vertex);
  56. #ifdef SOFTPARTICLES_ON
  57. o.projPos = ComputeScreenPos (o.vertex);
  58. COMPUTE_EYEDEPTH(o.projPos.z);
  59. #endif
  60. o.color = v.color;
  61. o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
  62. return o;
  63. }
  64. sampler2D _CameraDepthTexture;
  65. float _InvFade;
  66. fixed4 frag (v2f i) : COLOR
  67. {
  68. fixed4 c;
  69. //c.rgb += (_TintColor.rgb * 0.8f);
  70. //c.rgb = (0.0f,0.0f,255.0f);
  71. c.r = 0.1f;
  72. c.g = 0.2f;
  73. c.b = 0.4f;
  74. c.a = 0.3f;
  75. return c;
  76. }
  77. ENDCG
  78. }
  79. }
  80. // ---- Dual texture cards
  81. SubShader
  82. {
  83. Pass
  84. {
  85. SetTexture [_MainTex]
  86. {
  87. constantColor [_TintColor]
  88. combine constant * primary
  89. }
  90. SetTexture [_MainTex]
  91. {
  92. combine texture * previous DOUBLE
  93. }
  94. }
  95. }
  96. // ---- Single texture cards (does not do color tint)
  97. SubShader
  98. {
  99. Pass
  100. {
  101. SetTexture [_MainTex]
  102. {
  103. combine texture * primary
  104. }
  105. }
  106. }
  107. }
  108. }