Shader "MyShader/FlowingLight" {
|
|
Properties {
|
|
_MainTex ("MainTex", 2D) = "white" {}
|
|
_Color ("Color", Color) = (0.5,0.5,0.5,1)
|
|
_Brighteen ("Brighteen", Range(0, 10)) = 1
|
|
_Uspeed ("U speed", Range(-10, 10)) = 0
|
|
_VSpeed ("V Speed", Range(-10, 10)) = 1
|
|
}
|
|
SubShader {
|
|
Tags {
|
|
"IgnoreProjector"="True"
|
|
"Queue"="Transparent"
|
|
"RenderType"="Transparent"
|
|
}
|
|
LOD 200
|
|
Pass {
|
|
Name "FORWARD"
|
|
Tags {
|
|
"LightMode"="ForwardBase"
|
|
}
|
|
Blend SrcAlpha One
|
|
Cull Off
|
|
ZWrite Off
|
|
Fog { Mode off }
|
|
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#include "UnityCG.cginc"
|
|
#pragma multi_compile_fwdbase
|
|
#pragma target 3.0
|
|
|
|
uniform float4 _TimeEditor;
|
|
uniform sampler2D _MainTex; uniform fixed4 _MainTex_ST;
|
|
uniform fixed4 _Color;
|
|
uniform fixed _Brighteen;
|
|
uniform half _Uspeed;
|
|
uniform half _VSpeed;
|
|
|
|
struct VertexInput {
|
|
float4 vertex : POSITION;
|
|
float2 texcoord0 : TEXCOORD0;
|
|
fixed4 vertexColor : COLOR;
|
|
};
|
|
|
|
struct VertexOutput {
|
|
float4 pos : SV_POSITION;
|
|
float2 uv0 : TEXCOORD0;
|
|
fixed4 vertexColor : COLOR;
|
|
};
|
|
|
|
VertexOutput vert (VertexInput v) {
|
|
VertexOutput o = (VertexOutput)0;
|
|
o.vertexColor = v.vertexColor * _Color;
|
|
o.pos = UnityObjectToClipPos(v.vertex );
|
|
|
|
float t = _Time.g + _TimeEditor.g;
|
|
float2 uv = v.texcoord0 + float2(_Uspeed,_VSpeed) * t;
|
|
o.uv0 = TRANSFORM_TEX(uv, _MainTex);
|
|
|
|
return o;
|
|
}
|
|
|
|
fixed4 frag(VertexOutput i) : SV_Target {
|
|
fixed4 mainColor = tex2D(_MainTex, i.uv0);
|
|
fixed3 emissive = ((_Brighteen*mainColor.rgb)*i.vertexColor.rgb);
|
|
return fixed4(emissive * mainColor.a * i.vertexColor.a, 1);
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
|
|
}
|