Shader "Unlit/VideoEffect"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
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;
};
sampler2D _MainTex;
float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float2 uv = i.uv;
float delays = _Time*10;
delays = frac(delays);
if (delays >= 1)
delays = 1;
delays = 1 - delays;
fixed4 col = fixed4(0,0,0,1);
if (i.uv.x < i.uv.y)
{
if (delays < i.uv.x)
{
uv = float2((1- uv.x) - delays, uv.y);
col = tex2D(_MainTex, uv);
}
}
else {
if (1 - delays > i.uv.x)
{
uv = float2((delays - uv.x), uv.y);
col = tex2D(_MainTex, uv);
}
}
// sample the texture _Time
return col;
}
ENDCG
}
}
}
本人qq:344810449,欢迎探讨研究。
有unity,shader,小程序等需求也可以联系本人,非常乐于助人。
如果觉得还不错给博主来个小惊喜,纯属自愿,不强求:
作者:unity游侠
链接:https://blog.csdn.net/y90o08u28/article/details/88699848
来源:CSDN
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。