Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "FX/Trail"
- {
- Properties
- {
- _TintColor("Tint Color", Color) = (0.500000,0.500000,0.500000,1)
- _MainTex("GrayPackTexture", 2D) = "white" { }
- _MaskTrail("MaskStretchTrail",2D) = "white" { }
- _MaskBlockyFades("BlockyFadesTex",2D) = "white" { }
- _ScrollSpeedX("X Scroll Speed", Range(0,10)) = 2
- _TileU("Tiling U",Range(1,100)) = 1
- _TileV("Tiling V",Range(1,100)) = 1
- }
- SubShader{
- Tags
- {
- "RenderType" = "Transparent"
- "queue" = "Transparent"
- "IgnoreProjector" = "True"
- }
- LOD 200
- Cull Back
- 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 _MainTex;
- sampler2D _MaskTrail;
- sampler2D _MaskBlockyFades;
- struct Input {
- float2 uv_MainTex;
- float2 uv_MaskTrail;
- float2 uv_MaskBlockyFades;
- };
- fixed4 _TintColor;
- fixed _ScrollSpeedX;
- float _TileU;
- float _TileV;
- float ZeroToOne;
- void surf(Input IN, inout SurfaceOutputStandard o) {
- fixed2 scrolledUV = IN.uv_MaskTrail;
- fixed2 tileUV = IN.uv_MaskTrail;
- fixed xScrollVal = (-_ScrollSpeedX) * _Time;
- fixed yScrollVal = 0;
- scrolledUV += fixed2(xScrollVal, yScrollVal);
- tileUV *= fixed2(_TileU, _TileV);
- // Albedo comes from a texture tinted by color
- float4 mask = tex2D(_MainTex, IN.uv_MaskTrail);
- float4 movingMask = tex2D(_MaskTrail, scrolledUV);
- float4 maskCube = tex2D(_MainTex, scrolledUV);
- float4 maskBlockyFades = tex2D(_MaskBlockyFades, scrolledUV);
- float4 maskBlockyFadesMoving = tex2D(_MaskBlockyFades, tileUV);
- //masking of masks for emissive
- if (maskBlockyFadesMoving.g >= maskBlockyFades.r)
- {
- ZeroToOne = 1;
- }
- else
- {
- ZeroToOne = 0;
- }
- o.Albedo = (((1 - (1 - _TintColor)*(1 - movingMask))*0.75) - mask.r) * maskCube.b;//_TintColor * movingMask;
- //(1-(1-_TintColor)*(1- movingMask)) = screen blend mode
- o.Alpha = mask.g;
- o.Emission = ((_TintColor *mask.r) + (_TintColor*ZeroToOne)); //_TintColor * mask.r ;
- }
- ENDCG
- }
- FallBack "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement