132 lines
7.5 KiB
Plaintext
132 lines
7.5 KiB
Plaintext
|
|
// Made with Amplify Shader Editor
|
||
|
|
// Available at the Unity Asset Store - http://u3d.as/y3X
|
||
|
|
Shader "Shader/ADD_Top3"
|
||
|
|
{
|
||
|
|
Properties
|
||
|
|
{
|
||
|
|
_Cutoff( "Mask Clip Value", Float ) = 0.61
|
||
|
|
_MainTex("MainTex", 2D) = "white" {}
|
||
|
|
_MaskTex("MaskTex", 2D) = "white" {}
|
||
|
|
[HDR]_MainColor("MainColor", Color) = (1,1,1,1)
|
||
|
|
_StartFrame("StartFrame", Float) = 0
|
||
|
|
_Rows("Rows", Float) = 0
|
||
|
|
_Colums("Colums", Float) = 0
|
||
|
|
_UVtiling("UVtiling", Vector) = (1,1,0,0)
|
||
|
|
_Speed("Speed", Float) = 1
|
||
|
|
[HideInInspector] _texcoord( "", 2D ) = "white" {}
|
||
|
|
[HideInInspector] __dirty( "", Int ) = 1
|
||
|
|
}
|
||
|
|
|
||
|
|
SubShader
|
||
|
|
{
|
||
|
|
Tags{ "RenderType" = "Opaque" "Queue" = "Overlay+0" "IsEmissive" = "true" }
|
||
|
|
Cull Off
|
||
|
|
ZWrite Off
|
||
|
|
ZTest Always
|
||
|
|
Blend One One
|
||
|
|
|
||
|
|
CGPROGRAM
|
||
|
|
#pragma target 3.5
|
||
|
|
#pragma surface surf Unlit keepalpha noshadow
|
||
|
|
struct Input
|
||
|
|
{
|
||
|
|
float4 vertexColor : COLOR;
|
||
|
|
float2 uv_texcoord;
|
||
|
|
};
|
||
|
|
|
||
|
|
uniform sampler2D _MainTex;
|
||
|
|
uniform float2 _UVtiling;
|
||
|
|
uniform float _Colums;
|
||
|
|
uniform float _Rows;
|
||
|
|
uniform float _Speed;
|
||
|
|
uniform float _StartFrame;
|
||
|
|
uniform float4 _MainColor;
|
||
|
|
uniform sampler2D _MaskTex;
|
||
|
|
uniform float4 _MaskTex_ST;
|
||
|
|
uniform float _Cutoff = 0.61;
|
||
|
|
|
||
|
|
inline half4 LightingUnlit( SurfaceOutput s, half3 lightDir, half atten )
|
||
|
|
{
|
||
|
|
return half4 ( 0, 0, 0, s.Alpha );
|
||
|
|
}
|
||
|
|
|
||
|
|
void surf( Input i , inout SurfaceOutput o )
|
||
|
|
{
|
||
|
|
float2 uv_TexCoord18 = i.uv_texcoord * _UVtiling;
|
||
|
|
// *** BEGIN Flipbook UV Animation vars ***
|
||
|
|
// Total tiles of Flipbook Texture
|
||
|
|
float fbtotaltiles19 = _Colums * _Rows;
|
||
|
|
// Offsets for cols and rows of Flipbook Texture
|
||
|
|
float fbcolsoffset19 = 1.0f / _Colums;
|
||
|
|
float fbrowsoffset19 = 1.0f / _Rows;
|
||
|
|
// Speed of animation
|
||
|
|
float fbspeed19 = _Time[ 1 ] * _Speed;
|
||
|
|
// UV Tiling (col and row offset)
|
||
|
|
float2 fbtiling19 = float2(fbcolsoffset19, fbrowsoffset19);
|
||
|
|
// UV Offset - calculate current tile linear index, and convert it to (X * coloffset, Y * rowoffset)
|
||
|
|
// Calculate current tile linear index
|
||
|
|
float fbcurrenttileindex19 = round( fmod( fbspeed19 + _StartFrame, fbtotaltiles19) );
|
||
|
|
fbcurrenttileindex19 += ( fbcurrenttileindex19 < 0) ? fbtotaltiles19 : 0;
|
||
|
|
// Obtain Offset X coordinate from current tile linear index
|
||
|
|
float fblinearindextox19 = round ( fmod ( fbcurrenttileindex19, _Colums ) );
|
||
|
|
// Multiply Offset X by coloffset
|
||
|
|
float fboffsetx19 = fblinearindextox19 * fbcolsoffset19;
|
||
|
|
// Obtain Offset Y coordinate from current tile linear index
|
||
|
|
float fblinearindextoy19 = round( fmod( ( fbcurrenttileindex19 - fblinearindextox19 ) / _Colums, _Rows ) );
|
||
|
|
// Reverse Y to get tiles from Top to Bottom
|
||
|
|
fblinearindextoy19 = (int)(_Rows-1) - fblinearindextoy19;
|
||
|
|
// Multiply Offset Y by rowoffset
|
||
|
|
float fboffsety19 = fblinearindextoy19 * fbrowsoffset19;
|
||
|
|
// UV Offset
|
||
|
|
float2 fboffset19 = float2(fboffsetx19, fboffsety19);
|
||
|
|
// Flipbook UV
|
||
|
|
half2 fbuv19 = uv_TexCoord18 * fbtiling19 + fboffset19;
|
||
|
|
// *** END Flipbook UV Animation vars ***
|
||
|
|
float4 tex2DNode5 = tex2D( _MainTex, fbuv19 );
|
||
|
|
o.Emission = ( ( i.vertexColor * tex2DNode5 * _MainColor ) * ( i.vertexColor.a * tex2DNode5.a * _MainColor.a ) ).rgb;
|
||
|
|
o.Alpha = 1;
|
||
|
|
float2 uv_MaskTex = i.uv_texcoord * _MaskTex_ST.xy + _MaskTex_ST.zw;
|
||
|
|
clip( tex2D( _MaskTex, uv_MaskTex ).a - _Cutoff );
|
||
|
|
}
|
||
|
|
|
||
|
|
ENDCG
|
||
|
|
}
|
||
|
|
CustomEditor "ASEMaterialInspector"
|
||
|
|
}
|
||
|
|
/*ASEBEGIN
|
||
|
|
Version=18100
|
||
|
|
7;8;1539;933;1064.165;-66.8938;1;True;True
|
||
|
|
Node;AmplifyShaderEditor.Vector2Node;20;-1783.463,-424.1539;Float;False;Property;_UVtiling;UVtiling;7;0;Create;True;0;0;False;0;False;1,1;1,1;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
|
||
|
|
Node;AmplifyShaderEditor.RangedFloatNode;16;-1522.849,0.1635742;Float;False;Property;_StartFrame;StartFrame;4;0;Create;True;0;0;False;0;False;0;13;0;0;0;1;FLOAT;0
|
||
|
|
Node;AmplifyShaderEditor.TextureCoordinatesNode;18;-1533.441,-411.0771;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
||
|
|
Node;AmplifyShaderEditor.RangedFloatNode;21;-1536.463,-84.15393;Float;False;Property;_Speed;Speed;8;0;Create;True;0;0;False;0;False;1;21;0;0;0;1;FLOAT;0
|
||
|
|
Node;AmplifyShaderEditor.RangedFloatNode;14;-1574.849,-275.8364;Float;False;Property;_Colums;Colums;6;0;Create;True;0;0;False;0;False;0;5;0;0;0;1;FLOAT;0
|
||
|
|
Node;AmplifyShaderEditor.RangedFloatNode;15;-1559.849,-174.8364;Float;False;Property;_Rows;Rows;5;0;Create;True;0;0;False;0;False;0;5;0;0;0;1;FLOAT;0
|
||
|
|
Node;AmplifyShaderEditor.TFHCFlipBookUVAnimation;19;-1208.668,-208.2096;Inherit;False;0;0;6;0;FLOAT2;0,0;False;1;FLOAT;2;False;2;FLOAT;2;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;3;FLOAT2;0;FLOAT;1;FLOAT;2
|
||
|
|
Node;AmplifyShaderEditor.ColorNode;8;-790.2756,227.9162;Float;False;Property;_MainColor;MainColor;3;1;[HDR];Create;True;0;0;False;0;False;1,1,1,1;0.8228907,0.8679245,0.8253925,0.5019608;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
||
|
|
Node;AmplifyShaderEditor.VertexColorNode;7;-767.0244,-148.2174;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
||
|
|
Node;AmplifyShaderEditor.SamplerNode;5;-877.3242,23.68254;Inherit;True;Property;_MainTex;MainTex;1;0;Create;True;0;0;False;0;False;-1;None;36586ed798fe0ee4e8d725795ae2b78b;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
||
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;3;-465.6368,145.5975;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
|
||
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;2;-468.2368,-22.10244;Inherit;False;3;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;1;COLOR;0
|
||
|
|
Node;AmplifyShaderEditor.SamplerNode;26;-721.8311,479.8636;Inherit;True;Property;_MaskTex;MaskTex;2;0;Create;True;0;0;False;0;False;-1;None;fb185c9c5e307f249a3f54b1e3ad18f1;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
||
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;1;-263.6312,46.83092;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
|
||
|
|
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;-52.04386,-11.12805;Float;False;True;-1;3;ASEMaterialInspector;0;0;Unlit;Shader/ADD_Top3;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Off;2;False;-1;7;False;-1;False;0;False;-1;0;False;-1;False;0;Custom;0.61;True;False;0;True;Opaque;;Overlay;All;14;all;True;True;True;True;0;False;-1;False;0;False;-1;255;False;-1;255;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;False;2;15;10;25;False;0.5;False;4;1;False;-1;1;False;-1;0;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;Relative;0;;0;-1;-1;-1;0;False;0;0;False;-1;-1;0;False;-1;0;0;0;False;0.1;False;-1;0;False;-1;15;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;4;FLOAT;0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0;False;9;FLOAT;0;False;10;FLOAT;0;False;13;FLOAT3;0,0,0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
|
||
|
|
WireConnection;18;0;20;0
|
||
|
|
WireConnection;19;0;18;0
|
||
|
|
WireConnection;19;1;14;0
|
||
|
|
WireConnection;19;2;15;0
|
||
|
|
WireConnection;19;3;21;0
|
||
|
|
WireConnection;19;4;16;0
|
||
|
|
WireConnection;5;1;19;0
|
||
|
|
WireConnection;3;0;7;4
|
||
|
|
WireConnection;3;1;5;4
|
||
|
|
WireConnection;3;2;8;4
|
||
|
|
WireConnection;2;0;7;0
|
||
|
|
WireConnection;2;1;5;0
|
||
|
|
WireConnection;2;2;8;0
|
||
|
|
WireConnection;1;0;2;0
|
||
|
|
WireConnection;1;1;3;0
|
||
|
|
WireConnection;0;2;1;0
|
||
|
|
WireConnection;0;10;26;4
|
||
|
|
ASEEND*/
|
||
|
|
//CHKSM=E42E46E6B02571535AC269A2D5D260CABFBBDC33
|