You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TrafficSafe/Assets/Mat/Shader/AlphaHuXiCell.shader

222 lines
9.7 KiB

// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "AlphaHuXiCell"
{
Properties
{
[HDR]_TintColor("TintColor", Color) = (1,1,1,1)
_Speed("Speed", Range( 0 , 2)) = 1
_TexScale("TexScale", Range( 0 , 0.8)) = 0.66
_MinAlpha("MinAlpha", Range( 0 , 1)) = 0.5
_MaxAlpha("MaxAlpha", Range( 0 , 1)) = 1
_TilingScale("TilingScale", Range( 0 , 100)) = 8
}
SubShader
{
Tags { "RenderType"="Transparent" }
LOD 100
CGINCLUDE
#pragma target 3.0
ENDCG
Blend Off
AlphaToMask On
Cull Back
ColorMask RGBA
ZWrite On
ZTest LEqual
Offset 0 , 0
Pass
{
Name "Unlit"
Tags { "LightMode"="ForwardBase" }
CGPROGRAM
#ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX
//only defining to not throw compilation error over Unity 5.5
#define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input)
#endif
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_instancing
#include "UnityCG.cginc"
#include "UnityShaderVariables.cginc"
struct appdata
{
float4 vertex : POSITION;
float4 color : COLOR;
float4 ase_texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
#ifdef ASE_NEEDS_FRAG_WORLD_POSITION
float3 worldPos : TEXCOORD0;
#endif
float4 ase_texcoord1 : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
uniform half _TilingScale;
uniform half _TexScale;
uniform half4 _TintColor;
uniform half _Speed;
uniform half _MinAlpha;
uniform half _MaxAlpha;
float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }
float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }
float snoise( float2 v )
{
const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );
float2 i = floor( v + dot( v, C.yy ) );
float2 x0 = v - i + dot( i, C.xx );
float2 i1;
i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );
float4 x12 = x0.xyxy + C.xxzz;
x12.xy -= i1;
i = mod2D289( i );
float3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );
float3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );
m = m * m;
m = m * m;
float3 x = 2.0 * frac( p * C.www ) - 1.0;
float3 h = abs( x ) - 0.5;
float3 ox = floor( x + 0.5 );
float3 a0 = x - ox;
m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );
float3 g;
g.x = a0.x * x0.x + h.x * x0.y;
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
return 130.0 * dot( m, g );
}
v2f vert ( appdata v )
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
UNITY_TRANSFER_INSTANCE_ID(v, o);
o.ase_texcoord1.xy = v.ase_texcoord.xy;
//setting value to unused interpolator channels and avoid initialization warnings
o.ase_texcoord1.zw = 0;
float3 vertexValue = float3(0, 0, 0);
#if ASE_ABSOLUTE_VERTEX_POS
vertexValue = v.vertex.xyz;
#endif
vertexValue = vertexValue;
#if ASE_ABSOLUTE_VERTEX_POS
v.vertex.xyz = vertexValue;
#else
v.vertex.xyz += vertexValue;
#endif
o.vertex = UnityObjectToClipPos(v.vertex);
#ifdef ASE_NEEDS_FRAG_WORLD_POSITION
o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
#endif
return o;
}
fixed4 frag (v2f i ) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
fixed4 finalColor;
#ifdef ASE_NEEDS_FRAG_WORLD_POSITION
float3 WorldPosition = i.worldPos;
#endif
half2 break19_g4 = float2( -0.5,0.5 );
half2 temp_cast_0 = (_TilingScale).xx;
half temp_output_2_0_g2 = _TexScale;
half2 appendResult10_g3 = (half2(temp_output_2_0_g2 , temp_output_2_0_g2));
half2 temp_output_11_0_g3 = ( abs( (frac( (i.ase_texcoord1.xy*temp_cast_0 + ( 1.0 - abs( ( _Time.y * half2( 0,-1 ) ) ) )) )*2.0 + -1.0) ) - appendResult10_g3 );
half2 break16_g3 = ( 1.0 - ( temp_output_11_0_g3 / fwidth( temp_output_11_0_g3 ) ) );
half2 temp_cast_1 = (( 1.0 - saturate( min( break16_g3.x , break16_g3.y ) ) )).xx;
half simplePerlin2D21 = snoise( temp_cast_1 );
simplePerlin2D21 = simplePerlin2D21*0.5 + 0.5;
half temp_output_1_0_g4 = simplePerlin2D21;
half sinIn7_g4 = sin( temp_output_1_0_g4 );
half sinInOffset6_g4 = sin( ( temp_output_1_0_g4 + 1.0 ) );
half lerpResult20_g4 = lerp( break19_g4.x , break19_g4.y , frac( ( sin( ( ( sinIn7_g4 - sinInOffset6_g4 ) * 91.2228 ) ) * 43758.55 ) ));
half mulTime6 = _Time.y * _Speed;
half clampResult9 = clamp( abs( cos( mulTime6 ) ) , _MinAlpha , _MaxAlpha );
finalColor = ( ( ( lerpResult20_g4 + sinIn7_g4 ) * _TintColor ) * clampResult9 );
return finalColor;
}
ENDCG
}
}
CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=18900
138.4;211.2;1253;494;1355.249;-338.1642;1;True;True
Node;AmplifyShaderEditor.SimpleTimeNode;27;-3005.977,-196.8076;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0
Node;AmplifyShaderEditor.Vector2Node;34;-2778.366,44.00694;Inherit;False;Constant;_Vector0;Vector 0;2;0;Create;True;0;0;0;False;0;False;0,-1;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;35;-2487.168,-151.6911;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT2;0,0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.AbsOpNode;36;-2216.82,-185.2358;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.RangedFloatNode;29;-1686.195,-0.5533028;Inherit;False;Property;_TexScale;TexScale;2;0;Create;True;0;0;0;False;0;False;0.66;0.7;0;0.8;0;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;42;-1891.618,-318.0298;Inherit;False;Property;_TilingScale;TilingScale;5;0;Create;True;0;0;0;False;0;False;8;8;0;100;0;1;FLOAT;0
Node;AmplifyShaderEditor.OneMinusNode;40;-1933.35,-132.7194;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.RangedFloatNode;12;-1606.371,420.7017;Inherit;False;Property;_Speed;Speed;1;0;Create;True;0;0;0;False;0;False;1;1;0;2;0;1;FLOAT;0
Node;AmplifyShaderEditor.FunctionNode;30;-1674.191,-280.1075;Inherit;False;Grid;-1;;2;a9240ca2be7e49e4f9fa3de380c0dbe9;0;3;5;FLOAT2;8,8;False;6;FLOAT2;0,0;False;2;FLOAT;0.9;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleTimeNode;6;-1248.593,353.9346;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0
Node;AmplifyShaderEditor.OneMinusNode;41;-1396.517,-214.0742;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.NoiseGeneratorNode;21;-1184.857,-309.1437;Inherit;False;Simplex2D;True;False;2;0;FLOAT2;0,0;False;1;FLOAT;1;False;1;FLOAT;0
Node;AmplifyShaderEditor.CosOpNode;17;-1021.766,421.278;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.ColorNode;3;-878.1637,-26.83372;Inherit;False;Property;_TintColor;TintColor;0;1;[HDR];Create;True;0;0;0;False;0;False;1,1,1,1;0.380073,0.4908573,0.6886792,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.AbsOpNode;18;-820.817,380.3366;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.FunctionNode;44;-915.8235,-319.9041;Inherit;False;Noise Sine Wave;-1;;4;a6eff29f739ced848846e3b648af87bd;0;2;1;FLOAT;0;False;2;FLOAT2;-0.5,0.5;False;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;10;-1043.214,521.6603;Inherit;False;Property;_MinAlpha;MinAlpha;3;0;Create;True;0;0;0;False;0;False;0.5;0.5;0;1;0;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;45;-828.2487,630.1642;Inherit;False;Property;_MaxAlpha;MaxAlpha;4;0;Create;True;0;0;0;False;0;False;1;0.5;0;1;0;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;2;-479.6482,-205.4569;Inherit;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
Node;AmplifyShaderEditor.ClampOpNode;9;-560.9338,396.588;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;43;-1273.093,-38.53386;Inherit;False;Constant;_Float3;Float 3;5;0;Create;True;0;0;0;False;0;False;-0.57;0;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;19;-163.4236,76.54218;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;0;161.1177,-41.91241;Half;False;True;-1;2;ASEMaterialInspector;100;1;AlphaHuXi;0770190933193b94aaa3065e307002fa;True;Unlit;0;0;Unlit;2;True;True;0;5;False;-1;10;False;-1;0;1;False;-1;0;False;-1;True;0;False;-1;0;False;-1;False;False;False;False;False;False;False;False;False;True;1;False;-1;False;True;0;False;-1;False;True;True;True;True;True;0;False;-1;False;False;False;False;False;False;False;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;False;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;RenderType=Transparent=RenderType;True;2;0;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;1;LightMode=ForwardBase;False;0;;0;0;Standard;1;Vertex Position,InvertActionOnDeselection;1;0;1;True;False;;False;0
WireConnection;35;0;27;0
WireConnection;35;1;34;0
WireConnection;36;0;35;0
WireConnection;40;0;36;0
WireConnection;30;5;42;0
WireConnection;30;6;40;0
WireConnection;30;2;29;0
WireConnection;6;0;12;0
WireConnection;41;0;30;0
WireConnection;21;0;41;0
WireConnection;17;0;6;0
WireConnection;18;0;17;0
WireConnection;44;1;21;0
WireConnection;2;0;44;0
WireConnection;2;1;3;0
WireConnection;9;0;18;0
WireConnection;9;1;10;0
WireConnection;9;2;45;0
WireConnection;19;0;2;0
WireConnection;19;1;9;0
WireConnection;0;0;19;0
ASEEND*/
//CHKSM=293ED0BD96440BDC11C8F4EC98C98CC2008B8DA6