Archived
202 lines
10 KiB
Plaintext
202 lines
10 KiB
Plaintext
// Made with Amplify Shader Editor v1.9.9.8
|
|
// Available at the Unity Asset Store - http://u3d.as/y3X
|
|
Shader "XericLibrary/UILine/UIPattern"
|
|
{
|
|
Properties
|
|
{
|
|
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
|
_Color ("Tint", Color) = (1,1,1,1)
|
|
|
|
_StencilComp ("Stencil Comparison", Float) = 8
|
|
_Stencil ("Stencil ID", Float) = 0
|
|
_StencilOp ("Stencil Operation", Float) = 0
|
|
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
|
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
|
|
|
_ColorMask ("Color Mask", Float) = 15
|
|
|
|
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
|
|
|
_Thinkness( "Thinkness", Range( 0, 1 ) ) = 0.1
|
|
_BorderColor( "Border Color", Color ) = ( 1, 1, 1, 1 )
|
|
_FillColor( "Fill Color", Color ) = ( 0.6698113, 0.6698113, 0.6698113, 0.7803922 )
|
|
_BorderColor2( "Border Color2", Color ) = ( 0, 0, 0, 0 )
|
|
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
LOD 0
|
|
|
|
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" "CanUseSpriteAtlas"="True" }
|
|
|
|
Stencil
|
|
{
|
|
Ref [_Stencil]
|
|
ReadMask [_StencilReadMask]
|
|
WriteMask [_StencilWriteMask]
|
|
Comp [_StencilComp]
|
|
Pass [_StencilOp]
|
|
}
|
|
|
|
|
|
Cull Off
|
|
Lighting Off
|
|
ZWrite Off
|
|
ZTest [unity_GUIZTestMode]
|
|
Blend One OneMinusSrcAlpha
|
|
ColorMask [_ColorMask]
|
|
|
|
|
|
Pass
|
|
{
|
|
Name "Default"
|
|
CGPROGRAM
|
|
#define ASE_VERSION 19908
|
|
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma target 3.5
|
|
|
|
#include "UnityCG.cginc"
|
|
#include "UnityUI.cginc"
|
|
|
|
#pragma multi_compile_local _ UNITY_UI_CLIP_RECT
|
|
#pragma multi_compile_local _ UNITY_UI_ALPHACLIP
|
|
|
|
#define ASE_NEEDS_TEXTURE_COORDINATES2
|
|
|
|
|
|
struct appdata_t
|
|
{
|
|
float4 vertex : POSITION;
|
|
float4 color : COLOR;
|
|
float2 texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
float4 ase_texcoord2 : TEXCOORD2;
|
|
};
|
|
|
|
struct v2f
|
|
{
|
|
float4 vertex : SV_POSITION;
|
|
fixed4 color : COLOR;
|
|
float2 texcoord : TEXCOORD0;
|
|
float4 worldPosition : TEXCOORD1;
|
|
float4 mask : TEXCOORD2;
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
float4 ase_texcoord3 : TEXCOORD3;
|
|
};
|
|
|
|
sampler2D _MainTex;
|
|
fixed4 _Color;
|
|
fixed4 _TextureSampleAdd;
|
|
float4 _ClipRect;
|
|
float4 _MainTex_ST;
|
|
float _UIMaskSoftnessX;
|
|
float _UIMaskSoftnessY;
|
|
|
|
uniform float4 _FillColor;
|
|
uniform float4 _BorderColor;
|
|
uniform float4 _BorderColor2;
|
|
uniform float _Thinkness;
|
|
|
|
|
|
v2f vert(appdata_t v )
|
|
{
|
|
v2f OUT;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
|
|
|
OUT.ase_texcoord3 = v.ase_texcoord2;
|
|
|
|
v.vertex.xyz += float3( 0, 0, 0 ) ;
|
|
|
|
float4 vPosition = UnityObjectToClipPos(v.vertex);
|
|
OUT.worldPosition = v.vertex;
|
|
OUT.vertex = vPosition;
|
|
|
|
float2 pixelSize = vPosition.w;
|
|
pixelSize /= float2(1, 1) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
|
|
|
|
float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
|
|
float2 maskUV = (v.vertex.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy);
|
|
OUT.texcoord = v.texcoord;
|
|
OUT.mask = float4(v.vertex.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_UIMaskSoftnessX, _UIMaskSoftnessY) + abs(pixelSize.xy)));
|
|
|
|
OUT.color = v.color * _Color;
|
|
return OUT;
|
|
}
|
|
|
|
fixed4 frag(v2f IN ) : SV_Target
|
|
{
|
|
//Round up the alpha color coming from the interpolator (to 1.0/256.0 steps)
|
|
//The incoming alpha could have numerical instability, which makes it very sensible to
|
|
//HDR color transparency blend, when it blends with the world's texture.
|
|
const half alphaPrecision = half(0xff);
|
|
const half invAlphaPrecision = half(1.0/alphaPrecision);
|
|
IN.color.a = round(IN.color.a * alphaPrecision)*invAlphaPrecision;
|
|
|
|
float4 texCoord4 = IN.ase_texcoord3;
|
|
texCoord4.xy = IN.ase_texcoord3.xy * float2( 1,1 ) + float2( 0,0 );
|
|
float temp_output_14_0 = ( _Thinkness - ( 1.0 - texCoord4.z ) );
|
|
float4 lerpResult24 = lerp( _BorderColor , _BorderColor2 , saturate( ( temp_output_14_0 / _Thinkness ) ));
|
|
float4 lerpResult19 = lerp( _FillColor , lerpResult24 , saturate( ( temp_output_14_0 * 1000.0 ) ));
|
|
|
|
|
|
half4 color = lerpResult19;
|
|
|
|
#ifdef UNITY_UI_CLIP_RECT
|
|
half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw);
|
|
color.a *= m.x * m.y;
|
|
#endif
|
|
|
|
#ifdef UNITY_UI_ALPHACLIP
|
|
clip (color.a - 0.001);
|
|
#endif
|
|
|
|
color.rgb *= color.a;
|
|
|
|
return color;
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
CustomEditor "AmplifyShaderEditor.MaterialInspector"
|
|
|
|
Fallback Off
|
|
}
|
|
/*ASEBEGIN
|
|
Version=19908
|
|
Node;AmplifyShaderEditor.TextureCoordinatesNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;4;-640,-384;Inherit;False;2;-1;4;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.OneMinusNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;13;-384,-384;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;2;-384,-256;Inherit;False;Property;_Thinkness;Thinkness;0;0;Create;True;0;0;0;False;0;False;0.1;0;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleSubtractOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;14;-96,-384;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleDivideOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;15;64,-384;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;17;256,-256;Inherit;False;Constant;_Float0;Float 0;2;0;Create;True;0;0;0;False;0;False;1000;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ColorNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;20;512,-256;Inherit;False;Property;_BorderColor;Border Color;1;0;Create;True;0;0;0;False;0;False;1,1,1,1;1,1,1,1;True;True;0;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
|
|
Node;AmplifyShaderEditor.ColorNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;23;512,-32;Inherit;False;Property;_BorderColor2;Border Color2;3;0;Create;True;0;0;0;False;0;False;0,0,0,0;0,0,0,0;True;True;0;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
|
|
Node;AmplifyShaderEditor.SaturateNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;28;256,-128;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;16;256,-384;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.ColorNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;21;512,-640;Inherit;False;Property;_FillColor;Fill Color;2;0;Create;True;0;0;0;False;0;False;0.6698113,0.6698113,0.6698113,0.7803922;0,0,0,0;True;True;0;6;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT3;5
|
|
Node;AmplifyShaderEditor.LerpOp, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;24;848,-176;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SaturateNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;18;416,-384;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.LerpOp, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;19;1024,-384;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode, AmplifyShaderEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null;0;1280,-384;Float;False;True;-1;3;AmplifyShaderEditor.MaterialInspector;0;12;XericLibrary/UILine/UIPattern;5056123faa0c79b47ab6ad7e8bf059a4;True;Default;0;0;Default;2;False;True;3;1;False;;10;False;;0;1;False;;0;False;;False;False;False;False;False;False;False;False;False;False;False;False;True;2;False;;False;True;True;True;True;True;0;True;_ColorMask;False;False;False;False;False;False;False;True;True;0;True;_Stencil;255;True;_StencilReadMask;255;True;_StencilWriteMask;0;True;_StencilComp;0;True;_StencilOp;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;True;2;False;;True;0;True;unity_GUIZTestMode;False;False;True;5;Queue=Transparent=Queue=0;IgnoreProjector=True;RenderType=Transparent=RenderType;PreviewType=Plane;CanUseSpriteAtlas=True;False;False;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;False;False;True;3;False;0;;0;0;Standard;0;0;1;True;False;;False;0
|
|
WireConnection;13;0;4;3
|
|
WireConnection;14;0;2;0
|
|
WireConnection;14;1;13;0
|
|
WireConnection;15;0;14;0
|
|
WireConnection;15;1;2;0
|
|
WireConnection;28;0;15;0
|
|
WireConnection;16;0;14;0
|
|
WireConnection;16;1;17;0
|
|
WireConnection;24;0;20;0
|
|
WireConnection;24;1;23;0
|
|
WireConnection;24;2;28;0
|
|
WireConnection;18;0;16;0
|
|
WireConnection;19;0;21;0
|
|
WireConnection;19;1;24;0
|
|
WireConnection;19;2;18;0
|
|
WireConnection;0;0;19;0
|
|
ASEEND*/
|
|
//CHKSM=84080EAB92253329FAA94F86E05E0DFA50E904E6 |