Shader "Hidden/2D/RenderingLayerMask" { Properties { _MainTex("Diffuse", 2D) = "white" {} _MaskTex("Mask", 2D) = "white" {} _NormalMap("Normal Map", 2D) = "bump" {} [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) } SubShader { ZWrite [_ZWrite] ZTest Off Blend Off Cull Off 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; } void UnlitFragment(Varyings input, out uint outRenderingLayers : SV_Target0) { half4 color = CommonUnlitFragment(input, input.color); if (color.a == 0.0f) discard; outRenderingLayers = GetMeshRenderingLayer(); } ENDHLSL } } }