国产性生交xxxxx免费-国产中文字幕-啊灬啊灬啊灬快灬高潮了,亚洲国产午夜精品理论片在线播放 ,亚洲欧洲日本无在线码,色爽交视频免费观看

鍋爐信息網 > 鍋爐知識 > 鍋爐百科

UGUI遮罩流光Shader

發布時間:

最近在做UGUI的特效,一個常見的效果就是UI上的流光(土豪金閃閃)。常見的做法混合一個遮罩貼圖,控制UV移動。但是最近有個想法是在UI的

最近在做UGUI的特效,一個常見的效果就是UI上的流光(土豪金閃閃)。

常見的做法混合一個遮罩貼圖,控制UV移動。但是最近有個想法是在UI的部分紋理上流動,比如金屬邊什么的,于是就要再引入一個對應可以流動部分的紋理組合起來。

此工程的unitypackage下載地址:http://pan.baidu.com/s/1pLRhmBp

下面是核心shader:

Shader "UI/Unlit/Flowlight"n{ntPropertiesnt{ntt[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}ntt_Color("Tint", Color) = (1, 1, 1, 1)ntt[MaterialToggle] _OffSet("OffSet", float) = 0ntt[MaterialToggle] PixelSnap("Pixel snap", float) = 0nntt/* Flowlight */ntt_FlowlightMaskTex("Mask Texture", 2D) = "white" {}ntt_FlowlightTex("Add Move Texture", 2D) = "white" {}ntt_FlowlightColor("Flowlight Color", Color) = (0, 0, 0, 1)ntt_Power("Power", float) = 1ntt_SpeedX("SpeedX", float) = 1ntt_SpeedY("SpeedY", float) = 0ntt/* --------- */nntt/* UI */ntt_StencilComp("Stencil Comparison", Float) = 8ntt_Stencil("Stencil ID", Float) = 0ntt_StencilOp("Stencil Operation", Float) = 0ntt_StencilWriteMask("Stencil Write Mask", Float) = 255ntt_StencilReadMask("Stencil Read Mask", Float) = 255ntt/* -- */nt}nntSubShadernt{nttTagsntt{nttt"Queue" = "Transparent"nttt"IgnoreProjector" = "True"nttt"RenderType" = "Transparent"nttt"PreviewType" = "Plane"nttt"CanUseSpriteAtlas" = "True"ntt}nnttCull OffnttLighting OffnttZWrite OffnttBlend One OneMinusSrcAlphanntt/* UI */nttStencilntt{ntttRef[_Stencil]ntttComp[_StencilComp]ntttPass[_StencilOp]ntttReadMask[_StencilReadMask]ntttWriteMask[_StencilWriteMask]ntt}ntt/* -- */ntPassnt{nttCGPROGRAMn#pragma vertex vertn#pragma fragment fragn#pragma multi_compile _ PIXELSNAP_ONn#include "UnityCG.cginc"nntstruct appdata_tnt{nttfloat4 vertex : POSITION;nttfloat4 color : COLOR;nttfloat2 texcoord : TEXCOORD0;nt};nntstruct v2fnt{nttfloat4 vertex : SV_POSITION;nttfixed4 color : COLOR;ntthalf2 texcoord : TEXCOORD0;nntt/* Flowlight */ntthalf2 texflowlight : TEXCOORD1;ntt/* --------- */nt};nntfixed4 _Color;nnt/* Flowlight */ntfixed4 _FlowlightColor;ntfloat _Power;ntsampler2D _FlowlightTex;ntfixed4 _FlowlightTex_ST;ntsampler2D _FlowlightMaskTex;ntfixed4 _FlowlightMaskTex_ST;ntfixed _SpeedX;ntfixed _SpeedY;ntfixed x = 0;ntfloat _OffSet;nt/* --------- */ntv2f vert(appdata_t IN)nt{nttv2f OUT;nttOUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);nttOUT.texcoord = IN.texcoord;ntt/* Flowlight */nttOUT.texflowlight = TRANSFORM_TEX(IN.texcoord, _FlowlightTex);nttOUT.texflowlight.x += _Time * _SpeedX;nttOUT.texflowlight.y += _Time * _SpeedY;nttOUT.color = IN.color * _Color;n#ifdef PIXELSNAP_ONnttOUT.vertex = UnityPixelSnap(OUT.vertex);n#endifnttreturn OUT;nt}nntsampler2D _MainTex;nntfixed4 frag(v2f IN) : SV_Targetnt{nttfixed4 c = tex2D(_MainTex, IN.texcoord)*IN.color;nttfixed4 cmask = tex2D(_FlowlightMaskTex, IN.texcoord);ntif (cmask.a != 0)nt{ntt/* Flowlight */nttfixed4 cadd = tex2D(_FlowlightTex, IN.texflowlight) * _Power;nttcadd.rgb *= c.rgb;nttc.rgb += cadd.rgb;nt}ntc.rgb *= c.a;nt/* --------- */nntreturn c;nt}nttENDCGnt}nt}n}n

精選推薦

  • 711關東煮供應商
    711關東煮供應商

    今天給大家介紹三位,奶粉,全家、羅森這些便利店里關東煮的供應商。店里賣三四塊錢一串的關東煮,在網上買不到,一塊錢就搞定。首先關東

  • 健康日歷|高壓鍋容易爆炸的4個原因
    健康日歷|高壓鍋容易爆炸的4個原因

    來源:醫藥養生保健報設計:李雅琴醫學審核:姜峰出品人:胡麗麗

  • 高爐
    高爐

    今天這活卻是個白事,等到了時辰,那家人便準備火化,本來準備送普爐,我卻心中一動,便對那家人說道:“這老人走也不要省,還是送高爐吧。”

  • 高壓鍋和電壓力鍋的區別,推薦幾款點壓力鍋
    高壓鍋和電壓力鍋的區別,推薦幾款點壓

    記得之前有一次去朋友家玩,他正在用高壓鍋煮小米粥,是的,高壓鍋壓小米粥,大概煮了半小時,高壓鍋突然爆炸了,現場慘不忍睹啊,幸好廚房里沒

0