Unity之流光效果
生活随笔
收集整理的這篇文章主要介紹了
Unity之流光效果
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
效果如圖:
shader如下:
Shader "Unlit/Walk light" {Properties{_MainTex ("Base (RGB), Alpha (A)", 2D) = "black" {}_LightTex ("Light", 2D) = "black" {}}SubShader{LOD 200Tags{"Queue" = "Transparent""IgnoreProjector" = "True""RenderType" = "Transparent"}Pass{Cull OffLighting OffZWrite OffFog { Mode Off }Offset -1, -1Blend SrcAlpha OneMinusSrcAlphaCGPROGRAM#pragma vertex vert#pragma fragment frag #include "UnityCG.cginc"sampler2D _MainTex;sampler2D _LightTex;struct appdata_t{float4 vertex : POSITION;float2 texcoord : TEXCOORD0;fixed4 color : COLOR;};struct v2f{float4 vertex : SV_POSITION;half2 texcoord : TEXCOORD0;fixed4 color : COLOR;};v2f o;v2f vert (appdata_t v){o.vertex = UnityObjectToClipPos(v.vertex);o.texcoord = v.texcoord;o.color = v.color;return o;}fixed4 frag (v2f IN) : COLOR{fixed4 main = tex2D(_MainTex, IN.texcoord);half lightU = IN.texcoord.x - frac(_Time.y);half2 lightUV = half2(lightU, IN.texcoord.y);fixed4 light = tex2D(_LightTex, lightUV);fixed4 col = main + main * light.a;return col * IN.color;}ENDCG}}SubShader{LOD 100Tags{"Queue" = "Transparent""IgnoreProjector" = "True""RenderType" = "Transparent"}Pass{Cull OffLighting OffZWrite OffFog { Mode Off }Offset -1, -1ColorMask RGBBlend SrcAlpha OneMinusSrcAlphaColorMaterial AmbientAndDiffuseSetTexture [_MainTex]{Combine Texture * Primary}}} }資源在:https://files.cnblogs.com/files/jietian331/WalkLight.rar
轉載請注明出處:http://www.cnblogs.com/jietian331/p/8951980.html
?
轉載于:https://www.cnblogs.com/jietian331/p/8951980.html
總結
以上是生活随笔為你收集整理的Unity之流光效果的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux ssh终端解决中文乱码的问题
- 下一篇: 学习Java 采取令牌的方式避免重复提交