75 lines
2.5 KiB
Plaintext
75 lines
2.5 KiB
Plaintext
Shader "Universal Render Pipeline/2D/Sprite-Unlit-Default"
|
|
{
|
|
Properties
|
|
{
|
|
_MainTex ("Sprite Texture", 2D) = "white" {}
|
|
[MaterialToggle] _ZWrite("ZWrite", Float) = 0
|
|
|
|
// Legacy properties. They're here so that materials using this shader can gracefully fallback to the legacy sprite shader.
|
|
[HideInInspector] _Color ("Tint", Color) = (1,1,1,1)
|
|
[HideInInspector] PixelSnap ("Pixel snap", Float) = 0
|
|
[HideInInspector] _RendererColor ("RendererColor", Color) = (1,1,1,1)
|
|
[HideInInspector] _AlphaTex ("External Alpha", 2D) = "white" {}
|
|
[HideInInspector] _EnableExternalAlpha ("Enable External Alpha", Float) = 0
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
Tags {"Queue" = "Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" }
|
|
|
|
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
Cull Off
|
|
ZWrite [_ZWrite]
|
|
|
|
Pass
|
|
{
|
|
HLSLPROGRAM
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/Core2D.hlsl"
|
|
|
|
#pragma vertex UnlitVertex
|
|
#pragma fragment UnlitFragment
|
|
|
|
struct Attributes
|
|
{
|
|
COMMON_2D_INPUTS
|
|
half4 color : COLOR;
|
|
UNITY_SKINNED_VERTEX_INPUTS
|
|
};
|
|
|
|
struct Varyings
|
|
{
|
|
COMMON_2D_OUTPUTS
|
|
half4 color : COLOR;
|
|
};
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/2DCommon.hlsl"
|
|
|
|
// GPU Instancing
|
|
#pragma multi_compile_instancing
|
|
#pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE
|
|
|
|
// NOTE: Do not ifdef the properties here as SRP batcher can not handle different layouts.
|
|
CBUFFER_START(UnityPerMaterial)
|
|
half4 _Color;
|
|
CBUFFER_END
|
|
|
|
Varyings UnlitVertex(Attributes input)
|
|
{
|
|
UNITY_SKINNED_VERTEX_COMPUTE(input);
|
|
SetUpSpriteInstanceProperties();
|
|
input.positionOS = UnityFlipSprite(input.positionOS, unity_SpriteProps.xy);
|
|
|
|
Varyings o = CommonUnlitVertex(input);
|
|
o.color = input.color *_Color * unity_SpriteColor;
|
|
return o;
|
|
}
|
|
|
|
half4 UnlitFragment(Varyings input) : SV_Target
|
|
{
|
|
return CommonUnlitFragment(input, input.color);
|
|
}
|
|
ENDHLSL
|
|
}
|
|
}
|
|
}
|