Shader "Douyin/gt"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
scale ("scale", float) = 1
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always
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;
float scale;
fixed4 frag (v2f i) : SV_Target
{
float2 textureCoordinate = i.uv;
float2 newTextureCoordinate = float2((scale - 1.0) *0.5 + textureCoordinate.x / scale ,(scale - 1.0) *0.5 + textureCoordinate.y /scale);
fixed4 textureColor = tex2D(_MainTex, newTextureCoordinate);
fixed4 shiftColor1 = tex2D(_MainTex, newTextureCoordinate+float2(-0.05 * (scale - 1.0), - 0.05 *(scale - 1.0)));
fixed4 shiftColor2 = tex2D(_MainTex, newTextureCoordinate+float2(-0.1 * (scale - 1.0), - 0.1 *(scale - 1.0)));
fixed3 blendFirstColor = fixed3(textureColor.r , textureColor.g, shiftColor1.b);
fixed3 blend3DColor = fixed3(shiftColor2.r, blendFirstColor.g, blendFirstColor.b);
return fixed4(blend3DColor, textureColor.a);
}
ENDCG
}
}
}
本人qq:344810449,欢迎探讨研究。
有unity,shader,小程序等需求也可以联系本人,非常乐于助人。
如果觉得还不错给博主来个小惊喜,纯属自愿,不强求: