View difference between Paste ID: crcDLYi4 and vDKT0LPi
SHOW: | | - or go back to the newest paste.
1
Shader "Particles/Alpha Blended Masked" {
2
	Properties{
3
		_TintColor("Tint Color", Color) = (0.5,0.5,0.5,0.5)
4
		_MainTex("Particle Texture", 2D) = "white" {}
5
	_InvFade("Soft Particles Factor", Range(0.01,3.0)) = 1.0
6
	}
7
8
		Category{
9
		Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" }
10
		Blend SrcAlpha OneMinusSrcAlpha
11
		ColorMask RGB
12
		ZTest Greater
13
		Cull Off Lighting Off ZWrite Off
14
15
		SubShader{
16
		Pass{
17
18
		CGPROGRAM
19
#pragma vertex vert
20
#pragma fragment frag
21
#pragma target 2.0
22
#pragma multi_compile_particles
23
#pragma multi_compile_fog
24
25
#include "UnityCG.cginc"
26
27
		sampler2D _MainTex;
28
	fixed4 _TintColor;
29
30
	struct appdata_t {
31
		float4 vertex : POSITION;
32
		fixed4 color : COLOR;
33
		float2 texcoord : TEXCOORD0;
34
		UNITY_VERTEX_INPUT_INSTANCE_ID
35
	};
36
37
	struct v2f {
38
		float4 vertex : SV_POSITION;
39
		fixed4 color : COLOR;
40
		float2 texcoord : TEXCOORD0;
41
		UNITY_FOG_COORDS(1)
42
#ifdef SOFTPARTICLES_ON
43
			float4 projPos : TEXCOORD2;
44
#endif
45
		UNITY_VERTEX_OUTPUT_STEREO
46
	};
47
48
	float4 _MainTex_ST;
49
50
	v2f vert(appdata_t v)
51
	{
52
		v2f o;
53
		UNITY_SETUP_INSTANCE_ID(v);
54
		UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(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 * _TintColor;
61
		o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
62
		UNITY_TRANSFER_FOG(o,o.vertex);
63
		return o;
64
	}
65
66
	sampler2D_float _CameraDepthTexture;
67
	float _InvFade;
68
69
	fixed4 frag(v2f i) : SV_Target
70
	{
71
#ifdef SOFTPARTICLES_ON
72
		float sceneZ = LinearEyeDepth(SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
73
	float partZ = i.projPos.z;
74
	float fade = saturate(_InvFade * (sceneZ - partZ));
75
	i.color.a *= fade;
76
#endif
77
78
	fixed4 col = 2.0f * i.color * tex2D(_MainTex, i.texcoord);
79
	UNITY_APPLY_FOG(i.fogCoord, col);
80
	return col;
81
	}
82
		ENDCG
83
	}
84
	}
85
	}
86
}