WarpJump.shader 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. Shader "FORGE3D/Warp Jump" {
  2. Properties {
  3. _TintColorA ("Tint Color A", Color) = (0.5,0.5,0.5,0.5)
  4. _TintColorB ("Tint Color B", Color) = (0.5,0.5,0.5,0.5)
  5. _Mult ("Color strength", float) = 1
  6. _MainTex ("Particle Texture", 2D) = "white" {}
  7. _InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
  8. }
  9. Category {
  10. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
  11. Blend One One
  12. AlphaTest Greater .01
  13. ColorMask RGB
  14. Cull Off Lighting Off ZWrite Off Fog { Mode Off }
  15. SubShader {
  16. Pass {
  17. CGPROGRAM
  18. #pragma vertex vert
  19. #pragma fragment frag
  20. #pragma multi_compile_particles
  21. #include "UnityCG.cginc"
  22. sampler2D _MainTex;
  23. float4 _TintColorA, _TintColorB;
  24. struct appdata_t {
  25. float4 vertex : POSITION;
  26. fixed4 color : COLOR;
  27. float2 texcoord : TEXCOORD0;
  28. };
  29. struct v2f {
  30. float4 vertex : SV_POSITION;
  31. fixed4 color : COLOR;
  32. float2 texcoord : TEXCOORD0;
  33. #ifdef SOFTPARTICLES_ON
  34. float4 projPos : TEXCOORD1;
  35. #endif
  36. };
  37. float4 _MainTex_ST;
  38. v2f vert (appdata_t v)
  39. {
  40. v2f o;
  41. o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
  42. #ifdef SOFTPARTICLES_ON
  43. o.projPos = ComputeScreenPos (o.vertex);
  44. COMPUTE_EYEDEPTH(o.projPos.z);
  45. #endif
  46. o.color = v.color;
  47. o.texcoord = v.texcoord;
  48. return o;
  49. }
  50. sampler2D_float _CameraDepthTexture;
  51. float _InvFade, _Mult;
  52. float4 frag (v2f i) : SV_Target
  53. {
  54. #ifdef SOFTPARTICLES_ON
  55. float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
  56. float partZ = i.projPos.z;
  57. float fade = saturate (_InvFade * (sceneZ-partZ));
  58. i.color.a *= fade;
  59. #endif
  60. float4 final = tex2D(_MainTex, i.texcoord);
  61. final = lerp(_TintColorA * _TintColorA.a * _Mult, _TintColorB * _TintColorB.a * _Mult, final * _Mult) * final;
  62. return float4(i.color.a * final.xyz * i.color.xyz, 1);
  63. }
  64. ENDCG
  65. }
  66. }
  67. }
  68. }