Skip to content

Reverse Disintegration effect by Reverse transparency #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions Assets/Shaders/3D/Unlit/Reverse-DisIntegrate-Shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Shader "Unlit/Reverse_Disintegrate"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_color("Color",color)=(1,1,1,1)
_Transparent("Transparency",float)=0.0

}
SubShader
{
Tags {"Queue"="Transparent" "RenderType"="Transparent"}
LOD 100
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha

Lighting Off
ColorMask RGB


Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog

#include "UnityCG.cginc"

struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};

sampler2D _MainTex;
float4 _color;
float _Transparent;
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
};


v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv)*_color ;


_Transparent=_Transparent*(_Time.y*5000);
if(_Transparent<8)
{
col.a=_Transparent;
}

// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
}