1380 lines
70 KiB
Plaintext
1380 lines
70 KiB
Plaintext
Shader "GPUInstancer/HDRP/Lit"
|
|
{
|
|
Properties
|
|
{
|
|
// Following set of parameters represent the parameters node inside the MaterialGraph.
|
|
// They are use to fill a SurfaceData. With a MaterialGraph this should not exist.
|
|
|
|
// Reminder. Color here are in linear but the UI (color picker) do the conversion sRGB to linear
|
|
[MainColor] _BaseColor("BaseColor", Color) = (1,1,1,1)
|
|
[MainTexture] _BaseColorMap("BaseColorMap", 2D) = "white" {}
|
|
[HideInInspector] _BaseColorMap_MipInfo("_BaseColorMap_MipInfo", Vector) = (0, 0, 0, 0)
|
|
|
|
_Metallic("_Metallic", Range(0.0, 1.0)) = 0
|
|
_Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5
|
|
_MaskMap("MaskMap", 2D) = "white" {}
|
|
_MetallicRemapMin("MetallicRemapMin", Float) = 0.0
|
|
_MetallicRemapMax("MetallicRemapMax", Float) = 1.0
|
|
_SmoothnessRemapMin("SmoothnessRemapMin", Float) = 0.0
|
|
_SmoothnessRemapMax("SmoothnessRemapMax", Float) = 1.0
|
|
_AlphaRemapMin("AlphaRemapMin", Float) = 0.0
|
|
_AlphaRemapMax("AlphaRemapMax", Float) = 1.0
|
|
_AORemapMin("AORemapMin", Float) = 0.0
|
|
_AORemapMax("AORemapMax", Float) = 1.0
|
|
|
|
_NormalMap("NormalMap", 2D) = "bump" {} // Tangent space normal map
|
|
_NormalMapOS("NormalMapOS", 2D) = "white" {} // Object space normal map - no good default value
|
|
_NormalScale("_NormalScale", Range(0.0, 8.0)) = 1
|
|
|
|
_BentNormalMap("_BentNormalMap", 2D) = "bump" {}
|
|
_BentNormalMapOS("_BentNormalMapOS", 2D) = "white" {}
|
|
|
|
_HeightMap("HeightMap", 2D) = "black" {}
|
|
// Caution: Default value of _HeightAmplitude must be (_HeightMax - _HeightMin) * 0.01
|
|
// Those two properties are computed from the ones exposed in the UI and depends on the displaement mode so they are separate because we don't want to lose information upon displacement mode change.
|
|
[HideInInspector] _HeightAmplitude("Height Amplitude", Float) = 0.02 // In world units. This will be computed in the UI.
|
|
[HideInInspector] _HeightCenter("Height Center", Range(0.0, 1.0)) = 0.5 // In texture space
|
|
|
|
[Enum(MinMax, 0, Amplitude, 1)] _HeightMapParametrization("Heightmap Parametrization", Int) = 0
|
|
// These parameters are for vertex displacement/Tessellation
|
|
_HeightOffset("Height Offset", Float) = 0
|
|
// MinMax mode
|
|
_HeightMin("Heightmap Min", Float) = -1
|
|
_HeightMax("Heightmap Max", Float) = 1
|
|
// Amplitude mode
|
|
_HeightTessAmplitude("Amplitude", Float) = 2.0 // in Centimeters
|
|
_HeightTessCenter("Height Center", Range(0.0, 1.0)) = 0.5 // In texture space
|
|
|
|
// These parameters are for pixel displacement
|
|
_HeightPoMAmplitude("Height Amplitude", Float) = 2.0 // In centimeters
|
|
|
|
_DetailMap("DetailMap", 2D) = "linearGrey" {}
|
|
_DetailAlbedoScale("_DetailAlbedoScale", Range(0.0, 2.0)) = 1
|
|
_DetailNormalScale("_DetailNormalScale", Range(0.0, 2.0)) = 1
|
|
_DetailSmoothnessScale("_DetailSmoothnessScale", Range(0.0, 2.0)) = 1
|
|
|
|
_TangentMap("TangentMap", 2D) = "bump" {}
|
|
_TangentMapOS("TangentMapOS", 2D) = "white" {}
|
|
_Anisotropy("Anisotropy", Range(-1.0, 1.0)) = 0
|
|
_AnisotropyMap("AnisotropyMap", 2D) = "white" {}
|
|
|
|
_SubsurfaceMask("Subsurface Radius", Range(0.0, 1.0)) = 1.0
|
|
_SubsurfaceMaskMap("Subsurface Radius Map", 2D) = "white" {}
|
|
_TransmissionMask("Transmission Mask", Range(0.0, 1.0)) = 1.0
|
|
_TransmissionMaskMap("Transmission Mask Map", 2D) = "white" {}
|
|
_Thickness("Thickness", Float) = 1.0
|
|
_ThicknessMap("Thickness Map", 2D) = "white" {}
|
|
_ThicknessRemap("Thickness Remap", Vector) = (0, 1, 0, 0)
|
|
|
|
_IridescenceThickness("Iridescence Thickness", Range(0.0, 1.0)) = 1.0
|
|
_IridescenceThicknessMap("Iridescence Thickness Map", 2D) = "white" {}
|
|
_IridescenceThicknessRemap("Iridescence Thickness Remap", Vector) = (0, 1, 0, 0)
|
|
_IridescenceMask("Iridescence Mask", Range(0.0, 1.0)) = 1.0
|
|
_IridescenceMaskMap("Iridescence Mask Map", 2D) = "white" {}
|
|
|
|
_CoatMask("Coat Mask", Range(0.0, 1.0)) = 0.0
|
|
_CoatMaskMap("CoatMaskMap", 2D) = "white" {}
|
|
|
|
[ToggleUI] _EnergyConservingSpecularColor("_EnergyConservingSpecularColor", Float) = 1.0
|
|
_SpecularColor("SpecularColor", Color) = (1, 1, 1, 1)
|
|
_SpecularColorMap("SpecularColorMap", 2D) = "white" {}
|
|
|
|
// Following options are for the GUI inspector and different from the input parameters above
|
|
// These option below will cause different compilation flag.
|
|
[Enum(Off, 0, From Ambient Occlusion, 1, From AO and Bent Normals, 2)] _SpecularOcclusionMode("Specular Occlusion Mode", Int) = 1
|
|
|
|
[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" {}
|
|
[ToggleUI] _AlbedoAffectEmissive("Albedo Affect Emissive", Float) = 0.0
|
|
_EmissiveIntensityUnit("Emissive Mode", Int) = 0
|
|
[ToggleUI] _UseEmissiveIntensity("Use Emissive Intensity", Int) = 0
|
|
_EmissiveIntensity("Emissive Intensity", Float) = 1
|
|
_EmissiveExposureWeight("Emissive Pre Exposure", Range(0.0, 1.0)) = 1.0
|
|
|
|
[ToggleUI] _UseShadowThreshold("_UseShadowThreshold", Float) = 0.0
|
|
[ToggleUI] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0.0
|
|
_AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
|
_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, Planar, 1, Sphere, 2, Thin, 3)]_RefractionModel("Refraction Model", Int) = 0
|
|
_Ior("Index Of Refraction", Range(1.0, 2.5)) = 1.5
|
|
_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
|
|
[ToggleUI] _PerPixelSorting("_PerPixelSorting", Float) = 0.0
|
|
|
|
// Stencil state
|
|
|
|
// Forward
|
|
[HideInInspector] _StencilRef("_StencilRef", Int) = 0 // StencilUsage.Clear
|
|
[HideInInspector] _StencilWriteMask("_StencilWriteMask", Int) = 3 // StencilUsage.RequiresDeferredLighting | StencilUsage.SubsurfaceScattering
|
|
// GBuffer
|
|
[HideInInspector] _StencilRefGBuffer("_StencilRefGBuffer", Int) = 2 // StencilUsage.RequiresDeferredLighting
|
|
[HideInInspector] _StencilWriteMaskGBuffer("_StencilWriteMaskGBuffer", Int) = 3 // StencilUsage.RequiresDeferredLighting | StencilUsage.SubsurfaceScattering
|
|
// Depth prepass
|
|
[HideInInspector] _StencilRefDepth("_StencilRefDepth", Int) = 0 // Nothing
|
|
[HideInInspector] _StencilWriteMaskDepth("_StencilWriteMaskDepth", Int) = 8 // StencilUsage.TraceReflectionRay
|
|
// Motion vector pass
|
|
[HideInInspector] _StencilRefMV("_StencilRefMV", Int) = 32 // StencilUsage.ObjectMotionVector
|
|
[HideInInspector] _StencilWriteMaskMV("_StencilWriteMaskMV", Int) = 32 // StencilUsage.ObjectMotionVector
|
|
|
|
// Blending state
|
|
_SurfaceType("__surfacetype", Float) = 0.0
|
|
_BlendMode("__blendmode", Float) = 0.0
|
|
[HideInInspector] _SrcBlend("__src", Float) = 1.0
|
|
[HideInInspector] _DstBlend("__dst", Float) = 0.0
|
|
[HideInInspector] _DstBlend2("__dst2", 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] _CullMode("__cullmode", Float) = 2.0
|
|
[HideInInspector] _CullModeForward("__cullmodeForward", Float) = 2.0 // This mode is dedicated to Forward to correctly handle backface then front face rendering thin transparent
|
|
[Enum(UnityEditor.Rendering.HighDefinition.TransparentCullMode)] _TransparentCullMode("_TransparentCullMode", Int) = 2 // Back culling by default
|
|
[Enum(UnityEditor.Rendering.HighDefinition.OpaqueCullMode)] _OpaqueCullMode("_OpaqueCullMode", Int) = 2 // Back culling by default
|
|
[HideInInspector] _ZTestDepthEqualForOpaque("_ZTestDepthEqualForOpaque", Int) = 4 // Less equal
|
|
[HideInInspector] _ZTestGBuffer("_ZTestGBuffer", 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)
|
|
[Enum(Auto, 0, On, 1, Off, 2)] _DoubleSidedGIMode("Double sided GI mode", Float) = 0
|
|
|
|
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Planar, 4, Triplanar, 5)] _UVBase("UV Set for base", Float) = 0
|
|
[Enum(WorldSpace, 0, ObjectSpace, 1)] _ObjectSpaceUVMapping("Mapping space", Float) = 0.0
|
|
_TexWorldScale("Scale to apply on world coordinate", Float) = 1.0
|
|
[HideInInspector] _InvTilingScale("Inverse tiling scale = 2 / (abs(_BaseColorMap_ST.x) + abs(_BaseColorMap_ST.y))", Float) = 1
|
|
[HideInInspector] _UVMappingMask("_UVMappingMask", Color) = (1, 0, 0, 0)
|
|
[Enum(TangentSpace, 0, ObjectSpace, 1)] _NormalMapSpace("NormalMap space", Float) = 0
|
|
|
|
// Following enum should be material feature flags (i.e bitfield), however due to Gbuffer encoding constrain many combination exclude each other
|
|
// so we use this enum as "material ID" which can be interpreted as preset of bitfield of material feature
|
|
// The only material feature flag that can be added in all cases is clear coat
|
|
[Enum(Subsurface Scattering, 0, Standard, 1, Anisotropy, 2, Iridescence, 3, Specular Color, 4, Translucent, 5)] _MaterialID("MaterialId", Int) = 1 // MaterialId.Standard
|
|
[ToggleUI] _TransmissionEnable("_TransmissionEnable", Float) = 1.0
|
|
|
|
_DisplacementMode("DisplacementMode", Int) = 0
|
|
[ToggleUI] _DisplacementLockObjectScale("displacement lock object scale", Float) = 1.0
|
|
[ToggleUI] _DisplacementLockTilingScale("displacement lock tiling scale", Float) = 1.0
|
|
[ToggleUI] _DepthOffsetEnable("Depth Offset View space", Float) = 0.0
|
|
|
|
[ToggleUI] _EnableGeometricSpecularAA("EnableGeometricSpecularAA", Float) = 0.0
|
|
_SpecularAAScreenSpaceVariance("SpecularAAScreenSpaceVariance", Range(0.0, 1.0)) = 0.1
|
|
_SpecularAAThreshold("SpecularAAThreshold", Range(0.0, 1.0)) = 0.2
|
|
|
|
_PPDMinSamples("Min sample for POM", Range(1.0, 64.0)) = 5
|
|
_PPDMaxSamples("Max sample for POM", Range(1.0, 64.0)) = 15
|
|
_PPDLodThreshold("Start lod to fade out the POM effect", Range(0.0, 16.0)) = 5
|
|
_PPDPrimitiveLength("Primitive length for POM", Float) = 1
|
|
_PPDPrimitiveWidth("Primitive width for POM", Float) = 1
|
|
[HideInInspector] _InvPrimScale("Inverse primitive scale for non-planar POM", Vector) = (1, 1, 0, 0)
|
|
|
|
[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)
|
|
|
|
// Caution: C# code in BaseLitUI.cs call LightmapEmissionFlagsProperty() which assume that there is an existing "_EmissionColor"
|
|
// value that exist to identify if the GI emission need to be enabled.
|
|
// In our case we don't use such a mechanism but need to keep the code quiet. We declare the value and always enable it.
|
|
// TODO: Fix the code in legacy unity so we can customize the beahvior for GI
|
|
_EmissionColor("Color", Color) = (1, 1, 1)
|
|
|
|
// 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.
|
|
[HideInInspector] _MainTex("Albedo", 2D) = "white" {}
|
|
[HideInInspector] _Color("Color", Color) = (1,1,1,1)
|
|
[HideInInspector] _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
|
|
|
[ToggleUI] _SupportDecals("Support Decals", Float) = 1.0
|
|
[ToggleUI] _ReceivesSSR("Receives SSR", Float) = 1.0
|
|
[ToggleUI] _ReceivesSSRTransparent("Receives SSR Transparent", Float) = 0.0
|
|
[ToggleUI] _AddPrecomputedVelocity("AddPrecomputedVelocity", Float) = 0.0
|
|
|
|
// Ray Tracing
|
|
[ToggleUI] _RayTracing("Ray Tracing (Preview)", Float) = 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
|
|
|
|
[HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
|
|
[HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
|
|
[HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
|
|
}
|
|
|
|
HLSLINCLUDE
|
|
|
|
#pragma target 4.5
|
|
//#pragma enable_d3d11_debug_symbols
|
|
|
|
//-------------------------------------------------------------------------------------
|
|
// Variant
|
|
//-------------------------------------------------------------------------------------
|
|
|
|
#pragma shader_feature_local _ALPHATEST_ON
|
|
#pragma shader_feature_local _DEPTHOFFSET_ON
|
|
#pragma shader_feature_local _DOUBLESIDED_ON
|
|
#pragma shader_feature_local _ _VERTEX_DISPLACEMENT _PIXEL_DISPLACEMENT
|
|
#pragma shader_feature_local_vertex _VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE
|
|
#pragma shader_feature_local _DISPLACEMENT_LOCK_TILING_SCALE
|
|
#pragma shader_feature_local_fragment _PIXEL_DISPLACEMENT_LOCK_OBJECT_SCALE
|
|
#pragma shader_feature_local_fragment _ _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN
|
|
#pragma shader_feature_local_raytracing _ _REFRACTION_PLANE _REFRACTION_SPHERE _REFRACTION_THIN
|
|
|
|
#pragma shader_feature_local_fragment _ _EMISSIVE_MAPPING_PLANAR _EMISSIVE_MAPPING_TRIPLANAR _EMISSIVE_MAPPING_BASE
|
|
#pragma shader_feature_local _ _MAPPING_PLANAR _MAPPING_TRIPLANAR
|
|
#pragma shader_feature_local_fragment _NORMALMAP_TANGENT_SPACE
|
|
#pragma shader_feature_local_raytracing _ _EMISSIVE_MAPPING_PLANAR _EMISSIVE_MAPPING_TRIPLANAR _EMISSIVE_MAPPING_BASE
|
|
#pragma shader_feature_local_raytracing _NORMALMAP_TANGENT_SPACE
|
|
|
|
#pragma shader_feature_local _ _REQUIRE_UV2 _REQUIRE_UV3
|
|
|
|
#pragma shader_feature_local _NORMALMAP
|
|
#pragma shader_feature_local_fragment _MASKMAP
|
|
#pragma shader_feature_local_fragment _BENTNORMALMAP
|
|
#pragma shader_feature_local_fragment _EMISSIVE_COLOR_MAP
|
|
#pragma shader_feature_local_raytracing _MASKMAP
|
|
#pragma shader_feature_local_raytracing _BENTNORMALMAP
|
|
#pragma shader_feature_local_raytracing _EMISSIVE_COLOR_MAP
|
|
|
|
// _ENABLESPECULAROCCLUSION keyword is obsolete but keep here for compatibility. Do not used
|
|
// _ENABLESPECULAROCCLUSION and _SPECULAR_OCCLUSION_X can't exist at the same time (the new _SPECULAR_OCCLUSION replace it)
|
|
// When _ENABLESPECULAROCCLUSION is found we define _SPECULAR_OCCLUSION_X so new code to work
|
|
#pragma shader_feature_local_fragment _ENABLESPECULAROCCLUSION
|
|
#pragma shader_feature_local_fragment _ _SPECULAR_OCCLUSION_NONE _SPECULAR_OCCLUSION_FROM_BENT_NORMAL_MAP
|
|
#pragma shader_feature_local_raytracing _ENABLESPECULAROCCLUSION
|
|
#pragma shader_feature_local_raytracing _ _SPECULAR_OCCLUSION_NONE _SPECULAR_OCCLUSION_FROM_BENT_NORMAL_MAP
|
|
|
|
#ifdef _ENABLESPECULAROCCLUSION
|
|
#define _SPECULAR_OCCLUSION_FROM_BENT_NORMAL_MAP
|
|
#endif
|
|
|
|
#pragma shader_feature_local _HEIGHTMAP
|
|
#pragma shader_feature_local_fragment _TANGENTMAP
|
|
#pragma shader_feature_local_fragment _ANISOTROPYMAP
|
|
#pragma shader_feature_local_fragment _DETAIL_MAP
|
|
#pragma shader_feature_local_fragment _SUBSURFACE_MASK_MAP
|
|
#pragma shader_feature_local_fragment _TRANSMISSION_MASK_MAP
|
|
#pragma shader_feature_local_fragment _THICKNESSMAP
|
|
#pragma shader_feature_local_fragment _IRIDESCENCE_THICKNESSMAP
|
|
#pragma shader_feature_local_fragment _SPECULARCOLORMAP
|
|
#pragma shader_feature_local_fragment _TRANSMITTANCECOLORMAP
|
|
#pragma shader_feature_local_raytracing _TANGENTMAP
|
|
#pragma shader_feature_local_raytracing _ANISOTROPYMAP
|
|
#pragma shader_feature_local_raytracing _DETAIL_MAP
|
|
#pragma shader_feature_local_raytracing _SUBSURFACE_MASK_MAP
|
|
#pragma shader_feature_local_raytracing _THICKNESSMAP
|
|
#pragma shader_feature_local_raytracing _IRIDESCENCE_THICKNESSMAP
|
|
#pragma shader_feature_local_raytracing _SPECULARCOLORMAP
|
|
#pragma shader_feature_local_raytracing _TRANSMITTANCECOLORMAP
|
|
|
|
#pragma shader_feature_local _DISABLE_DECALS
|
|
#pragma shader_feature_local_fragment _DISABLE_SSR
|
|
#pragma shader_feature_local_raytracing _DISABLE_SSR
|
|
// Bit of a mystery why this is not possible to have frequency specific.
|
|
#pragma shader_feature_local _DISABLE_SSR_TRANSPARENT
|
|
|
|
#pragma shader_feature_local_fragment _ENABLE_GEOMETRIC_SPECULAR_AA
|
|
|
|
// Keyword for transparent
|
|
#pragma shader_feature _SURFACE_TYPE_TRANSPARENT
|
|
|
|
#pragma shader_feature_local_fragment _ENABLE_FOG_ON_TRANSPARENT
|
|
#pragma shader_feature_local _ _TRANSPARENT_WRITES_MOTION_VEC _TRANSPARENT_REFRACTIVE_SORT
|
|
|
|
// MaterialFeature are used as shader feature to allow compiler to optimize properly
|
|
#pragma shader_feature_local_fragment _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
#pragma shader_feature_local_fragment _MATERIAL_FEATURE_TRANSMISSION
|
|
#pragma shader_feature_local_fragment _MATERIAL_FEATURE_ANISOTROPY
|
|
#pragma shader_feature_local_fragment _MATERIAL_FEATURE_CLEAR_COAT
|
|
#pragma shader_feature_local_fragment _MATERIAL_FEATURE_IRIDESCENCE
|
|
#pragma shader_feature_local_fragment _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
#pragma shader_feature_local_raytracing _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
|
#pragma shader_feature_local_raytracing _MATERIAL_FEATURE_TRANSMISSION
|
|
#pragma shader_feature_local_raytracing _MATERIAL_FEATURE_ANISOTROPY
|
|
#pragma shader_feature_local_raytracing _MATERIAL_FEATURE_CLEAR_COAT
|
|
#pragma shader_feature_local_raytracing _MATERIAL_FEATURE_IRIDESCENCE
|
|
#pragma shader_feature_local_raytracing _MATERIAL_FEATURE_SPECULAR_COLOR
|
|
|
|
#pragma shader_feature_local _ADD_PRECOMPUTED_VELOCITY
|
|
|
|
//-------------------------------------------------------------------------------------
|
|
// Define
|
|
//-------------------------------------------------------------------------------------
|
|
|
|
// This shader support recursive rendering for raytracing
|
|
#define HAVE_RECURSIVE_RENDERING
|
|
|
|
// This shader support vertex modification
|
|
#define HAVE_VERTEX_MODIFICATION
|
|
|
|
#define SUPPORT_BLENDMODE_PRESERVE_SPECULAR_LIGHTING
|
|
|
|
// 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(_TRANSPARENT_REFRACTIVE_SORT)) && defined(_SURFACE_TYPE_TRANSPARENT)
|
|
#define _WRITE_TRANSPARENT_MOTION_VECTOR
|
|
#endif
|
|
|
|
// Define _DEFERRED_CAPABLE_MATERIAL for shader capable to run in deferred pass
|
|
#ifndef _SURFACE_TYPE_TRANSPARENT
|
|
#define _DEFERRED_CAPABLE_MATERIAL
|
|
#endif
|
|
|
|
// In this shader, the heightmap implies depth offsets away from the camera.
|
|
#ifdef _HEIGHTMAP
|
|
#define _CONSERVATIVE_DEPTH_OFFSET
|
|
#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"
|
|
|
|
//-------------------------------------------------------------------------------------
|
|
// variable declaration
|
|
//-------------------------------------------------------------------------------------
|
|
|
|
// #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.cs.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitProperties.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 "ScenePickingPass"
|
|
Tags { "LightMode" = "Picking" }
|
|
|
|
Cull [_CullMode]
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
|
|
//enable GPU instancing support
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
// Note: Require _SelectionID variable
|
|
|
|
// 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 SCENEPICKINGPASS
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl"
|
|
#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
|
|
}
|
|
|
|
Pass
|
|
{
|
|
Name "SceneSelectionPass"
|
|
Tags { "LightMode" = "SceneSelectionPass" }
|
|
|
|
Cull Off
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
|
|
//enable GPU instancing support
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
// 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/ShaderLibrary/PickingSpaceTransforms.hlsl"
|
|
#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
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
//enable GPU instancing support
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
#pragma multi_compile _ DEBUG_DISPLAY
|
|
// 'Optimize Mesh Data' strip away attribute uv1/uv2 without the keyword set on the vertex stage.
|
|
#pragma multi_compile _ LIGHTMAP_ON
|
|
// Both DIRLIGHTMAP_COMBINED and DYNAMICLIGHTMAP_ON must have vertex frequency to be able to include UV2 in player
|
|
// If DIRLIGHTMAP_COMBINED isn't define, then DYNAMICLIGHTMAP_ON will not. This is hardcoded in C++
|
|
// For ShaderGraph we don't have this issue as UV2 are always included.
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
|
#pragma multi_compile_fragment _ SHADOWS_SHADOWMASK
|
|
#pragma multi_compile_fragment _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
|
|
// Setup DECALS_OFF so the shader stripper can remove variants
|
|
#pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT
|
|
#pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT
|
|
#pragma multi_compile_fragment _ RENDERING_LAYERS
|
|
|
|
#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 "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/ShaderPassGBuffer.hlsl"
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
// Extracts information for lightmapping, GI (emission, albedo, ...)
|
|
// This pass is not used during regular rendering.
|
|
Pass
|
|
{
|
|
Name "META"
|
|
Tags{ "LightMode" = "META" }
|
|
|
|
Cull Off
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
//enable GPU instancing support
|
|
#pragma shader_feature EDITOR_VISUALIZATION
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
// 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
|
|
|
|
// Use Unity's built-in matrices for meta pass rendering
|
|
#define SCENEPICKINGPASS
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/PickingSpaceTransforms.hlsl"
|
|
|
|
#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
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
//enable GPU instancing support
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
#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 "DepthOnly"
|
|
Tags{ "LightMode" = "DepthOnly" }
|
|
|
|
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
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
//enable GPU instancing support
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
// 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_fragment _ WRITE_MSAA_DEPTH
|
|
#pragma multi_compile _ WRITE_DECAL_BUFFER WRITE_RENDERING_LAYER
|
|
|
|
#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
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
//enable GPU instancing support
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
|
#pragma multi_compile_fragment _ WRITE_MSAA_DEPTH
|
|
#pragma multi_compile _ WRITE_DECAL_BUFFER_AND_RENDERING_LAYER
|
|
|
|
// We can't name this keyword WRITE_DECAL_BUFFER directly because we want to enable it at a different
|
|
// frequency than WRITE_DECAL_BUFFER defined in the DepthForwardOnly pass
|
|
#ifdef WRITE_DECAL_BUFFER_AND_RENDERING_LAYER
|
|
#define WRITE_DECAL_BUFFER
|
|
#endif
|
|
|
|
#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 "TransparentDepthPrepass"
|
|
Tags{ "LightMode" = "TransparentDepthPrepass" }
|
|
|
|
// To be able to tag stencil with disableSSR information for transparentObjects
|
|
Stencil
|
|
{
|
|
WriteMask [_StencilWriteMaskDepth]
|
|
Ref [_StencilRefDepth]
|
|
Comp Always
|
|
Pass Replace
|
|
}
|
|
|
|
Cull[_CullMode]
|
|
ZWrite On
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
//enable GPU instancing support
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
#define SHADERPASS SHADERPASS_TRANSPARENT_DEPTH_PREPASS
|
|
|
|
// If the transparent surface should have reflections, then we should output normal
|
|
#if !defined(_DISABLE_SSR_TRANSPARENT)
|
|
#define WRITE_NORMAL_BUFFER
|
|
#endif
|
|
|
|
#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
|
|
}
|
|
|
|
// Caution: Order is important: TransparentBackface, then Forward/ForwardOnly
|
|
Pass
|
|
{
|
|
Name "TransparentBackface"
|
|
Tags { "LightMode" = "TransparentBackface" }
|
|
|
|
Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend]
|
|
Blend 1 One OneMinusSrcAlpha // target 1 alpha blend required for VT feedback. All other uses will pass 1.
|
|
Blend 2 One OneMinusSrcAlpha // before refraction
|
|
Blend 3 One OneMinusSrcAlpha // before refraction alpha
|
|
Blend 4 One OneMinusSrcAlpha // all targets are shifted by 1 when using VT
|
|
|
|
ZWrite [_ZWrite]
|
|
Cull Front
|
|
ColorMask [_ColorMaskTransparentVelOne] 1
|
|
ColorMask [_ColorMaskTransparentVelTwo] 2
|
|
ZTest [_ZTestTransparent]
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
//enable GPU instancing support
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
#pragma multi_compile _ DEBUG_DISPLAY
|
|
#pragma multi_compile _ LIGHTMAP_ON
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
|
#pragma multi_compile_fragment _ SHADOWS_SHADOWMASK
|
|
#pragma multi_compile_fragment _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
|
|
#pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON
|
|
// Setup DECALS_OFF so the shader stripper can remove variants
|
|
#pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT
|
|
#pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT
|
|
|
|
// Supported shadow modes per light type
|
|
#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
|
|
|
|
#ifndef SHADER_STAGE_FRAGMENT
|
|
#define SHADOW_LOW
|
|
#endif
|
|
|
|
#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 "Forward"
|
|
Tags { "LightMode" = "Forward" } // This will be only for transparent object based on the RenderQueue index
|
|
|
|
Stencil
|
|
{
|
|
WriteMask [_StencilWriteMask]
|
|
Ref [_StencilRef]
|
|
Comp Always
|
|
Pass Replace
|
|
}
|
|
|
|
Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend]
|
|
// ForwardOpaque | ForwardTransparent
|
|
Blend 1 One OneMinusSrcAlpha // VT feedback | VT feedback <- if VT is off, all targets below are shifted by 1
|
|
Blend 2 One [_DstBlend2] // diffuse lighting | motion vector
|
|
Blend 3 One [_DstBlend2] // SSS buffer | before refraction <- This target (or the one above if VT off) needs blending in transparent but not in opaque
|
|
Blend 4 One OneMinusSrcAlpha // | before refraction alpha
|
|
|
|
// In case of forward we want to have depth equal for opaque mesh
|
|
ZTest [_ZTestDepthEqualForOpaque]
|
|
ZWrite [_ZWrite]
|
|
Cull [_CullModeForward]
|
|
// Not possible to control the render target with a variable
|
|
// Depending on virtual texturing, motion vector buffer can be bound on either SV_Target1 or SV_Target2
|
|
ColorMask [_ColorMaskTransparentVelOne] 1
|
|
ColorMask [_ColorMaskTransparentVelTwo] 2
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
//enable GPU instancing support
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
#pragma multi_compile _ DEBUG_DISPLAY
|
|
#pragma multi_compile _ LIGHTMAP_ON
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
|
#pragma multi_compile_fragment _ SHADOWS_SHADOWMASK
|
|
#pragma multi_compile_fragment _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
|
|
#pragma multi_compile_fragment SCREEN_SPACE_SHADOWS_OFF SCREEN_SPACE_SHADOWS_ON
|
|
// Setup DECALS_OFF so the shader stripper can remove variants
|
|
#pragma multi_compile_fragment DECALS_OFF DECALS_3RT DECALS_4RT
|
|
#pragma multi_compile_fragment _ DECAL_SURFACE_GRADIENT
|
|
|
|
// Supported shadow modes per light type
|
|
#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_fragment USE_FPTL_LIGHTLIST USE_CLUSTERED_LIGHTLIST
|
|
|
|
#ifndef SHADER_STAGE_FRAGMENT
|
|
#define SHADOW_LOW
|
|
#define USE_FPTL_LIGHTLIST
|
|
#endif
|
|
|
|
#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
|
|
#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 "TransparentDepthPostpass"
|
|
Tags { "LightMode" = "TransparentDepthPostpass" }
|
|
|
|
Cull[_CullMode]
|
|
ZWrite On
|
|
ColorMask 0
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
//enable GPU instancing support
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
#define SHADERPASS SHADERPASS_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
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
#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 "FullScreenDebug"
|
|
Tags{ "LightMode" = "FullScreenDebug" }
|
|
|
|
Cull[_CullMode]
|
|
|
|
ZWrite Off
|
|
ZTest LEqual
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
|
//enable GPU instancing support
|
|
#pragma multi_compile _ DOTS_INSTANCING_ON
|
|
// enable dithering LOD crossfade
|
|
#pragma multi_compile _ LOD_FADE_CROSSFADE
|
|
|
|
#define SHADERPASS SHADERPASS_FULL_SCREEN_DEBUG
|
|
#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/ShaderPassFullScreenDebug.hlsl"
|
|
|
|
#pragma vertex Vert
|
|
#pragma fragment Frag
|
|
|
|
ENDHLSL
|
|
}
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
Tags{ "RenderPipeline"="HDRenderPipeline" }
|
|
Pass
|
|
{
|
|
Name "IndirectDXR"
|
|
Tags{ "LightMode" = "IndirectDXR" }
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 xboxseries 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_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
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 xboxseries 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_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
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 xboxseries 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_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
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 xboxseries 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 "SubSurfaceDXR"
|
|
Tags{ "LightMode" = "SubSurfaceDXR" }
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 xboxseries 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_L1 PROBE_VOLUMES_L2
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
|
|
#define SHADERPASS SHADERPASS_RAYTRACING_SUB_SURFACE
|
|
|
|
#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/SubSurface/RayTracingIntersectionSubSurface.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/ShaderPassRayTracingSubSurface.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
Pass
|
|
{
|
|
Name "DebugDXR"
|
|
Tags{ "LightMode" = "DebugDXR" }
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 xboxseries ps5
|
|
#pragma raytracing surface_shader
|
|
|
|
#define SHADERPASS SHADERPASS_RAYTRACING_DEBUG
|
|
|
|
#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/RaytracingIntersection.hlsl"
|
|
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingCommon.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassRayTracingDebug.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
Pass
|
|
{
|
|
Name "PathTracingDXR"
|
|
Tags{ "LightMode" = "PathTracingDXR" }
|
|
|
|
HLSLPROGRAM
|
|
#include "./Include/GPUInstancerInclude.cginc"
|
|
#pragma instancing_options procedural:setupGPUI
|
|
#pragma multi_compile_instancing
|
|
|
|
|
|
#pragma only_renderers d3d11 xboxseries ps5
|
|
#pragma raytracing surface_shader
|
|
|
|
#pragma multi_compile _ DEBUG_DISPLAY
|
|
#pragma multi_compile _ SENSORSDK_OVERRIDE_REFLECTANCE
|
|
|
|
#ifdef SENSORSDK_OVERRIDE_REFLECTANCE
|
|
#define SENSORSDK_ENABLE_LIDAR
|
|
#endif
|
|
|
|
#define SHADERPASS SHADERPASS_PATH_TRACING
|
|
|
|
#pragma multi_compile DECALS_OFF DECALS_3RT DECALS_4RT
|
|
#pragma multi_compile _ DECAL_SURFACE_GRADIENT
|
|
|
|
// This is just because it needs to be defined, shadow maps are not used.
|
|
#define SHADOW_LOW
|
|
|
|
// For all single-sided, refractive materials, we want to force a thin refraction model.
|
|
#if !defined(_DOUBLESIDED_ON) && (defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE))
|
|
#undef _REFRACTION_PLANE
|
|
#undef _REFRACTION_SPHERE
|
|
#define _REFRACTION_THIN
|
|
#endif
|
|
|
|
#define LIGHTLOOP_DISABLE_TILE_AND_CLUSTER
|
|
#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
|
|
#define PATH_TRACING_CLUSTERED_DECALS
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RayTracingLightCluster.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/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
|
|
}
|
|
}
|
|
|
|
FallBack "Hidden/HDRP/FallbackError"
|
|
CustomEditor "Rendering.HighDefinition.LitGUI"
|
|
}
|