Advertisement
Domukas64

Shader for Diablo Blend-Add effect

Aug 29th, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. Shader "Particles/WraithTest"
  2. {
  3. Properties
  4. {
  5. [HDR] _Color ("Color", Color) = (1,1,1,1)
  6. [NoScaleOffset] _MainTex("Texture", 2D) = "white" {}
  7.  
  8. }
  9. SubShader
  10. {
  11. Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" }
  12. Lighting Off
  13. Fog{ Mode Off }
  14. ZWrite Off
  15. Cull Off
  16.  
  17. Pass
  18. {
  19.  
  20. Blend One OneMinusSrcAlpha // Premultiplied transparency
  21. CGPROGRAM
  22. #pragma vertex vert
  23. #pragma fragment frag
  24.  
  25.  
  26. #include "UnityCG.cginc"
  27.  
  28. struct appdata
  29. {
  30. float4 vertex : POSITION;
  31. float4 uv : TEXCOORD0;
  32. float4 color : COLOR;
  33. };
  34.  
  35. struct v2f
  36. {
  37. float4 vertex : SV_POSITION;
  38. float4 uv : TEXCOORD0;
  39. float4 uv2 : TEXCOORD1;
  40. float4 color : COLOR;
  41. };
  42.  
  43. sampler2D _MainTex;
  44. float _BlendThreshold;
  45. float4 _Color;
  46.  
  47. v2f vert(appdata v)
  48. {
  49. v2f o;
  50. o.vertex = UnityObjectToClipPos(v.vertex);
  51. o.uv = v.uv;
  52.  
  53. float2 uv2 = (v.uv.xy + float2(0,v.uv.w)) + frac((_Time.y + v.uv.z * 100) * float2(0, 0.15));
  54. o.uv2 = float4(uv2,0,0);
  55. o.color = v.color;
  56. return o;
  57. }
  58.  
  59. fixed4 frag(v2f i) : SV_Target
  60. {
  61. fixed4 col1 = tex2D(_MainTex, i.uv) * i.color * _Color;
  62. fixed4 col2 = tex2D(_MainTex, i.uv2);
  63.  
  64. fixed4 col;
  65. col.a = col1.a * col2.a * 2 * i.color.a;
  66. col.rgb = col1.rgb * col2.rgb * 2 * col2.a * i.color.a;
  67. return col;
  68. }
  69. ENDCG
  70. }
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement