202 lines
9.1 KiB
Plaintext
Raw Normal View History

2025-05-18 01:04:31 +08:00
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "Cheng/Mask_UV"
{
Properties
{
_MainTex("MainTex", 2D) = "white" {}
_MainTex_U("MainTex_U", Float) = 0
_MainTex_V("MainTex_V", Float) = 0
_Mask("Mask", 2D) = "white" {}
_Mask_U("Mask_U", Float) = 0
_Mask_V("Mask_V", Float) = 0
[HDR]_Color("Color", Color) = (1,1,1,1)
_Glow("Glow", Float) = 1
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
CGINCLUDE
#pragma target 3.0
ENDCG
Blend SrcAlpha OneMinusSrcAlpha
Cull Off
ColorMask RGBA
ZWrite Off
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"
#define ASE_NEEDS_FRAG_COLOR
struct appdata
{
float4 vertex : POSITION;
float4 color : COLOR;
UNITY_VERTEX_INPUT_INSTANCE_ID
float4 ase_texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
#ifdef ASE_NEEDS_FRAG_WORLD_POSITION
float3 worldPos : TEXCOORD0;
#endif
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
float4 ase_texcoord1 : TEXCOORD1;
float4 ase_color : COLOR;
};
uniform sampler2D _MainTex;
uniform float4 _MainTex_ST;
uniform float _MainTex_U;
uniform float _MainTex_V;
uniform float4 _Color;
uniform float _Glow;
uniform sampler2D _Mask;
uniform float4 _Mask_ST;
uniform float _Mask_U;
uniform float _Mask_V;
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;
o.ase_color = v.color;
//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
float2 uv0_MainTex = i.ase_texcoord1.xy * _MainTex_ST.xy + _MainTex_ST.zw;
float2 appendResult31 = (float2(_MainTex_U , _MainTex_V));
float4 tex2DNode4 = tex2D( _MainTex, ( uv0_MainTex + ( appendResult31 * _Time.y ) ) );
float2 uv0_Mask = i.ase_texcoord1.xy * _Mask_ST.xy + _Mask_ST.zw;
float2 appendResult23 = (float2(_Mask_U , _Mask_V));
float4 tex2DNode16 = tex2D( _Mask, ( uv0_Mask + ( appendResult23 * _Time.y ) ) );
finalColor = ( ( tex2DNode4 * i.ase_color * _Color ) * ( tex2DNode4.a * _Color.a * i.ase_color.a ) * _Glow * ( tex2DNode16 * tex2DNode16.a ) );
return finalColor;
}
ENDCG
}
}
CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=18100
2560;0;2560;1378;1417.873;690.8567;1;True;True
Node;AmplifyShaderEditor.CommentaryNode;20;-1706.867,106.3077;Inherit;False;979.8544;551.9313;MaskUV;7;27;26;25;24;23;22;21;;1,1,1,1;0;0
Node;AmplifyShaderEditor.RangedFloatNode;30;-1514.362,-386.8388;Inherit;False;Property;_MainTex_U;MainTex_U;1;0;Create;True;0;0;False;0;False;0;-0.5;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;21;-1647.867,353.9792;Inherit;False;Property;_Mask_V;Mask_V;5;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;22;-1643.866,267.9795;Inherit;False;Property;_Mask_U;Mask_U;4;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;29;-1518.363,-300.8391;Inherit;False;Property;_MainTex_V;MainTex_V;2;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.TimeNode;24;-1523.413,441.2392;Inherit;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.DynamicAppendNode;31;-1294.609,-337.2791;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.DynamicAppendNode;23;-1424.113,317.5392;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.TimeNode;32;-1393.909,-213.5791;Inherit;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;25;-1212.613,362.0382;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.TextureCoordinatesNode;34;-1213.158,-498.5107;Inherit;False;0;4;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.SimpleMultiplyOpNode;33;-1083.109,-292.7801;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.TextureCoordinatesNode;26;-1342.662,156.3076;Inherit;False;0;16;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.SimpleAddOpNode;35;-812.5078,-377.0798;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.CommentaryNode;2;-511.1094,-475.0276;Inherit;False;855.9215;591.7203;Base;7;10;9;7;8;4;6;5;;1,1,1,1;0;0
Node;AmplifyShaderEditor.SimpleAddOpNode;27;-942.0117,277.7385;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0
Node;AmplifyShaderEditor.SamplerNode;4;-481.7878,-432.8279;Inherit;True;Property;_MainTex;MainTex;0;0;Create;True;0;0;False;0;False;-1;None;b0578d0bfa592784fb336d035bd77cd4;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.SamplerNode;16;-669.1262,244.5164;Inherit;True;Property;_Mask;Mask;3;0;Create;True;0;0;False;0;False;-1;None;408c581f5b7c2aa4ca065dcdd71febe9;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.VertexColorNode;5;-442.9878,-237.4279;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.ColorNode;6;-462.5697,-51.50375;Inherit;False;Property;_Color;Color;6;1;[HDR];Create;True;0;0;False;0;False;1,1,1,1;1.003922,1.003922,1.003922,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.RangedFloatNode;8;-92.34427,-83.24274;Inherit;False;Property;_Glow;Glow;7;0;Create;True;0;0;False;0;False;1;2.24;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;7;-86.18788,-206.028;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;9;-67.18788,-340.0279;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.SimpleMultiplyOpNode;15;-293.1262,261.5164;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;10;145.7155,-252.3763;Inherit;True;4;4;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;COLOR;0,0,0,0;False;1;COLOR;0
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;36;458.1234,-298.9928;Float;False;True;-1;2;ASEMaterialInspector;100;1;Cheng/Mask_UV;0770190933193b94aaa3065e307002fa;True;Unlit;0;0;Unlit;2;True;2;5;False;-1;10;False;-1;0;1;False;-1;0;False;-1;True;0;False;-1;0;False;-1;True;False;True;2;False;-1;True;True;True;True;True;0;False;-1;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;True;2;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;RenderType=Opaque=RenderType;True;2;0;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;;0
WireConnection;31;0;30;0
WireConnection;31;1;29;0
WireConnection;23;0;22;0
WireConnection;23;1;21;0
WireConnection;25;0;23;0
WireConnection;25;1;24;2
WireConnection;33;0;31;0
WireConnection;33;1;32;2
WireConnection;35;0;34;0
WireConnection;35;1;33;0
WireConnection;27;0;26;0
WireConnection;27;1;25;0
WireConnection;4;1;35;0
WireConnection;16;1;27;0
WireConnection;7;0;4;4
WireConnection;7;1;6;4
WireConnection;7;2;5;4
WireConnection;9;0;4;0
WireConnection;9;1;5;0
WireConnection;9;2;6;0
WireConnection;15;0;16;0
WireConnection;15;1;16;4
WireConnection;10;0;9;0
WireConnection;10;1;7;0
WireConnection;10;2;8;0
WireConnection;10;3;15;0
WireConnection;36;0;10;0
ASEEND*/
//CHKSM=85973EDDE7A8BB763942A1332AF539AC04209857