LayaTrail.shader 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. Shader "LayaAir3D/Trail" {
  2. Properties {
  3. _MainTex("Trail Texture", 2D) = "white" {}
  4. _TintColor("Tint Color", Color) = (0.5,0.5,0.5,0.5)
  5. [HideInInspector] _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.01
  6. [HideInInspector] _Cull ("__cull", Float) = 0.0
  7. [HideInInspector] _Mode ("__mode", Float) = 1.0
  8. [HideInInspector] _SrcBlend ("__src", Float) = 5.0
  9. [HideInInspector] _DstBlend ("__dst", Float) = 10.0
  10. [HideInInspector] _ZWrite("__zw", Float) = 0.0
  11. [HideInInspector] _ZTest("__zt", Float) = 4.0
  12. [HideInInspector] _RenderQueue("__rq", Float) = 3000.0
  13. }
  14. SubShader {
  15. Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  16. Pass {
  17. Tags { "LightMode"="ForwardBase" }
  18. Blend [_SrcBlend] [_DstBlend]
  19. ColorMask RGB
  20. Cull Off Lighting On ZWrite Off
  21. CGPROGRAM
  22. #pragma vertex vert
  23. #pragma fragment frag
  24. #pragma target 2.0
  25. #pragma shader_feature ADDTIVEFOG
  26. #pragma multi_compile_particles
  27. #pragma multi_compile_fog
  28. #include "UnityCG.cginc"
  29. sampler2D _MainTex;
  30. float4 _MainTex_ST;
  31. float4 _TintColor;
  32. struct appdata_t {
  33. float4 vertex : POSITION;
  34. float4 color : COLOR;
  35. float2 texcoord : TEXCOORD0;
  36. };
  37. struct v2f {
  38. float4 pos : SV_POSITION;
  39. float4 color : COLOR;
  40. float2 uv : TEXCOORD0;
  41. UNITY_FOG_COORDS(1)
  42. };
  43. v2f vert (appdata_t v)
  44. {
  45. v2f o;
  46. o.pos = UnityObjectToClipPos(v.vertex);
  47. o.color = v.color;
  48. o.uv = TRANSFORM_TEX(v.texcoord,_MainTex);
  49. UNITY_TRANSFER_FOG(o,o.pos);
  50. return o;
  51. }
  52. fixed4 frag (v2f i) : SV_Target
  53. {
  54. float4 color = 2.0 * i.color * tex2D(_MainTex, i.uv) * _TintColor;
  55. #if ADDTIVEFOG
  56. UNITY_APPLY_FOG_COLOR(i.fogCoord, color, fixed4(0, 0, 0, 0));
  57. #else
  58. UNITY_APPLY_FOG(i.fogCoord, color);
  59. #endif
  60. //color = clamp(color, 0, 1);
  61. return color;
  62. }
  63. ENDCG
  64. }
  65. }
  66. CustomEditor "LayaEffectGUI"
  67. }