Shader "Atmosphere system/RainShader" {
Properties {
_RainColor ("Rain color", Color) = (1,1,1,1) //параметр цвета дождя
_Tex1 ("Rain textura1", 2D) = "white" {} //первая текстура
_Tex2 ("Rain textura2", 2D) = "white" {} // вторая текстура
_RainOp("Rain opasite", Range(0.1,1)) = 0.5 // степень прозрачности дождя
_ScrollX("Speed texture X", Range(0,30)) = 10
_ScrollY("Speed texture Y", Range(0,30)) = 10
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 200
ZWrite Off
Cull Off
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard alpha:fade
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _Tex1;
sampler2D _Tex2;
fixed4 _RainColor;
float _RainOp;
float _ScrollX;
float _ScrollY;
struct Input {
float2 uv_Tex1;
float2 uv_Tex2;
};
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed2 scrollUV1 = IN.uv_Tex1;
fixed2 scrollUV2 = IN.uv_Tex2;
//движение
fixed Xscrolled = _ScrollX * _Time.x;
fixed Yscrolled = _ScrollY * _Time.x;
scrollUV1 += fixed2(Xscrolled,Yscrolled);
scrollUV2 += fixed2(Xscrolled,Yscrolled);
// Albedo comes from a texture tinted by color
fixed4 c = ((tex2D (_Tex1, scrollUV1) + tex2D (_Tex2, scrollUV2)) * _RainColor) * _RainOp;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}