Init
This commit is contained in:
@ -0,0 +1,114 @@
|
||||
Shader /*ase_name*/"Hidden/Templates/Legacy/Sprites Default"/*end*/
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
_Color ("Tint", Color) = (1,1,1,1)
|
||||
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
|
||||
[PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
|
||||
/*ase_props*/
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent"
|
||||
"IgnoreProjector"="True"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
}
|
||||
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
Blend One OneMinusSrcAlpha
|
||||
|
||||
/*ase_pass*/
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX
|
||||
#define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input)
|
||||
#endif
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.5
|
||||
#pragma multi_compile _ PIXELSNAP_ON
|
||||
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA
|
||||
#include "UnityCG.cginc"
|
||||
/*ase_pragma*/
|
||||
|
||||
struct appdata_t
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
/*ase_vdata:p=p;uv0=tc0.xy;c=c*/
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
/*ase_interp(1,):sp=sp.xyzw;uv0=tc0.xy;c=c*/
|
||||
};
|
||||
|
||||
uniform fixed4 _Color;
|
||||
uniform float _EnableExternalAlpha;
|
||||
uniform sampler2D _MainTex;
|
||||
uniform sampler2D _AlphaTex;
|
||||
/*ase_globals*/
|
||||
|
||||
v2f vert( appdata_t IN /*ase_vert_input*/ )
|
||||
{
|
||||
v2f OUT;
|
||||
UNITY_SETUP_INSTANCE_ID(IN);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
||||
UNITY_TRANSFER_INSTANCE_ID(IN, OUT);
|
||||
/*ase_vert_code:IN=appdata_t;OUT=v2f*/
|
||||
|
||||
IN.vertex.xyz += /*ase_vert_out:Offset;Float3*/ float3(0,0,0) /*end*/;
|
||||
OUT.vertex = UnityObjectToClipPos(IN.vertex);
|
||||
OUT.texcoord = IN.texcoord;
|
||||
OUT.color = IN.color * _Color;
|
||||
#ifdef PIXELSNAP_ON
|
||||
OUT.vertex = UnityPixelSnap (OUT.vertex);
|
||||
#endif
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
||||
fixed4 SampleSpriteTexture (float2 uv)
|
||||
{
|
||||
fixed4 color = tex2D (_MainTex, uv);
|
||||
|
||||
#if ETC1_EXTERNAL_ALPHA
|
||||
// get the color from an external texture (usecase: Alpha support for ETC1 on android)
|
||||
fixed4 alpha = tex2D (_AlphaTex, uv);
|
||||
color.a = lerp (color.a, alpha.r, _EnableExternalAlpha);
|
||||
#endif //ETC1_EXTERNAL_ALPHA
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f IN /*ase_frag_input*/ ) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID( IN );
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( IN );
|
||||
|
||||
/*ase_frag_code:IN=v2f*/
|
||||
fixed4 c = /*ase_frag_out:Color;Float4*/SampleSpriteTexture (IN.texcoord) * IN.color/*end*/;
|
||||
c.rgb *= c.a;
|
||||
return c;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
CustomEditor "AmplifyShaderEditor.MaterialInspector"
|
||||
}
|
Reference in New Issue
Block a user