// Drop-in clone of "Universal Render Pipeline/Lit" (URP 17) for the PLAYER avatar that adds // camouflage lighting: the player stays lit by the scene (matching its surroundings) but its 3D // form is de-emphasised, so a correctly painted avatar is harder to spot. See PlayerCamo.hlsl. // // Faithful copy of URP's Lit.shader - same properties, keywords and includes, so material values // transfer 1:1, the Lit inspector keeps working, and the runtime MeshPainter (which only sets // _BaseColor / PBR keywords on the material instance) is unaffected. TWO passes deviate from stock: // - ForwardLit: fragment is CamoForwardFragment, which reimplements URP's forward shading while // delegating GI / shadows / clustered lights to URP and applying the camo knobs. // - GBuffer: fragment is CamoGBufferFragment. The project renders forward, so this pass only feeds // HTrace WSGI's thin GBuffer - it mirrors the camo body grade (brightness/saturation) onto the // albedo and the painted-height AO remap onto the occlusion, so HTrace's injected indirect light // matches the graded forward look (see PlayerCamoGBuffer.hlsl). // All other passes (ShadowCaster, DepthOnly, DepthNormals, Meta, ...) are stock URP/Lit. Shader "Custom/PlayerCamoLit" { Properties { // --- Camouflage knobs (HalfLambert 0, Brightness 0, Saturation 0 => identical to URP/Lit) --- [Header(Camouflage)] _HalfLambert("Half Lambert (0 none, 0.5 classic, 1 flat)", Range(0.0, 1.0)) = 0.5 // Legacy property name; now a GENERAL brightness/exposure on the whole shaded body (see PlayerCamo.hlsl). _HalfLambertBrightness("Brightness (general exposure, 0 = neutral)", Range(-1.0, 1.0)) = 0.0 _Saturation("Saturation (0 = neutral, -1 = greyscale, >0 = punchier)", Range(-1.0, 1.0)) = 0.0 _SpecularDampen("Specular Dampen", Range(0.0, 1.0)) = 0.5 // Specular vs Metallic workflow _WorkflowMode("WorkflowMode", Float) = 1.0 [MainTexture] _BaseMap("Albedo", 2D) = "white" {} [MainColor] _BaseColor("Color", Color) = (1,1,1,1) _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 _Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5 _SmoothnessTextureChannel("Smoothness texture channel", Float) = 0 _Metallic("Metallic", Range(0.0, 1.0)) = 0.0 _MetallicGlossMap("Metallic", 2D) = "white" {} _SpecColor("Specular", Color) = (0.2, 0.2, 0.2) _SpecGlossMap("Specular", 2D) = "white" {} [ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0 [ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1.0 _BumpScale("Scale", Float) = 1.0 _BumpMap("Normal Map", 2D) = "bump" {} _Parallax("Scale", Range(0.005, 0.08)) = 0.005 _ParallaxMap("Height Map", 2D) = "black" {} _HeightNormalStrength("Painted Height Normal Strength", Range(0.0, 50.0)) = 8.0 // Runtime knobs for the painted-height look (1 = base, tuned live in the paint HUD): _HeightNormalIntensity("Painted Height Normal Intensity", Range(0.0, 2.0)) = 1.4 // AO darkening DEPTH (shift): AO fades from 1 down to (1 - this) at the deepest painted hole. // 0 = no darkening (no black spots), 1 = full black at occ=0. _OcclusionThreshold("Painted Occlusion AO Shift", Range(0.0, 1.0)) = 0.2 _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0 _OcclusionMap("Occlusion", 2D) = "white" {} [HDR] _EmissionColor("Color", Color) = (0,0,0) _EmissionMap("Emission", 2D) = "white" {} // Second, "see-through-walls" emission color for the XRayOverlay pass (additive reveal glow). // HDR rgb = glow color, alpha = fade/opacity master. Default (0,0,0,0) => additive term is // zero, so the avatar looks unchanged until something fades this in at runtime. [HDR] _XRayColor("X-Ray Overlay Color", Color) = (0,0,0,0) // Optional breathing pulse for the X-ray glow (driven by _Time). Speed 0 => steady, identical to // no pulse; strength = modulation depth (how far the trough dims below the peak). Shape bends the // pulse into an asymmetric curve: 1 = smooth (raised-cosine) breathe, higher = a longer near-off // plateau that rises to a brief full-intensity peak. Applied identically to the visible (ForwardLit) // and occluded (XRayOverlay) halves so they stay in phase. _XRayPulseSpeed("X-Ray Pulse Speed", Float) = 3 _XRayPulseStrength("X-Ray Pulse Strength", Range(0,1)) = 0.5 _XRayPulseShape("X-Ray Pulse Shape", Range(1,8)) = 3 _DetailMask("Detail Mask", 2D) = "white" {} _DetailAlbedoMapScale("Scale", Range(0.0, 2.0)) = 1.0 _DetailAlbedoMap("Detail Albedo x2", 2D) = "linearGrey" {} _DetailNormalMapScale("Scale", Range(0.0, 2.0)) = 1.0 [Normal] _DetailNormalMap("Normal Map", 2D) = "bump" {} // SRP batching compatibility for Clear Coat (Not used in Lit) [HideInInspector] _ClearCoatMask("_ClearCoatMask", Float) = 0.0 [HideInInspector] _ClearCoatSmoothness("_ClearCoatSmoothness", Float) = 0.0 // Blending state _Surface("__surface", Float) = 0.0 _Blend("__blend", Float) = 0.0 _Cull("__cull", Float) = 2.0 [ToggleUI] _AlphaClip("__clip", Float) = 0.0 [HideInInspector] _SrcBlend("__src", Float) = 1.0 [HideInInspector] _DstBlend("__dst", Float) = 0.0 [HideInInspector] _SrcBlendAlpha("__srcA", Float) = 1.0 [HideInInspector] _DstBlendAlpha("__dstA", Float) = 0.0 [HideInInspector] _ZWrite("__zw", Float) = 1.0 [HideInInspector] _BlendModePreserveSpecular("_BlendModePreserveSpecular", Float) = 1.0 [HideInInspector] _AlphaToMask("__alphaToMask", Float) = 0.0 [HideInInspector] _AddPrecomputedVelocity("_AddPrecomputedVelocity", Float) = 0.0 [HideInInspector] _XRMotionVectorsPass("_XRMotionVectorsPass", Float) = 1.0 [ToggleUI] _ReceiveShadows("Receive Shadows", Float) = 1.0 // Editmode props _QueueOffset("Queue offset", Float) = 0.0 // ObsoleteProperties [HideInInspector] _MainTex("BaseMap", 2D) = "white" {} [HideInInspector] _Color("Base Color", Color) = (1, 1, 1, 1) [HideInInspector] _GlossMapScale("Smoothness", Float) = 0.0 [HideInInspector] _Glossiness("Smoothness", Float) = 0.0 [HideInInspector] _GlossyReflections("EnvironmentReflections", Float) = 0.0 [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} } SubShader { Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" "UniversalMaterialType" = "Lit" "IgnoreProjector" = "True" } LOD 300 // ------------------------------------------------------------------ // Forward pass. Shades all light in a single pass. GI + emission + Fog Pass { Name "ForwardLit" Tags { "LightMode" = "UniversalForward" } // ------------------------------------- // Render State Commands Blend[_SrcBlend][_DstBlend], [_SrcBlendAlpha][_DstBlendAlpha] ZWrite[_ZWrite] Cull[_Cull] AlphaToMask[_AlphaToMask] HLSLPROGRAM #pragma target 2.0 // ------------------------------------- // Shader Stages #pragma vertex LitPassVertex #pragma fragment CamoForwardFragment // ------------------------------------- // Material Keywords #pragma shader_feature_local _NORMALMAP #pragma shader_feature_local _PARALLAXMAP #pragma shader_feature_local _RECEIVE_SHADOWS_OFF #pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED #pragma shader_feature_local_fragment _SURFACE_TYPE_TRANSPARENT #pragma shader_feature_local_fragment _ALPHATEST_ON #pragma shader_feature_local_fragment _ _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON #pragma shader_feature_local_fragment _EMISSION #pragma shader_feature_local_fragment _METALLICSPECGLOSSMAP #pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A #pragma shader_feature_local_fragment _OCCLUSIONMAP #pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF #pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF #pragma shader_feature_local_fragment _SPECULAR_SETUP // ------------------------------------- // Universal Pipeline keywords #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION #pragma multi_compile_fragment _ _REFLECTION_PROBE_ATLAS #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION #pragma multi_compile_fragment _ _SCREEN_SPACE_IRRADIANCE #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma multi_compile_fragment _ _LIGHT_COOKIES #pragma multi_compile _ _LIGHT_LAYERS #pragma multi_compile _ _CLUSTER_LIGHT_LOOP #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" // ------------------------------------- // Unity defined keywords #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING #pragma multi_compile _ SHADOWS_SHADOWMASK #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile_fragment _ LIGHTMAP_BICUBIC_SAMPLING #pragma multi_compile_fragment _ REFLECTION_PROBE_ROTATION #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile _ USE_LEGACY_LIGHTMAPS #pragma multi_compile _ LOD_FADE_CROSSFADE #pragma multi_compile_fragment _ DEBUG_DISPLAY #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Fog.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" //-------------------------------------- // GPU Instancing #pragma multi_compile_instancing #pragma instancing_options renderinglayer #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Shaders/LitForwardPass.hlsl" #include "PlayerCamo.hlsl" ENDHLSL } // ------------------------------------------------------------------ // X-Ray overlay - the OCCLUDED half of "see the player anywhere". This pass draws the additive // reveal glow only where the avatar is HIDDEN behind geometry (ZTest Greater). The VISIBLE half // is added directly in the ForwardLit fragment (PlayerCamo.hlsl, _XRayColor); visible (forward) // and occluded (this pass) are mutually exclusive by depth => no double glow. ZWrite Off so it // never disturbs depth. // // IMPORTANT - dispatch: the LightMode is the CUSTOM tag "XRayReveal", NOT a URP built-in, so // URP's default opaque DrawObjectsPass never draws it. Instead a "Render Objects" renderer // feature (on PC_Renderer / Mobile_Renderer, event AfterRenderingOpaques, Pass Names = // ["XRayReveal"]) dispatches it AFTER all opaque geometry has written depth. That is what makes // ZTest Greater robust: the whole depth buffer is populated, so occlusion is correct regardless // of opaque sort order. The earlier SRPDefaultUnlit variant drew DURING the opaque phase and was // sort-order dependent - if the occluder had not written depth yet, Greater failed and the glow // vanished depending on camera angle/distance. => This pass RELIES on that renderer feature; drop // the feature and the occluded glow won't render. // // Off by default (_XRayColor alpha 0 => additive term zero); a runtime driver fades the color in // during the resolution phase. Plain color property, no keyword => nothing for the stripper to drop. Pass { Name "XRayOverlay" Tags { "LightMode" = "XRayReveal" } // ------------------------------------- // Render State Commands Blend SrcAlpha One // additive: framebuffer += alpha * rgb ZWrite Off ZTest Greater // occluded parts only; the visible parts glow from the forward pass Cull[_Cull] HLSLPROGRAM #pragma target 2.0 // ------------------------------------- // Shader Stages #pragma vertex XRayOverlayVertex #pragma fragment XRayOverlayFragment //-------------------------------------- // GPU Instancing #pragma multi_compile_instancing #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" // Declared outside UnityPerMaterial like the camo knobs (this material already breaks the // SRP batcher, see PlayerCamo.hlsl), so there is no CBUFFER-layout match to keep here. half4 _XRayColor; half _XRayPulseSpeed; // 0 = steady; otherwise breathing pulse via _Time (same math as the forward half) half _XRayPulseStrength; // modulation depth: how far the trough dims below the full-intensity peak half _XRayPulseShape; // >1 bends the pulse: longer near-off plateau, rising to a brief full peak struct XRayAttributes { float4 positionOS : POSITION; UNITY_VERTEX_INPUT_INSTANCE_ID }; struct XRayVaryings { float4 positionCS : SV_POSITION; UNITY_VERTEX_INPUT_INSTANCE_ID UNITY_VERTEX_OUTPUT_STEREO }; XRayVaryings XRayOverlayVertex(XRayAttributes input) { XRayVaryings output = (XRayVaryings)0; UNITY_SETUP_INSTANCE_ID(input); UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); output.positionCS = TransformObjectToHClip(input.positionOS.xyz); return output; } half4 XRayOverlayFragment(XRayVaryings input) : SV_Target { UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); // Flat additive glow: HDR rgb is the reveal color, alpha the fade/opacity master. Asymmetric // breathing pulse on the alpha master; kept in phase with the forward half via the shared // _Time and identical math. Speed 0 => term is 1 => steady glow. See CamoForwardFragment. half xrayCurve = pow(0.5h - 0.5h * cos(_Time.y * _XRayPulseSpeed), _XRayPulseShape); half xrayPulse = 1.0h - _XRayPulseStrength * (1.0h - xrayCurve); return half4(_XRayColor.rgb, _XRayColor.a * xrayPulse); } ENDHLSL } Pass { Name "ShadowCaster" Tags { "LightMode" = "ShadowCaster" } // ------------------------------------- // Render State Commands ZWrite On ZTest LEqual ColorMask 0 Cull[_Cull] HLSLPROGRAM #pragma target 2.0 // ------------------------------------- // Shader Stages #pragma vertex ShadowPassVertex #pragma fragment ShadowPassFragment // ------------------------------------- // Material Keywords #pragma shader_feature_local _ALPHATEST_ON #pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A //-------------------------------------- // GPU Instancing #pragma multi_compile_instancing #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" // ------------------------------------- // Universal Pipeline keywords // ------------------------------------- // Unity defined keywords #pragma multi_compile _ LOD_FADE_CROSSFADE // This is used during shadow map generation to differentiate between directional and punctual light shadows, as they use different formulas to apply Normal Bias #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW // ------------------------------------- // Includes #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Shaders/ShadowCasterPass.hlsl" ENDHLSL } Pass { Name "GBuffer" Tags { "LightMode" = "UniversalGBuffer" } // ------------------------------------- // Render State Commands ZWrite[_ZWrite] ZTest LEqual Cull[_Cull] HLSLPROGRAM #pragma target 4.5 // Deferred Rendering Path does not support the OpenGL-based graphics API: // Desktop OpenGL, OpenGL ES 3.0, WebGL 2.0. #pragma exclude_renderers gles3 glcore // ------------------------------------- // Shader Stages #pragma vertex LitGBufferPassVertex #pragma fragment CamoGBufferFragment // ------------------------------------- // Material Keywords #pragma shader_feature_local _NORMALMAP #pragma shader_feature_local_fragment _ALPHATEST_ON //#pragma shader_feature_local_fragment _ALPHAPREMULTIPLY_ON #pragma shader_feature_local_fragment _EMISSION #pragma shader_feature_local_fragment _METALLICSPECGLOSSMAP #pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A #pragma shader_feature_local_fragment _OCCLUSIONMAP #pragma shader_feature_local _PARALLAXMAP #pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED #pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF #pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF #pragma shader_feature_local_fragment _SPECULAR_SETUP #pragma shader_feature_local _RECEIVE_SHADOWS_OFF // ------------------------------------- // Universal Pipeline keywords #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN //#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS //#pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED #pragma multi_compile _ _CLUSTER_LIGHT_LOOP #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" // ------------------------------------- // Unity defined keywords #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING #pragma multi_compile _ SHADOWS_SHADOWMASK #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile_fragment _ LIGHTMAP_BICUBIC_SAMPLING #pragma multi_compile_fragment _ REFLECTION_PROBE_ROTATION #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile _ USE_LEGACY_LIGHTMAPS #pragma multi_compile _ LOD_FADE_CROSSFADE #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT #pragma multi_compile_fragment _ _SCREEN_SPACE_IRRADIANCE #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" //-------------------------------------- // GPU Instancing #pragma multi_compile_instancing #pragma instancing_options renderinglayer #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" // ------------------------------------- // Includes #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Shaders/LitGBufferPass.hlsl" #include "PlayerCamoGBuffer.hlsl" ENDHLSL } Pass { Name "DepthOnly" Tags { "LightMode" = "DepthOnly" } // ------------------------------------- // Render State Commands ZWrite On ColorMask R Cull[_Cull] HLSLPROGRAM #pragma target 2.0 // ------------------------------------- // Shader Stages #pragma vertex DepthOnlyVertex #pragma fragment DepthOnlyFragment // ------------------------------------- // Material Keywords #pragma shader_feature_local _ALPHATEST_ON #pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A // ------------------------------------- // Unity defined keywords #pragma multi_compile _ LOD_FADE_CROSSFADE //-------------------------------------- // GPU Instancing #pragma multi_compile_instancing #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" // ------------------------------------- // Includes #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Shaders/DepthOnlyPass.hlsl" ENDHLSL } // This pass is used when drawing to a _CameraNormalsTexture texture Pass { Name "DepthNormals" Tags { "LightMode" = "DepthNormals" } // ------------------------------------- // Render State Commands ZWrite On Cull[_Cull] HLSLPROGRAM #pragma target 2.0 // ------------------------------------- // Shader Stages #pragma vertex DepthNormalsVertex #pragma fragment DepthNormalsFragment // ------------------------------------- // Material Keywords #pragma shader_feature_local _NORMALMAP #pragma shader_feature_local _PARALLAXMAP #pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED #pragma shader_feature_local _ALPHATEST_ON #pragma shader_feature_local_fragment _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A // ------------------------------------- // Unity defined keywords #pragma multi_compile _ LOD_FADE_CROSSFADE // ------------------------------------- // Universal Pipeline keywords #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" //-------------------------------------- // GPU Instancing #pragma multi_compile_instancing #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" // ------------------------------------- // Includes #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Shaders/LitDepthNormalsPass.hlsl" ENDHLSL } // This pass it not used during regular rendering, only for lightmap baking. Pass { Name "Meta" Tags { "LightMode" = "Meta" } // ------------------------------------- // Render State Commands Cull Off HLSLPROGRAM #pragma target 2.0 // ------------------------------------- // Shader Stages #pragma vertex UniversalVertexMeta #pragma fragment UniversalFragmentMetaLit // ------------------------------------- // Material Keywords #pragma shader_feature_local_fragment _SPECULAR_SETUP #pragma shader_feature_local_fragment _EMISSION #pragma shader_feature_local_fragment _METALLICSPECGLOSSMAP #pragma shader_feature_local_fragment _ALPHATEST_ON #pragma shader_feature_local_fragment _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A #pragma shader_feature_local _ _DETAIL_MULX2 _DETAIL_SCALED #pragma shader_feature_local_fragment _SPECGLOSSMAP #pragma shader_feature EDITOR_VISUALIZATION // ------------------------------------- // Includes #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Shaders/LitMetaPass.hlsl" ENDHLSL } Pass { Name "Universal2D" Tags { "LightMode" = "Universal2D" } // ------------------------------------- // Render State Commands Blend[_SrcBlend][_DstBlend] ZWrite[_ZWrite] Cull[_Cull] HLSLPROGRAM #pragma target 2.0 // ------------------------------------- // Shader Stages #pragma vertex vert #pragma fragment frag // ------------------------------------- // Material Keywords #pragma shader_feature_local_fragment _ALPHATEST_ON #pragma shader_feature_local_fragment _ALPHAPREMULTIPLY_ON #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" // ------------------------------------- // Includes #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl" #include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/Universal2D.hlsl" ENDHLSL } Pass { Name "MotionVectors" Tags { "LightMode" = "MotionVectors" } ColorMask RG HLSLPROGRAM #pragma shader_feature_local _ALPHATEST_ON #pragma multi_compile _ LOD_FADE_CROSSFADE #pragma shader_feature_local_vertex _ADD_PRECOMPUTED_VELOCITY #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ObjectMotionVectors.hlsl" ENDHLSL } Pass { Name "XRMotionVectors" Tags { "LightMode" = "XRMotionVectors" } ColorMask RGBA // Stencil write for obj motion pixels Stencil { WriteMask 1 Ref 1 Comp Always Pass Replace } HLSLPROGRAM #pragma shader_feature_local _ALPHATEST_ON #pragma multi_compile _ LOD_FADE_CROSSFADE #pragma shader_feature_local_vertex _ADD_PRECOMPUTED_VELOCITY #define APPLICATION_SPACE_WARP_MOTION 1 #include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ObjectMotionVectors.hlsl" ENDHLSL } } FallBack "Hidden/Universal Render Pipeline/FallbackError" //CustomEditor "UnityEditor.Rendering.Universal.ShaderGUI.LitShader" }