[Shader]模型表面流光效果

<1>效果图

         

<2>思路:取了一张流光图的rgb加到main纹理上,因为流光图其他部分是黑色的,rgb都是0,加上没影响

<3>

Shader "T/p2" {
Properties{
_Color("Main Color", Color) = (1,1,1,1)
_MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
_FlashTex("流光图",2D) = "white"{}
_Speed("流动速度",Range(1,10))=1
_Count("波浪",Range(1,10))=5

_AfterColor("混合颜色", Color) = (0.435, 0.851, 1, 0.419)
}

SubShader{
Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
LOD 200

CGPROGRAM
#pragma surface surf Lambert alpha:fade

sampler2D _MainTex;
sampler2D _FlashTex;
fixed4 _Color;
fixed4 _AfterColor;
float _Speed;
float _Count;

struct Input {
float2 uv_MainTex;
};

void surf(Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
fixed2 uv = IN.uv_MainTex *_Count +float2(_Time.x*_Speed,_Time.x*_Speed);
fixed4 f = tex2D(_FlashTex, uv);
o.Albedo = c.rgb+f.rgb*_AfterColor;
o.Alpha = c.a;
}
ENDCG
}

Fallback "Legacy Shaders/Transparent/VertexLit"
}

原文地址:https://www.cnblogs.com/cocotang/p/7416842.html