Files
KopMap/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/URP/2DUnlit.shader
2025-04-03 02:30:16 +08:00

587 lines
18 KiB
Plaintext

Shader /*ase_name*/ "Hidden/Universal/2D Unlit" /*end*/
{
Properties
{
/*ase_props*/
[HideInInspector][NoScaleOffset] unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
[HideInInspector][NoScaleOffset] unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
[HideInInspector][NoScaleOffset] unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
}
SubShader
{
/*ase_subshader_options:Name=Additional Options
Option:Vertex Position:Absolute,Relative:Relative
Absolute:SetDefine:ASE_ABSOLUTE_VERTEX_POS 1
Absolute:SetPortName:Sprite Unlit:3,Vertex Position
Relative:RemoveDefine:ASE_ABSOLUTE_VERTEX_POS 1
Relative:SetPortName:Sprite Unlit:3,Vertex Offset
Option:Debug Display:false,true:false
true:SetDefine:pragma multi_compile _ DEBUG_DISPLAY
false,disable:RemoveDefine:pragma multi_compile _ DEBUG_DISPLAY
Option:External Alpha:false,true:false
true:SetDefine:pragma multi_compile _ ETC1_EXTERNAL_ALPHA
false,disable:RemoveDefine:pragma multi_compile _ ETC1_EXTERNAL_ALPHA
*/
Tags
{
"RenderPipeline" = "UniversalPipeline"
"RenderType" = "Transparent"
"Queue" = "Transparent+0"
}
Cull Off
HLSLINCLUDE
#pragma target 2.0
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d9 // ensure rendering platforms toggle list is visible
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl"
ENDHLSL
/*ase_pass*/
Pass
{
Name "Sprite Unlit"
Tags
{
"LightMode" = "Universal2D"
}
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
ZTest LEqual
ZWrite Off
Offset 0,0
ColorMask RGBA
/*ase_stencil*/
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#define _SURFACE_TYPE_TRANSPARENT 1
#define ATTRIBUTES_NEED_NORMAL
#define ATTRIBUTES_NEED_TANGENT
#define ATTRIBUTES_NEED_TEXCOORD0
#define ATTRIBUTES_NEED_COLOR
#define VARYINGS_NEED_POSITION_WS
#define VARYINGS_NEED_TEXCOORD0
#define VARYINGS_NEED_COLOR
#define FEATURES_GRAPH_VERTEX
#define SHADERPASS SHADERPASS_SPRITEUNLIT
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
/*ase_unity_cond_begin:>=20220316*/
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
/*ase_unity_cond_end*/
/*ase_unity_cond_begin:>=20220316*/
#if ASE_SRP_VERSION >=140009
#include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
#endif
/*ase_unity_cond_end*/
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl"
/*ase_pragma*/
/*ase_globals*/
struct VertexInput
{
float4 positionOS : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
float4 uv0 : TEXCOORD0;
float4 color : COLOR;
/*ase_vdata:p=p;n=n;t=t;c=c;uv0=tc0*/
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertexOutput
{
float4 positionCS : SV_POSITION;
float4 texCoord0 : TEXCOORD0;
float4 color : TEXCOORD1;
float3 positionWS : TEXCOORD2;
/*ase_interp(3,):sp=sp;uv0=tc0;c=tc1*/
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
#if ETC1_EXTERNAL_ALPHA
TEXTURE2D(_AlphaTex); SAMPLER(sampler_AlphaTex);
float _EnableAlphaTexture;
#endif
float4 _RendererColor;
/*ase_funcs*/
VertexOutput vert( VertexInput v /*ase_vert_input*/ )
{
VertexOutput o = (VertexOutput)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
/*ase_vert_code:v=VertexInput;o=VertexOutput*/
#ifdef ASE_ABSOLUTE_VERTEX_POS
float3 defaultVertexValue = v.positionOS.xyz;
#else
float3 defaultVertexValue = float3(0, 0, 0);
#endif
float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_Vertex*/defaultVertexValue/*end*/;
#ifdef ASE_ABSOLUTE_VERTEX_POS
v.positionOS.xyz = vertexValue;
#else
v.positionOS.xyz += vertexValue;
#endif
v.normal = /*ase_vert_out:Vertex Normal;Float3;4;-1;_VNormal*/v.normal/*end*/;
v.tangent.xyz = /*ase_vert_out:Vertex Tangent;Float3;5;-1;_VTangent*/v.tangent.xyz/*end*/;
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS.xyz);
o.positionCS = vertexInput.positionCS;
o.positionWS = vertexInput.positionWS;
o.texCoord0 = v.uv0;
o.color = v.color;
return o;
}
half4 frag( VertexOutput IN /*ase_frag_input*/ ) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
/*ase_frag_code:IN=VertexOutput*/
float4 Color = /*ase_frag_out:Color;Float4;1;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/;
#if ETC1_EXTERNAL_ALPHA
float4 alpha = SAMPLE_TEXTURE2D(_AlphaTex, sampler_AlphaTex, IN.texCoord0.xy);
Color.a = lerp( Color.a, alpha.r, _EnableAlphaTexture);
#endif
#if defined(DEBUG_DISPLAY)
SurfaceData2D surfaceData;
InitializeSurfaceData(Color.rgb, Color.a, surfaceData);
InputData2D inputData;
InitializeInputData(IN.positionWS.xy, half2(IN.texCoord0.xy), inputData);
half4 debugColor = 0;
SETUP_DEBUG_DATA_2D(inputData, IN.positionWS);
if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor))
{
return debugColor;
}
#endif
Color *= IN.color * _RendererColor;
return Color;
}
ENDHLSL
}
/*ase_pass*/
Pass
{
/*ase_hide_pass:SyncP*/
Name "Sprite Unlit Forward"
Tags
{
"LightMode" = "UniversalForward"
}
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
ZTest LEqual
ZWrite Off
Offset 0,0
ColorMask RGBA
/*ase_stencil*/
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#define _SURFACE_TYPE_TRANSPARENT 1
#define ATTRIBUTES_NEED_NORMAL
#define ATTRIBUTES_NEED_TANGENT
#define ATTRIBUTES_NEED_TEXCOORD0
#define ATTRIBUTES_NEED_COLOR
#define VARYINGS_NEED_POSITION_WS
#define VARYINGS_NEED_TEXCOORD0
#define VARYINGS_NEED_COLOR
#define FEATURES_GRAPH_VERTEX
#define SHADERPASS SHADERPASS_SPRITEFORWARD
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
/*ase_unity_cond_begin:>=20220316*/
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
/*ase_unity_cond_end*/
/*ase_unity_cond_begin:>=20220316*/
#if ASE_SRP_VERSION >=140009
#include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
#endif
/*ase_unity_cond_end*/
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/SurfaceData2D.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Debug/Debugging2D.hlsl"
/*ase_pragma*/
/*ase_globals*/
struct VertexInput
{
float4 positionOS : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
float4 uv0 : TEXCOORD0;
float4 color : COLOR;
/*ase_vdata:p=p;n=n;t=t;c=c;uv0=tc0*/
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertexOutput
{
float4 positionCS : SV_POSITION;
float4 texCoord0 : TEXCOORD0;
float4 color : TEXCOORD1;
float3 positionWS : TEXCOORD2;
/*ase_interp(3,):sp=sp;uv0=tc0;c=tc1*/
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
#if ETC1_EXTERNAL_ALPHA
TEXTURE2D( _AlphaTex ); SAMPLER( sampler_AlphaTex );
float _EnableAlphaTexture;
#endif
float4 _RendererColor;
/*ase_funcs*/
VertexOutput vert( VertexInput v /*ase_vert_input*/ )
{
VertexOutput o = (VertexOutput)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
/*ase_vert_code:v=VertexInput;o=VertexOutput*/
#ifdef ASE_ABSOLUTE_VERTEX_POS
float3 defaultVertexValue = v.positionOS.xyz;
#else
float3 defaultVertexValue = float3( 0, 0, 0 );
#endif
float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;3;-1;_Vertex*/defaultVertexValue/*end*/;
#ifdef ASE_ABSOLUTE_VERTEX_POS
v.positionOS.xyz = vertexValue;
#else
v.positionOS.xyz += vertexValue;
#endif
v.normal = /*ase_vert_out:Vertex Normal;Float3;4;-1;_VNormal*/v.normal/*end*/;
v.tangent.xyz = /*ase_vert_out:Vertex Tangent;Float3;5;-1;_VTangent*/v.tangent.xyz/*end*/;
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS.xyz);
o.positionCS = vertexInput.positionCS;
o.positionWS = vertexInput.positionWS;
o.texCoord0 = v.uv0;
o.color = v.color;
return o;
}
half4 frag( VertexOutput IN /*ase_frag_input*/ ) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
/*ase_frag_code:IN=VertexOutput*/
float4 Color = /*ase_frag_out:Color;Float4;1;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/;
#if ETC1_EXTERNAL_ALPHA
float4 alpha = SAMPLE_TEXTURE2D( _AlphaTex, sampler_AlphaTex, IN.texCoord0.xy );
Color.a = lerp( Color.a, alpha.r, _EnableAlphaTexture );
#endif
#if defined(DEBUG_DISPLAY)
SurfaceData2D surfaceData;
InitializeSurfaceData(Color.rgb, Color.a, surfaceData);
InputData2D inputData;
InitializeInputData(IN.positionWS.xy, half2(IN.texCoord0.xy), inputData);
half4 debugColor = 0;
SETUP_DEBUG_DATA_2D(inputData, IN.positionWS);
if (CanDebugOverrideOutputColor(surfaceData, inputData, debugColor))
{
return debugColor;
}
#endif
Color *= IN.color * _RendererColor;
return Color;
}
ENDHLSL
}
/*ase_pass*/
Pass
{
/*ase_hide_pass*/
Name "SceneSelectionPass"
Tags
{
"LightMode" = "SceneSelectionPass"
}
Cull Off
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#define _SURFACE_TYPE_TRANSPARENT 1
#define ATTRIBUTES_NEED_NORMAL
#define ATTRIBUTES_NEED_TANGENT
#define FEATURES_GRAPH_VERTEX
#define SHADERPASS SHADERPASS_DEPTHONLY
#define SCENESELECTIONPASS 1
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
/*ase_unity_cond_begin:>=20220316*/
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
/*ase_unity_cond_end*/
/*ase_unity_cond_begin:>=20220316*/
#if ASE_SRP_VERSION >=140009
#include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
#endif
/*ase_unity_cond_end*/
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
/*ase_pragma*/
/*ase_globals*/
struct VertexInput
{
float3 positionOS : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
/*ase_vdata:p=p;n=n;t=t*/
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertexOutput
{
float4 positionCS : SV_POSITION;
/*ase_interp(0,):sp=sp*/
UNITY_VERTEX_INPUT_INSTANCE_ID
};
int _ObjectId;
int _PassValue;
/*ase_funcs*/
VertexOutput vert(VertexInput v /*ase_vert_input*/)
{
VertexOutput o = (VertexOutput)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
/*ase_vert_code:v=VertexInput;o=VertexOutput*/
#ifdef ASE_ABSOLUTE_VERTEX_POS
float3 defaultVertexValue = v.positionOS.xyz;
#else
float3 defaultVertexValue = float3(0, 0, 0);
#endif
float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;1;-1;_Vertex*/defaultVertexValue/*end*/;
#ifdef ASE_ABSOLUTE_VERTEX_POS
v.positionOS.xyz = vertexValue;
#else
v.positionOS.xyz += vertexValue;
#endif
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS.xyz);
float3 positionWS = TransformObjectToWorld(v.positionOS);
o.positionCS = TransformWorldToHClip(positionWS);
return o;
}
half4 frag(VertexOutput IN/*ase_frag_input*/) : SV_TARGET
{
/*ase_frag_code:IN=VertexOutput*/
float4 Color = /*ase_frag_out:Color;Float4;0;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/;
half4 outColor = half4(_ObjectId, _PassValue, 1.0, 1.0);
return outColor;
}
ENDHLSL
}
/*ase_pass*/
Pass
{
/*ase_hide_pass*/
Name "ScenePickingPass"
Tags
{
"LightMode" = "Picking"
}
Cull Off
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#define _SURFACE_TYPE_TRANSPARENT 1
#define ATTRIBUTES_NEED_NORMAL
#define ATTRIBUTES_NEED_TANGENT
#define FEATURES_GRAPH_VERTEX
#define SHADERPASS SHADERPASS_DEPTHONLY
#define SCENEPICKINGPASS 1
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
/*ase_unity_cond_begin:>=20220316*/
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
/*ase_unity_cond_end*/
/*ase_unity_cond_begin:>=20220316*/
#if ASE_SRP_VERSION >=140009
#include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
#endif
/*ase_unity_cond_end*/
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
/*ase_pragma*/
/*ase_globals*/
struct VertexInput
{
float3 positionOS : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
/*ase_vdata:p=p;n=n;t=t*/
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertexOutput
{
float4 positionCS : SV_POSITION;
/*ase_interp(0,):sp=sp*/
UNITY_VERTEX_INPUT_INSTANCE_ID
};
float4 _SelectionID;
/*ase_funcs*/
VertexOutput vert(VertexInput v /*ase_vert_input*/ )
{
VertexOutput o = (VertexOutput)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
/*ase_vert_code:v=VertexInput;o=VertexOutput*/
#ifdef ASE_ABSOLUTE_VERTEX_POS
float3 defaultVertexValue = v.positionOS.xyz;
#else
float3 defaultVertexValue = float3(0, 0, 0);
#endif
float3 vertexValue = /*ase_vert_out:Vertex Offset;Float3;1;-1;_Vertex*/defaultVertexValue/*end*/;
#ifdef ASE_ABSOLUTE_VERTEX_POS
v.positionOS.xyz = vertexValue;
#else
v.positionOS.xyz += vertexValue;
#endif
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS.xyz);
float3 positionWS = TransformObjectToWorld(v.positionOS);
o.positionCS = TransformWorldToHClip(positionWS);
return o;
}
half4 frag(VertexOutput IN /*ase_frag_input*/) : SV_TARGET
{
/*ase_frag_code:IN=VertexOutput*/
float4 Color = /*ase_frag_out:Color;Float4;0;-1;_Color*/float4( 1, 1, 1, 1 )/*end*/;
half4 outColor = _SelectionID;
return outColor;
}
ENDHLSL
}
/*ase_pass_end*/
}
CustomEditor "UnityEditor.ShaderGraph.GenericShaderGraphMaterialGUI"
FallBack "Hidden/Shader Graph/FallbackError"
}