Shader "ConformalDecals/Decal/{% block shader_name %}UNKNOWN{% endblock %}" { Properties { // Shader-specific properties {% block properties %} {% endblock %} // Common decal properties _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5 _DecalOpacity("Opacity", Range(0,1) ) = 1 _Background("Background Color", Color) = (0.9,0.9,0.9,0.7) [Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2 [Toggle] _ZWrite ("ZWrite", Float) = 1.0 [Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0 [Header(Effects)] [PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1 [PerRendererData]_Color("_Color", Color) = (1,1,1,1) [PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1 [PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0) [PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0 } SubShader { Tags { "Queue" = "Geometry+100" "IgnoreProjector" = "true" "DisableBatching" = "true" } Cull [_Cull] Pass { Name "FORWARD" Tags { "LightMode" = "ForwardBase" } ZWrite [_ZWrite] ZTest LEqual Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM #pragma vertex vert #pragma fragment frag_forward #pragma multi_compile_fwdbase #pragma skip_variants LIGHTMAP_ON DIRLIGHTMAP_COMBINED DYNAMICLIGHTMAP_ON LIGHTMAP_SHADOW_MIXING #pragma multi_compile_local __ DECAL_PREVIEW {% block body %} #error No body provided {% endblock %} ENDCG } Pass { Name "FORWARD" Tags { "LightMode" = "ForwardAdd" } ZWrite Off ZTest LEqual Blend SrcAlpha One Offset -1, -1 CGPROGRAM #pragma vertex vert #pragma fragment frag_forward #pragma multi_compile DIRECTIONAL SPOT POINT #pragma multi_compile __ LIGHTPROBE_SH #pragma multi_compile_local __ DECAL_PREVIEW {{ self.body() }} ENDCG } Pass { Name "DEFERRED_PREPASS" Tags { "LightMode" = "Deferred" } ZWrite Off ZTest LEqual Offset -1, -1 Blend 1 Zero OneMinusSrcColor, Zero OneMinusSrcAlpha Stencil { Ref 1 Comp Equal Pass Keep } CGPROGRAM #pragma vertex vert #pragma fragment frag_deferred_prepass #pragma target 3.0 #pragma multi_compile_local __ DECAL_PREVIEW {{ self.body() }} {% block pragmas_deferred_prepass %} {% endblock %} ENDCG } Pass { Name "DEFERRED" Tags { "LightMode" = "Deferred" } ZWrite Off ZTest LEqual Offset -1, -1 Blend 0 SrcAlpha OneMinusSrcAlpha, Zero One Blend 1 One One Blend 2 SrcAlpha OneMinusSrcAlpha, Zero One Blend 3 SrcAlpha OneMinusSrcAlpha, Zero One Stencil { Ref 1 Comp Equal Pass Keep } CGPROGRAM #pragma vertex vert #pragma fragment frag_deferred #pragma target 3.0 #pragma multi_compile __ LIGHTPROBE_SH #pragma multi_compile __ UNITY_HDR_ON #pragma multi_compile_local __ DECAL_PREVIEW {{ self.body() }} ENDCG } } }