Shader "HDRP/Toon" { Properties { //TODO: Use custom rendering data. [ToggleUI] _UseShadowThreshold("_UseShadowThreshold", Float) = 0.0 _AlphaCutoffShadow("_AlphaCutoffShadow", Range(0.0, 1.0)) = 0.5 _AlphaCutoffPrepass("_AlphaCutoffPrepass", Range(0.0, 1.0)) = 0.5 _AlphaCutoffPostpass("_AlphaCutoffPostpass", Range(0.0, 1.0)) = 0.5 [ToggleUI] _TransparentDepthPrepassEnable("_TransparentDepthPrepassEnable", Float) = 0.0 [ToggleUI] _TransparentBackfaceEnable("_TransparentBackfaceEnable", Float) = 0.0 [ToggleUI] _TransparentDepthPostpassEnable("_TransparentDepthPostpassEnable", Float) = 0.0 _TransparentSortPriority("_TransparentSortPriority", Float) = 0 // Transparency [Enum(None, 0, Box, 1, Sphere, 2, Thin, 3)]_RefractionModel("Refraction Model", Int) = 0 [Enum(Proxy, 1, HiZ, 2)]_SSRefractionProjectionModel("Refraction Projection Model", Int) = 1 _Ior("Index Of Refraction", Range(1.0, 2.5)) = 1.0 _ThicknessMultiplier("Thickness Multiplier", Float) = 1.0 _TransmittanceColor("Transmittance Color", Color) = (1.0, 1.0, 1.0) _TransmittanceColorMap("TransmittanceColorMap", 2D) = "white" {} _ATDistance("Transmittance Absorption Distance", Float) = 1.0 [ToggleUI] _TransparentWritingMotionVec("_TransparentWritingMotionVec", Float) = 0.0 // Forward [HideInInspector] _StencilRef("_StencilRef", Int) = 2 // StencilLightingUsage.RegularLighting [HideInInspector] _StencilWriteMask("_StencilWriteMask", Int) = 3 // StencilMask.Lighting // GBuffer [HideInInspector] _StencilRefGBuffer("_StencilRefGBuffer", Int) = 2 // StencilLightingUsage.RegularLighting [HideInInspector] _StencilWriteMaskGBuffer("_StencilWriteMaskGBuffer", Int) = 3 // StencilMask.Lighting // Depth prepass [HideInInspector] _StencilRefDepth("_StencilRefDepth", Int) = 0 // Nothing [HideInInspector] _StencilWriteMaskDepth("_StencilWriteMaskDepth", Int) = 32 // DoesntReceiveSSR // Motion vector pass [HideInInspector] _StencilRefMV("_StencilRefMV", Int) = 128 // StencilBitMask.ObjectMotionVectors [HideInInspector] _StencilWriteMaskMV("_StencilWriteMaskMV", Int) = 128 // StencilBitMask.ObjectMotionVectors // Distortion vector pass [HideInInspector] _StencilRefDistortionVec("_StencilRefDistortionVec", Int) = 64 // StencilBitMask.DistortionVectors [HideInInspector] _StencilWriteMaskDistortionVec("_StencilWriteMaskDistortionVec", Int) = 64 // StencilBitMask.DistortionVectors // Blending state [HideInInspector] _SurfaceType("__surfacetype", Float) = 0.0 [HideInInspector] _BlendMode("__blendmode", Float) = 0.0 [HideInInspector] _SrcBlend("__src", Float) = 1.0 [HideInInspector] _DstBlend("__dst", Float) = 0.0 [HideInInspector] _AlphaSrcBlend("__alphaSrc", Float) = 1.0 [HideInInspector] _AlphaDstBlend("__alphaDst", Float) = 0.0 [HideInInspector][ToggleUI] _ZWrite("__zw", Float) = 1.0 [HideInInspector][ToggleUI] _TransparentZWrite("_TransparentZWrite", Float) = 0.0 [HideInInspector] _CullModeForward("__cullmodeForward", Float) = 2.0 // This mode is dedicated to Forward to correctly handle backface then front face rendering thin transparent [HideInInspector] _TransparentCullMode("_TransparentCullMode", Int) = 2 // Back culling by default [HideInInspector] _ZTestDepthEqualForOpaque("_ZTestDepthEqualForOpaque", Int) = 4 // Less equal [HideInInspector] _ZTestModeDistortion("_ZTestModeDistortion", Int) = 8 [HideInInspector] _ZTestGBuffer("_ZTestGBuffer", Int) = 4 [HideInInspector] _ZTestMode("_ZTestMode", Int) = 4 [Enum(UnityEngine.Rendering.CompareFunction)] _ZTestTransparent("Transparent ZTest", Int) = 4 // Less equal [ToggleUI] _EnableFogOnTransparent("Enable Fog", Float) = 1.0 [ToggleUI] _EnableBlendModePreserveSpecularLighting("Enable Blend Mode Preserve Specular Lighting", Float) = 1.0 [ToggleUI] _DoubleSidedEnable("Double sided enable", Float) = 0.0 [Enum(Flip, 0, Mirror, 1, None, 2)] _DoubleSidedNormalMode("Double sided normal mode", Float) = 1 [HideInInspector] _DoubleSidedConstants("_DoubleSidedConstants", Vector) = (1, 1, -1, 0) [HideInInspector] _UVMappingMask("_UVMappingMask", Color) = (1, 0, 0, 0) // HACK: GI Baking system relies on some properties existing in the shader ("_MainTex", "_Cutoff" and "_Color") for opacity handling, so we need to store our version of those parameters in the hard-coded name the GI baking system recognizes. _MainTex("Base Map", 2D) = "white" {} _Color("Color", Color) = (1,1,1,1) _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- //NOTE: UTS properties //TODO: Move more properties here for better organization // Surface Options [Popup] _TransparentEnabled("Transparent Mode", Integer) = 0 [Popup(_ALPHATEST_ON)] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0.0 _AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 [Enum(Off, 0, Front, 1, Back, 2)] _CullMode("Cull Mode", Integer) = 2 [KeywordEnum(Standard, SDF)] _Shading_Mode("Shading mode", Integer) = 0 [KeywordEnum(Standard, FrontHair, Face, Eye)] _Material_Type("Material Type", Integer) = 0 [KeywordEnum(Off, Standard, Anisotropy, Hair, Toon)] _PBR_Mode("PBR Mode", Integer) = 0 [PassPopup(HairBlendingTarget)] _HairBlendingTarget("Hair Blending Target", Integer) = 0 [EnumFlagsUI(Misaki.HdrpToon.SurfaceFeature, Misaki.HdrpToon)]_SurfaceFeatures("Surface Features", Integer) = 0 // Shading Color [Popup] _Use_Shading_Ramp_Map("Use Shading Ramp Map", Integer) = 0 _BaseColor("BaseColor", Color) = (1,1,1,1) _BaseColorMap("BaseColorMap", 2D) = "white" {} [HideInInspector] _BaseColorMap_MipInfo("_BaseColorMap_MipInfo", Vector) = (0, 0, 0, 0) _1stShadeColor("1st_ShadeColor", Color) = (0, 0, 0, 0) _1stShadeColorMap("1st_ShadeMap", 2D) = "white" {} [ToggleUI] _UseBaseAs1st("Use BaseMap as 1st_ShadeMap", Float) = 1 _2ndShadeColor("2nd_ShadeColor", Color) = (0, 0, 0, 0) _2ndShadeColorMap("2nd_ShadeMap", 2D) = "white" {} [ToggleUI] _Use1stAs2nd("Use 1st_ShadeMap as 2nd_ShadeMap", Float) = 1 _1stShadeColorStep("1st ShadeColor Step", Range(0, 1)) = 0.5 _1stShadeColorFeather("1st ShadeColor Feather", Range(0.0001, 1)) = 0.0001 _2ndShadeColorStep("2nd ShadeColor Step", Range(0, 1)) = 0 _2ndShadeColorFeather("2nd ShadeColor Feather", Range(0.0001, 1)) = 0.0001 _ShadingRampMap("ShadingRampMap", 2DArray) = "white" {} _ShadingIndex("ShadingIndex", Integer) = 0 _ShadingRampMaskMap("ShadingRampMaskMap", 2D) = "white" {} _ShadingRampMask("ShadingRampMask", Range(0, 1)) = 1 _SDFShadingMap("SDFShadingMap", 2D) = "white" {} _SDFShadowLevel("SDFShadowLevel", Range(0.0, 1.0)) = 0.25 _SDFShadowSmoothLevel("SDFShadowSmoothLevel", Range(0.0, 0.1)) = 0.02 _SDFHighlightStrength("SDFHighlightStrength", Range(0.0, 1.0)) = 0.75 // Shadow [Popup] _Receive_Light_Shadow("Receive Light Shadow", Integer) = 0 [Popup] _Receive_Screen_Space_Shadow("Receive Screen Space Shadow", Integer) = 0 [Popup] _Receive_Hair_Shadow("Receive Hair Shadow", Integer) = 0 _ShadowDistanceBias("ShadowBias", Range(0.0, 5.0)) = 0.0 _ShadowNormalBias("ShadowNormalBias", Range(0.0, 5.0)) = 0.0 //_Tweak_SystemShadowsLevel("Tweak_SystemShadowsLevel", Range(-0.5, 0.5)) = 0 // Surface Inputs _NormalMap("NormalMap", 2D) = "bump" {} // Tangent space normal map _NormalScale("_NormalScale", Range(0.0, 8.0)) = 1 _Metallic("_Metallic", Range(0.0, 1.0)) = 0 _Smoothness("Smoothness", Range(0.0, 1.0)) = 0.0 _MaskMap("MaskMap", 2D) = "white" {} _MetallicRemapMin("MetalicRemapMin", Float) = 0.0 _MetallicRemapMax("MetalicRemapMax", Float) = 1.0 _SmoothnessRemapMin("RoughnessRemapMin", Float) = 0.0 _SmoothnessRemapMax("RoughnessRemapMax", Float) = 1.0 _AlphaRemapMin("AlphaRemapMin", Float) = 0.0 _AlphaRemapMax("AlphaRemapMax", Float) = 1.0 _AORemapMin("AORemapMin", Float) = 0.0 _AORemapMax("AORemapMax", Float) = 1.0 _Anisotropy("Anisotropy", Range(-1.0, 1.0)) = 0 _AnisotropyMap("AnisotropyMap", 2D) = "white" {} _KKColor("BaseColor", Color) = (1,1,1,1) _BSDFContribution("_BSDFContribution", Range(0.0,1.0)) = 0 [ToggleUI] _EnergyConservingSpecularColor("_EnergyConservingSpecularColor", Float) = 1.0 _SpecularColor("SpecularColor", Color) = (1, 1, 1, 1) _SpecularColorMap("SpecularColorMap", 2D) = "white" {} _ToonSpecularStep("Toon Specular Step", Range(0.0, 1.0)) = 0.5 _ToonSpecularFeather("Toon Specular Feather", Range(0.0, 1.0)) = 0.0 _HairBlendingMap("HairBlendingMap", 2D) = "black" {} // Emissive [HDR] _EmissiveColor("EmissiveColor", Color) = (0, 0, 0) // Used only to serialize the LDR and HDR emissive color in the material UI, // in the shader only the _EmissiveColor should be used [HideInInspector] _EmissiveColorLDR("EmissiveColor LDR", Color) = (0, 0, 0) _EmissiveColorMap("EmissiveColorMap", 2D) = "white" {} _EmissiveIntensity("Emissive Intensity", Float) = 1 [ToggleUI] _AlbedoAffectEmissive("Albedo Affect Emissive", Float) = 0.0 _EmissiveExposureWeight("Emissive Pre Exposure", Range(0.0, 1.0)) = 1.0 // Ambient [KeywordEnum(Off, IBL, MatCap, Ramp)]_Indirect_Diffuse_Mode("_Indirect_Diffuse_Mode", Integer) = 1 [KeywordEnum(Off, IBL, MatCap)]_Indirect_Specular_Mode("_Indirect_Specular_Mode", Integer) = 1 _IndirectDiffuseMatCapMap("IndirectDiffuseMatCapMap", 2D) = "black" {} _IndirectDiffuseMatCapLod("IndirectDiffuseMatCapMapLOD", Range(-5, 5)) = 0.0 _IndirectDiffuseIntensity("Indirect Diffuse Intensity", Range(0, 5)) = 1.0 _SSAOWeight("SSAO Weight", Range(0.0, 1.0)) = 1.0 _SSGIWeight("SSGI Weight", Range(0.0, 1.0)) = 1.0 _IndirectSpecularMatCapMap("IndirectSpecularMatCapMap", 2D) = "black" {} _IndirectSpecularMatCapLod("IndirectSpecularMatCapMapLOD", Range(-5, 5)) = 0.0 _IndirectSpecularIntensity("Indirect Specular Intensity", Range(0, 5)) = 1.0 _SSRWeight("SSR Weight", Range(0.0, 1.0)) = 1.0 // Rim Light _RimLightColor("Rim Light Color", Color) = (1, 1, 1, 1) _RimLightIntensity("Rim Light Intensity", Range(0, 10)) = 1 [Popup] _Screen_Space_Rim_Light ("Screen Space Rim Light", Integer) = 0 _RimLightLevel("RimLight Level", Range(0, 1)) = 0.1 [ToggleUI] _RimLightClipping("Rim Light Clipping", Float) = 0.25 _RimLightClippingLevel("Rim Light Clipping Level", Range(0.0001, 1)) = 0.0001 [Popup] _Light_Base_Rim_Light ("Light Base Rim Light", Integer) = 0 _LightDirectionRimLightLevel("Light Direction Rim Light Level", Range(0, 0.5)) = 0 [ToggleUI] _Is_LightColor_RimLight("Is_LightColor_RimLight", Float) = 1 [ToggleUI] _Is_NormalMapToRimLight("Is_NormalMapToRimLight", Float) = 0 [ToggleUI] _LightDirection_MaskOn("LightDirection_MaskOn", Float) = 0 [ToggleUI] _Add_Antipodean_RimLight("Add_Antipodean_RimLight", Float) = 0 _Ap_RimLightColor("Ap_RimLightColor", Color) = (1, 1, 1, 1) [ToggleUI] _Is_LightColor_Ap_RimLight("Is_LightColor_Ap_RimLight", Float) = 1 _Ap_RimLight_Power("Ap_RimLight_Power", Range(0, 1)) = 0.1 [ToggleUI] _Ap_RimLight_FeatherOff("Ap_RimLight_FeatherOff", Float) = 0 _Set_RimLightMask("Set_RimLightMask", 2D) = "white" {} _Tweak_RimLightMaskLevel("Tweak_RimLightMaskLevel", Range(-1, 1)) = 0 // Angel Rings _AngelRingColor("Angel Ring Color", Color) = (1, 1, 1, 1) _AngelRingColorMap("Angel Ring Color Map", 2D) = "black" {} _AngelRingIntensity("Angel Ring Intensity", Range(0, 10)) = 1 _AngelRingOffsetU("Angel Ring Offset U", Range(0, 1)) = 0 _AngelRingOffsetV("Angel Ring Offset V", Range(0, 1)) = 0 // Outline [PassPopup(Outline)] _OutlineState("Outline State", Integer) = 1 _OutlineWidth("Outline Width", Float) = 0.25 _OutlineWidthMap("Outline Tex", 2D) = "white" {} _OutlineColor("Outline Color", Color) = (0.5, 0.5, 0.5, 1) _OutlineColorMap("Outline Color Map", 2D) = "white" {} [ToggleUI] _AlbedoAffectOutline("Albedo Affect Outline", Float) = 1 [ToggleUI] _SkyColorAffectOutline("Sky Color Affect Outline", Float) = 1 _SkyColorIntensity("Sky Color Intensity", Range(0, 5)) = 1 _OutlineFadeIn("Outline Fade In", Float) = 50 _OutlineFadeOut("Outline Fade Out", Float) = 100 [ToggleUI] _UseSmoothedNormal("Use Smoothed Normal", Float) = 0 // Advance _LightIntensityMultiplier("Light_Intensity_Multiplier" , Range(0, 1)) = 0.5 [ToggleUI] _ClampLightColor("VRChat : SceneLights HiCut_Filter", Float) = 0 [KeywordEnum(Single, Full, Custom)] _Light_Loop_Mode ("Light Loop Mode", Float) = 1 //TODO: Clear hdrp default properties [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _UVDetail("UV Set for detail", Float) = 0 [HideInInspector] _UVDetailsMappingMask("_UVDetailsMappingMask", Color) = (1, 0, 0, 0) [ToggleUI] _LinkDetailsWithBase("LinkDetailsWithBase", Float) = 1.0 [Enum(Use Emissive Color, 0, Use Emissive Mask, 1)] _EmissiveColorMode("Emissive color mode", Float) = 1 [Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Planar, 4, Triplanar, 5, Same as Base, 6)] _UVEmissive("UV Set for emissive", Float) = 0 [Enum(WorldSpace, 0, ObjectSpace, 1)] _ObjectSpaceUVMappingEmissive("Mapping space", Float) = 0.0 _TexWorldScaleEmissive("Scale to apply on world coordinate", Float) = 1.0 [HideInInspector] _UVMappingMaskEmissive("_UVMappingMaskEmissive", Color) = (1, 0, 0, 0) [HideInInspector] _DiffusionProfile("Obsolete, kept for migration purpose", Int) = 0 [HideInInspector] _DiffusionProfileAsset("Diffusion Profile Asset", Vector) = (0, 0, 0, 0) [HideInInspector] _DiffusionProfileHash("Diffusion Profile Hash", Float) = 0 } HLSLINCLUDE #pragma target 4.5 #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch //------------------------------------------------------------------------------------- // Variant //------------------------------------------------------------------------------------- #pragma shader_feature_local _DOUBLESIDED_ON #pragma shader_feature_local _NORMALMAP_TANGENT_SPACE #pragma shader_feature_local _ _REQUIRE_UV2 _REQUIRE_UV3 #pragma shader_feature_local_fragment _ENABLE_FOG_ON_TRANSPARENT #pragma shader_feature_local _TRANSPARENT_WRITES_MOTION_VEC // enable dithering LOD crossfade #pragma multi_compile _ LOD_FADE_CROSSFADE //enable GPU instancing support #pragma multi_compile_instancing #pragma instancing_options renderinglayer //------------------------------------------------------------------------------------- // Define //------------------------------------------------------------------------------------- // This shader support vertex modification #define HAVE_VERTEX_MODIFICATION // If we use subsurface scattering, enable output split lighting (for forward pass) #if defined(_MATERIAL_FEATURE_SUBSURFACE_SCATTERING) && !defined(_SURFACE_TYPE_TRANSPARENT) #define OUTPUT_SPLIT_LIGHTING #endif #if defined(_TRANSPARENT_WRITES_MOTION_VEC) && defined(_SURFACE_TYPE_TRANSPARENT) #define _WRITE_TRANSPARENT_MOTION_VECTOR #endif //------------------------------------------------------------------------------------- // Include //------------------------------------------------------------------------------------- #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/FragInputs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl" //------------------------------------------------------------------------------------- // variable declaration //------------------------------------------------------------------------------------- #include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/Properties/UtsHdrpProperties.hlsl" // TODO: // Currently, Lit.hlsl and LitData.hlsl are included for every pass. Split Lit.hlsl in two: // LitData.hlsl and LitShading.hlsl (merge into the existing LitData.hlsl). // LitData.hlsl should be responsible for preparing shading parameters. // LitShading.hlsl implements the light loop API. // LitData.hlsl is included here, LitShading.hlsl is included below for shading passes only. ENDHLSL SubShader { // This tags allow to use the shader replacement features Tags{ "RenderPipeline"="HDRenderPipeline" "RenderType" = "HDLitShader"} Pass { Name "SceneSelectionPass" Tags { "LightMode" = "SceneSelectionPass" } Cull Off HLSLPROGRAM #pragma shader_feature_local _ALPHATEST_ON // Note: Require _ObjectId and _PassValue variables // We reuse depth prepass for the scene selection, allow to handle alpha correctly as well as tessellation and vertex animation #define SHADERPASS SHADERPASS_DEPTH_ONLY #define SCENESELECTIONPASS // This will drive the output of the scene selection shader #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitDepthPass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassDepthOnly.hlsl" #pragma vertex Vert #pragma fragment Frag #pragma editor_sync_compilation ENDHLSL } // Caution: The outline selection in the editor use the vertex shader/hull/domain shader of the first pass declare. So it should not bethe meta pass. Pass { Name "GBuffer" Tags { "LightMode" = "GBuffer" } // This will be only for opaque object based on the RenderQueue index Cull[_CullMode] ZTest[_ZTestGBuffer] Stencil { WriteMask[_StencilWriteMaskGBuffer] Ref[_StencilRefGBuffer] Comp Always Pass Replace } HLSLPROGRAM #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch #pragma instancing_options renderinglayer #pragma multi_compile _ DOTS_INSTANCING_ON #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile _ SHADOWS_SHADOWMASK // Setup DECALS_OFF so the shader stripper can remove variants #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT #pragma multi_compile _ LIGHT_LAYERS #pragma shader_feature_local_fragment _PBR_MODE_OFF #pragma shader_feature_local_fragment _MASKMAP #pragma shader_feature_local_fragment _NORMALMAP #pragma shader_feature_local_fragment _ANISOTROPYMAP #pragma shader_feature_local_fragment _SPECULARCOLORMAP #pragma shader_feature_local_fragment _EMISSIVE_COLOR_MAP #if _PBR_MODE_OFF #undef _MASKMAP #undef _ANISOTROPYMAP #undef _SPECULARCOLORMAP #endif #ifndef DEBUG_DISPLAY // When we have alpha test, we will force a depth prepass so we always bypass the clip instruction in the GBuffer // Don't do it with debug display mode as it is possible there is no depth prepass in this case #define SHADERPASS_GBUFFER_BYPASS_ALPHA_TEST #endif #define SHADERPASS SHADERPASS_GBUFFER #ifdef DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #endif #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" // #include "MaterialGBufferMacrosUTS.hlsl" // must be above lit.hlsl #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" // #include "EncodeIntoGBufferUTS.hlsl" // must be bellow lit.hlsl #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/ShaderPass/UtsShaderPassGBuffer.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } // Extracts information for lightmapping, GI (emission, albedo, ...) // This pass it not used during regular rendering. Pass { Name "META" Tags{ "LightMode" = "META" } Cull Off HLSLPROGRAM #pragma shader_feature_local _ALPHATEST_ON // Lightmap memo // DYNAMICLIGHTMAP_ON is used when we have an "enlighten lightmap" ie a lightmap updated at runtime by enlighten.This lightmap contain indirect lighting from realtime lights and realtime emissive material.Offline baked lighting(from baked material / light, // both direct and indirect lighting) will hand up in the "regular" lightmap->LIGHTMAP_ON. #define SHADERPASS SHADERPASS_LIGHT_TRANSPORT #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassLightTransport.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } Pass { Name "ShadowCaster" Tags{ "LightMode" = "ShadowCaster" } Cull[_CullMode] ZClip [_ZClip] ZWrite On ZTest LEqual ColorMask 0 HLSLPROGRAM #pragma shader_feature_local _ALPHATEST_ON #define SHADERPASS SHADERPASS_SHADOWS #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitDepthPass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassDepthOnly.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } Pass { Name "DepthForwardOnly" Tags{ "LightMode" = "DepthForwardOnly" } Cull[_CullMode] AlphaToMask [_AlphaCutoffEnable] // To be able to tag stencil with disableSSR information for forward Stencil { WriteMask [_StencilWriteMaskDepth] Ref [_StencilRefDepth] Comp Always Pass Replace } ZWrite On HLSLPROGRAM #pragma shader_feature_local _ALPHATEST_ON // In deferred, depth only pass don't output anything. // In forward it output the normal buffer #pragma multi_compile _ WRITE_NORMAL_BUFFER #pragma multi_compile _ WRITE_MSAA_DEPTH #define SHADERPASS SHADERPASS_DEPTH_ONLY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #ifdef WRITE_NORMAL_BUFFER // If enabled we need all regular interpolator #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #else #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitDepthPass.hlsl" #endif #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassDepthOnly.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } Pass { Name "MotionVectors" Tags{ "LightMode" = "MotionVectors" } // Caution, this need to be call like this to setup the correct parameters by C++ (legacy Unity) // If velocity pass (motion vectors) is enabled we tag the stencil so it don't perform CameraMotionVelocity Stencil { WriteMask [_StencilWriteMaskMV] Ref [_StencilRefMV] Comp Always Pass Replace } Cull[_CullMode] AlphaToMask [_AlphaCutoffEnable] ZWrite On HLSLPROGRAM #pragma multi_compile _ WRITE_NORMAL_BUFFER #pragma multi_compile _ WRITE_MSAA_DEPTH #pragma shader_feature_local _ALPHATEST_ON #define SHADERPASS SHADERPASS_MOTION_VECTORS #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #ifdef WRITE_NORMAL_BUFFER // If enabled we need all regular interpolator #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #else #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitMotionVectorPass.hlsl" #endif #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassMotionVectors.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } Pass { Name "DistortionVectors" Tags { "LightMode" = "DistortionVectors" } // This will be only for transparent object based on the RenderQueue index Stencil { WriteMask [_StencilRefDistortionVec] Ref [_StencilRefDistortionVec] Comp Always Pass Replace } Blend [_DistortionSrcBlend] [_DistortionDstBlend], [_DistortionBlurSrcBlend] [_DistortionBlurDstBlend] BlendOp Add, [_DistortionBlurBlendOp] ZTest [_ZTestModeDistortion] ZWrite off Cull [_CullMode] HLSLPROGRAM #define SHADERPASS SHADERPASS_DISTORTION #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitDistortionPass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassDistortion.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } Pass { Name "TransparentDepthPrepass" Tags{ "LightMode" = "TransparentDepthPrepass" } Cull[_CullMode] ZWrite On ColorMask 0 HLSLPROGRAM #pragma shader_feature_local _ALPHATEST_ON #define SHADERPASS SHADERPASS_DEPTH_ONLY #define CUTOFF_TRANSPARENT_DEPTH_PREPASS #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitDepthPass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassDepthOnly.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } // Caution: Order is important: TransparentBackface, then Forward/ForwardOnly Pass { Name "TransparentBackface" Tags { "LightMode" = "TransparentBackface" } Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend] ZWrite [_ZWrite] Cull Front ColorMask [_ColorMaskTransparentVel] 1 ZTest [_ZTestTransparent] HLSLPROGRAM #pragma shader_feature_local _ALPHATEST_ON #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile _ SHADOWS_SHADOWMASK #pragma multi_compile SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON // Setup DECALS_OFF so the shader stripper can remove variants #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT #define PUNCTUAL_SHADOW_MEDIUM #define DIRECTIONAL_SHADOW_MEDIUM #define AREA_SHADOW_MEDIUM #define USE_CLUSTERED_LIGHTLIST // There is not FPTL lighting when using transparent #define SHADERPASS SHADERPASS_FORWARD #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #endif // The light loop (or lighting architecture) is in charge to: // - Define light list // - Define the light loop // - Setup the constant/data // - Do the reflection hierarchy // - Provide sampling function for shadowmap, ies, cookie and reflection (depends on the specific use with the light loops like index array or atlas or single and texture format (cubemap/latlong)) #define HAS_LIGHTLOOP #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassForward.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } Pass { Name "ForwardOnly" Tags { "LightMode" = "ForwardOnly" } ZWrite [_ZWriteMode] ZTest [_ZTestMode] Cull [_CullMode] Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend] Stencil { Ref[_StencilNo] Comp[_StencilComp] Pass[_StencilOpPass] Fail[_StencilOpFail] } HLSLPROGRAM #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile _ SHADOWS_SHADOWMASK // Setup DECALS_OFF so the shader stripper can remove variants #pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT #pragma multi_compile SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON #pragma multi_compile_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST //#pragma multi_compile_fragment PUNCTUAL_SHADOW_LOW PUNCTUAL_SHADOW_MEDIUM PUNCTUAL_SHADOW_HIGH //#pragma multi_compile_fragment DIRECTIONAL_SHADOW_LOW DIRECTIONAL_SHADOW_MEDIUM DIRECTIONAL_SHADOW_HIGH //#pragma multi_compile_fragment AREA_SHADOW_MEDIUM AREA_SHADOW_HIGH #pragma multi_compile PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 #define SHADERPASS SHADERPASS_FORWARD // In case of opaque we don't want to perform the alpha test, it is done in depth prepass and we use depth equal for ztest (setup from UI) // Don't do it with debug display mode as it is possible there is no depth prepass in this case #if !defined(_SURFACE_TYPE_TRANSPARENT) && !defined(DEBUG_DISPLAY) #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST #endif #pragma shader_feature _EMISSIVE_SIMPLE _EMISSIVE_ANIMATION #pragma shader_feature ENABLE_UTS_HAIR_SHAOW #pragma shader_feature ENABLE_UTS_HAIR_BLENDING #pragma shader_feature_local_fragment _LIGHT_LOOP_MODE_SINGLE _LIGHT_LOOP_MODE_FULL _LIGHT_LOOP_MODE_CUSTOM #pragma shader_feature_local_fragment _SHADING_MODE_STANDARD _SHADING_MODE_SDF #pragma shader_feature_local_fragment _MATERIAL_TYPE_STANDARD _MATERIAL_TYPE_FRONTHAIR _MATERIAL_TYPE_FACE _MATERIAL_TYPE_EYE #pragma shader_feature_local_fragment _PBR_MODE_OFF _PBR_MODE_STANDARD _PBR_MODE_ANISOTROPY _PBR_MODE_HAIR _PBR_MODE_TOON #pragma shader_feature_local_fragment _USE_SHADING_RAMP_MAP_ON #pragma shader_feature_local_fragment _RECEIVE_LIGHT_SHADOW_ON #pragma shader_feature_local_fragment _RECEIVE_SCREEN_SPACE_SHADOW_ON #pragma shader_feature_local_fragment _RECEIVE_HAIR_SHADOW_ON #pragma shader_feature_local_fragment _INDIRECT_DIFFUSE_MODE_OFF _INDIRECT_DIFFUSE_MODE_IBL _INDIRECT_DIFFUSE_MODE_MATCAP _INDIRECT_DIFFUSE_MODE_RAMP #pragma shader_feature_local_fragment _INDIRECT_SPECULAR_MODE_OFF _INDIRECT_SPECULAR_MODE_IBL _INDIRECT_SPECULAR_MODE_MATCAP #pragma shader_feature_local_fragment _SCREEN_SPACE_RIM_LIGHT_ON #pragma shader_feature_local_fragment _LIGHT_BASE_RIM_LIGHT_ON #pragma shader_feature_local_fragment _SHADING_RAMP_MASK_MAP #pragma shader_feature_local_fragment _MASKMAP #pragma shader_feature_local_fragment _NORMALMAP #pragma shader_feature_local_fragment _ANISOTROPYMAP #pragma shader_feature_local_fragment _SPECULARCOLORMAP #pragma shader_feature_local_fragment _EMISSIVE_COLOR_MAP #pragma shader_feature_local_fragment _OUTLINECOLORMAP #pragma shader_feature_local _ALPHATEST_ON #define PUNCTUAL_SHADOW_MEDIUM #define DIRECTIONAL_SHADOW_MEDIUM #define AREA_SHADOW_MEDIUM #ifndef SHADER_STAGE_FRAGMENT #define SHADOW_LOW #define USE_FPTL_LIGHTLIST #endif #if !defined(_SURFACE_TYPE_TRANSPARENT) && !defined(DEBUG_DISPLAY) #define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST #endif #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/Common/UtsCommon.hlsl" #endif // The light loop (or lighting architecture) is in charge to: // - Define light list // - Define the light loop // - Setup the constant/data // - Do the reflection hierarchy // - Provide sampling function for shadowmap, ies, cookie and reflection (depends on the specific use with the light loops like index array or atlas or single and texture format (cubemap/latlong)) #define HAS_LIGHTLOOP #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/Common/UtsHead.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/ShaderPass/ShaderPassForward.hlsl" #else #include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/Lighting/UtsLightLoop.hlsl" #include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/ShaderPass/UtsShaderPassForward.hlsl" #endif #pragma vertex Vert #pragma fragment Frag ENDHLSL } Pass { Name "TransparentDepthPostpass" Tags { "LightMode" = "TransparentDepthPostpass" } Cull[_CullMode] ZWrite On ColorMask 0 HLSLPROGRAM #pragma shader_feature_local _ALPHATEST_ON #define SHADERPASS SHADERPASS_DEPTH_ONLY #define CUTOFF_TRANSPARENT_DEPTH_POSTPASS #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitDepthPass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassDepthOnly.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } Pass { Name "RayTracingPrepass" Tags{ "LightMode" = "RayTracingPrepass" } Cull[_CullMode] ZWrite On ZTest LEqual // If the object have already been render in depth prepass, it will re-render to tag stencil HLSLPROGRAM #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch #define SHADERPASS SHADERPASS_CONSTANT #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitConstantPass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassConstant.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } Pass { Name "Outline" Tags { "LightMode" = "Outline" } Cull Front Blend Off HLSLPROGRAM #define AREA_SHADOW_LOW #define SHADERPASS SHADERPASS_FORWARD #define SHADOW_LOW #define LIGHTLOOP_DISABLE_TILE_AND_CLUSTER #define _REQUIRE_UV2 #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #endif // The light loop (or lighting architecture) is in charge to: // - Define light list // - Define the light loop // - Setup the constant/data // - Do the reflection hierarchy // - Provide sampling function for shadowmap, ies, cookie and reflection (depends on the specific use with the light loops like index array or atlas or single and texture format (cubemap/latlong)) #define HAS_LIGHTLOOP #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/Common/UtsHead.hlsl" #include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/ShaderPass/HDRPToonOutline.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } Pass { Name "HairShadowCaster" Tags{ "LightMode" = "HairShadowCaster" } Cull[_CullMode] ZClip [_ZClip] ZWrite On ZTest LEqual ColorMask 0 HLSLPROGRAM #define SHADERPASS SHADERPASS_SHADOWS #pragma shader_feature_local _ALPHATEST_ON #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitDepthPass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassDepthOnly.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } Pass { Name "HairBlendingTarget" Tags{ "LightMode" = "HairBlendingTarget" } Cull[_CullMode] ZClip [_ZClip] ZWrite On ZTest LEqual HLSLPROGRAM #define SHADERPASS SHADERPASS_FORWARD #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #ifdef DEBUG_DISPLAY #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl" #endif #include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/Common/UtsHead.hlsl" #include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/ShaderPass/HDRPToonHairBlending.hlsl" #pragma vertex Vert #pragma fragment Frag ENDHLSL } } SubShader { Tags{ "RenderPipeline"="HDRenderPipeline" } Pass { Name "IndirectDXR" Tags{ "LightMode" = "IndirectDXR" } HLSLPROGRAM #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 #pragma multi_compile _ DIRLIGHTMAP_COMBINED #define SHADERPASS SHADERPASS_RAYTRACING_INDIRECT // multi compile that allows us to strip the recursive code #pragma multi_compile _ MULTI_BOUNCE_INDIRECT // If you need to change this, be sure to read this comment. // For raytracing we decided to force the shadow quality to low. // - The performance is the first reason, given that it may happen during the ray tracing stage for indirect or in a non-tiled context for deferred // we want to save that cost as it may increase signfiicantly the cost.. // - The second reason is that some filtering modes require the screen space position (at the moment you read this comment high and ultra high), which we cannot provide // in a ray tracing context. // In addition to that, we intentionally disabled dithering for the ray tracing case as it requires the screen space position. #define SHADOW_LOW #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" #define HAS_LIGHTLOOP #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitRaytracing.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightLoop.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingIndirect.hlsl" ENDHLSL } Pass { Name "ForwardDXR" Tags{ "LightMode" = "ForwardDXR" } HLSLPROGRAM #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 #pragma multi_compile _ DIRLIGHTMAP_COMBINED #define SHADERPASS SHADERPASS_RAYTRACING_FORWARD // If you need to change this, be sure to read this comment. // For raytracing we decided to force the shadow quality to low. // - The performance is the first reason, given that it may happen during the ray tracing stage for indirect or in a non-tiled context for deferred // we want to save that cost as it may increase signfiicantly the cost.. // - The second reason is that some filtering modes require the screen space position (at the moment you read this comment high and ultra high), which we cannot provide // in a ray tracing context. // In addition to that, we intentionally disabled dithering for the ray tracing case as it requires the screen space position. #define SHADOW_LOW #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" #define HAS_LIGHTLOOP #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitRaytracing.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightLoop.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingForward.hlsl" ENDHLSL } Pass { Name "GBufferDXR" Tags{ "LightMode" = "GBufferDXR" } HLSLPROGRAM #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile _ LIGHTMAP_ON #pragma multi_compile _ DYNAMICLIGHTMAP_ON #pragma multi_compile PROBE_VOLUMES_OFF PROBE_VOLUMES_L1 PROBE_VOLUMES_L2 #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ MINIMAL_GBUFFER #define SHADERPASS SHADERPASS_RAYTRACING_GBUFFER #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Deferred/RaytracingIntersectonGBuffer.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/StandardLit/StandardLit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitRaytracing.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingGBuffer.hlsl" ENDHLSL } Pass { Name "VisibilityDXR" Tags{ "LightMode" = "VisibilityDXR" } HLSLPROGRAM #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #define SHADERPASS SHADERPASS_RAYTRACING_VISIBILITY #pragma multi_compile _ TRANSPARENT_COLOR_SHADOW #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRaytracingVisibility.hlsl" ENDHLSL } Pass { Name "PathTracingDXR" Tags{ "LightMode" = "PathTracingDXR" } HLSLPROGRAM #pragma only_renderers d3d11 ps5 #pragma raytracing surface_shader #pragma multi_compile _ DEBUG_DISPLAY #define SHADERPASS SHADERPASS_PATH_TRACING // This is just because it needs to be defined, shadow maps are not used. #define SHADOW_LOW #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingMacros.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl" #define HAS_LIGHTLOOP #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitPathTracing.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassPathTracing.hlsl" ENDHLSL } } //CustomEditor "UnityEditor.Rendering.Toon.UTS3GUI" CustomEditor "Misaki.HdrpToon.Editor.UTSShaderGUI" }