怎么能放有光晕的特效能光晕清晰点文章来源:https://www.toymoban.com/news/detail-792978.html
Shader "Series/CRLuo_Teaching_Tex_Amin_G"
{
Properties
{
[NoScaleOffset]
_MainTex ("Texture", 2D) = "white" {}
_X_Sum("across",float) = 3
_Y_Sum("vertical",float) = 3
_ShowID("ID",float) = 0
[Toggle(_AutoPlay_Key)] _AutoPlay_Key("自动播放",Float) = 0
_PlaySpeed("播放速度",float) = 1
}
SubShader
{
Tags {"Queue" = "Transparent" "RenderType" = "Transparent"}
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#pragma shader_feature _AutoPlay_Key
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float _X_Sum;
float _Y_Sum;
float _ShowID;
float _PlaySpeed;
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
{
#ifdef _AutoPlay_Key
_ShowID += _Time.y* _PlaySpeed;
#endif
_ShowID = _ShowID % (_X_Sum*_Y_Sum);
_ShowID = floor(_ShowID);
float indexY = floor(_ShowID / _X_Sum);
float indexX = _ShowID - _X_Sum * indexY;
float2 AnimUV = float2(i.uv.x / _X_Sum, i.uv.y / _Y_Sum);
AnimUV.x += indexX / _X_Sum ;
//AnimUV.y +=indexY / _YSum;
AnimUV.y +=(_Y_Sum-1 - indexY )/ _Y_Sum;
fixed4 col = tex2D(_MainTex, AnimUV);
clip(col.a - 0.5);
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
}文章来源地址https://www.toymoban.com/news/detail-792978.html
到了这里,关于unity数列帧播放特效Shader怎么能放有光晕的特效能光晕清晰点的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!