revival/game/Assets/Shaders/add.shader

77 lines
2.1 KiB
Plaintext
Raw Normal View History

2021-04-24 03:06:03 +02:00
Shader "KernelPanic/add"
{
Properties
{
// _NoiseTex ("Noise Tex", 2D) = "black"
// [HideInInspector]_MainTex ("Base (RGB)", 2D) = "white" {}
// _GlitchTex ("Glitch Tex", 2D) = "black"
// [Range(0,1)] _Sample ("Sample", Float) = 0.5
}
SubShader
{
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;
}
// This macro declares _BaseMap as a Texture2D object.
// TEXTURE2D(_MainTex);
// TEXTURE2D(_NoiseMap);
// This macro declares the sampler for the _BaseMap texture.
// SAMPLER(sampler_MainTex);
// SAMPLER(sampler_NoiseMap);
sampler2D _BlendTex;
sampler2D _GlitchTex;
sampler2D _MainTex;
float _Sample;
float _DeltaTime;
fixed4 frag (v2f i) : SV_Target
{
// sample raw glitch
float4 g = float4(tex2D(_GlitchTex, i.uv).rgb, _Sample);
// float a = length(g.xyz)/length(float3(1,1,1));
// g.a = lerp(a, 0, _Sample);
// float4 g = float4(tex2D(_GlitchTex, i.uv).rgb, _Sample);
// float4 b = float4(tex2D(_BlendTex, i.uv).rgb, _Sample);
return g;
}
ENDCG
}
}
}