Skip to content

Commit 4800324

Browse files
authored
Merge pull request UnityCommunity#37 from abhilash1910/patch-1
Reverse Disintegration effect by Reverse transparency
2 parents 8727b14 + af94bc2 commit 4800324

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
Shader "Unlit/Reverse_Disintegrate"
2+
{
3+
Properties
4+
{
5+
_MainTex ("Texture", 2D) = "white" {}
6+
_color("Color",color)=(1,1,1,1)
7+
_Transparent("Transparency",float)=0.0
8+
9+
}
10+
SubShader
11+
{
12+
Tags {"Queue"="Transparent" "RenderType"="Transparent"}
13+
LOD 100
14+
ZWrite Off
15+
Blend SrcAlpha OneMinusSrcAlpha
16+
17+
Lighting Off
18+
ColorMask RGB
19+
20+
21+
Pass
22+
{
23+
CGPROGRAM
24+
#pragma vertex vert
25+
#pragma fragment frag
26+
// make fog work
27+
#pragma multi_compile_fog
28+
29+
#include "UnityCG.cginc"
30+
31+
struct appdata
32+
{
33+
float4 vertex : POSITION;
34+
float2 uv : TEXCOORD0;
35+
};
36+
37+
sampler2D _MainTex;
38+
float4 _color;
39+
float _Transparent;
40+
struct v2f
41+
{
42+
float2 uv : TEXCOORD0;
43+
UNITY_FOG_COORDS(1)
44+
float4 vertex : SV_POSITION;
45+
};
46+
47+
48+
v2f vert (appdata v)
49+
{
50+
v2f o;
51+
o.vertex = UnityObjectToClipPos(v.vertex);
52+
o.uv = v.uv;
53+
UNITY_TRANSFER_FOG(o,o.vertex);
54+
return o;
55+
}
56+
57+
fixed4 frag (v2f i) : SV_Target
58+
{
59+
// sample the texture
60+
fixed4 col = tex2D(_MainTex, i.uv)*_color ;
61+
62+
63+
_Transparent=_Transparent*(_Time.y*5000);
64+
if(_Transparent<8)
65+
{
66+
col.a=_Transparent;
67+
}
68+
69+
// apply fog
70+
UNITY_APPLY_FOG(i.fogCoord, col);
71+
return col;
72+
}
73+
ENDCG
74+
}
75+
}
76+
}

0 commit comments

Comments
 (0)