revival/game/Assets/Shaders/fade.shader

88 lines
2.6 KiB
Plaintext
Raw Permalink Normal View History

2021-04-24 03:06:03 +02:00
Shader "KernelPanic/fade"
{
Properties
{
// _NoiseTex ("Noise Tex", 2D) = "black"
// [HideInInspector]_MainTex ("Base (RGB)", 2D) = "white" {}
// _GlitchBlendTex ("Glitch", 2D) = "black" {}
// _NoiseTex ("Noise", 2D) = "black" {}
// [Range(0,1)] _Sample ("Sample", Float) = 0.5
[Range(0,1)] _Strength ("Strength", Float) = 0.5
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always Blend SrcAlpha OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
sampler2D _MainTex;
// sampler2D _GlitchBlendTex;
// sampler2D _NoiseTex;
// sampler2D _CameraDepthTexture;
//
// float _Sample;
float _Strength;
fixed4 frag (v2f i) : SV_Target
{
return tex2D(_MainTex, i.uv) * _Strength;
// float4 c = tex2D(_MainTex, i.uv);
// return float4(c.rgb,lerp(0,c.a,_Strength));
// // depth
// float d = tex2D(_CameraDepthTexture, i.uv);
//
// // sample frame
// float4 c = tex2D(_MainTex, i.uv);
//
// // sample noise
// float2 scroll = float2(sin(_Time.y), cos(_Time.w));
// float4 n = tex2D(_NoiseTex, i.uv + scroll);
//
// // sample frame but with noise
// float4 cn = tex2D(_MainTex, i.uv + n.xy);
//
// // raw blended glitch used to blend between things
// float4 g = tex2D(_GlitchBlendTex, i.uv);
//
// // c = lerp(c,cn,g);
// c = lerp(c,g,g);
//
// return c;
// return tex2D(_CameraDepthTexture, i.uv);
}
ENDCG
}
}
}