#pragma vertex Vert
#pragma fragment Frag
#include "ShaderLibrary/Common.hlsl"
#include "ShaderLibrary/ImageBasedLighting.hlsl"
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/ImageBasedLighting.hlsl"
TEXTURECUBE(_InputCubemap);
SAMPLER(sampler_InputCubemap);
#include "../Debug/DebugDisplay.cs.hlsl"
#include "../ShaderVariables.hlsl"
#pragma multi_compile _ SHADOWS_SHADOWMASK
// CAUTION: In case deferred lighting need to support various lighting model statically, we will require to do multicompile with different define like UNITY_MATERIAL_LIT
#define UNITY_MATERIAL_LIT // Need to be define before including Material.hlsl
// Include
//-------------------------------------------------------------------------------------
// Note: We have fix as guidelines that we have only one deferred material (with control of GBuffer enabled). Mean a users that add a new
// deferred material must replace the old one here. If in the future we want to support multiple layout (cause a lot of consistency problem),
{
var srpPath = GetScriptableRenderPipelinePath();
if (srpPath != null)
return Path.Combine(srpPath, "ScriptableRenderPipeline/HDRenderPipeline/");
return Path.Combine(srpPath, "ScriptableRenderPipeline/HDRenderPipeline/HDRP/");
return "Packages/com.unity.render-pipelines.high-definition/";
return "Packages/com.unity.render-pipelines.high-definition/HDRP/";
}
public static string GetPostProcessingPath()
return Path.Combine(srpPath, "ScriptableRenderPipeline/Core/");
return Path.Combine(srpPath, "ScriptableRenderPipeline/Core/CoreRP");
// If the SRPMARKER is not found, we assume that a package setup is used.
return "Packages/com.unity.render-pipelines.core/";
#include "../Debug/DebugDisplay.hlsl"
// Each #kernel tells which function to compile; you can have many kernels
#pragma kernel DeferredDirectionalShadow
#include "Lighting.hlsl"
#include "../../Debug/DebugDisplay.hlsl"
#define SHADOWCONTEXT_MAX_COMPSAMPLER 1
#define SHADOW_OPTIMIZE_REGISTER_USAGE 1
#include "ShaderLibrary/Shadow/Shadow.hlsl"
#include "CoreRP/ShaderLibrary/Shadow/Shadow.hlsl"
TEXTURE2D_ARRAY(_ShadowmapExp_VSM_0);
SAMPLER(sampler_ShadowmapExp_VSM_0);
#pragma kernel BuildDispatchIndirect
#include "LightLoop.cs.hlsl"
#include "../../ShaderVariables.hlsl"
#pragma kernel BigTileLightListGen
#include "ShaderLibrary/common.hlsl"
#include "CoreRP/ShaderLibrary/common.hlsl"
#include "LightingConvexHullUtils.hlsl"
#include "SortingComputeUtils.hlsl"
#pragma kernel TileLightListGen_DepthRT_MSAA_SrcBigTile LIGHTLISTGEN=TileLightListGen_DepthRT_MSAA_SrcBigTile ENABLE_DEPTH_TEXTURE_BACKPLANE MSAA_ENABLED USE_TWO_PASS_TILED_LIGHTING
#pragma kernel ClearAtomic
#include "ShaderBase.hlsl"
//#pragma #pragma enable_d3d11_debug_symbols
// #pragma enable_d3d11_debug_symbols
#pragma kernel ScreenBoundsAABB
uniform int g_isOrthographic;
#ifndef UNITY_LIGHTING_INCLUDED
#define UNITY_LIGHTING_INCLUDED
#include "ShaderLibrary/CommonLighting.hlsl"
#include "ShaderLibrary/CommonShadow.hlsl"
#include "ShaderLibrary/Sampling/Sampling.hlsl"
#include "ShaderLibrary/AreaLighting.hlsl"
#include "CoreRP/ShaderLibrary/CommonLighting.hlsl"
#include "CoreRP/ShaderLibrary/CommonShadow.hlsl"
#include "CoreRP/ShaderLibrary/Sampling/Sampling.hlsl"
#include "CoreRP/ShaderLibrary/AreaLighting.hlsl"
// The light loop (or lighting architecture) is in charge to:
// - Define light list
#include "ShaderLibrary/Wind.hlsl"
#include "CoreRP/ShaderLibrary/Wind.hlsl"
#include "../../ShaderPass/FragInputs.hlsl"
#include "../../ShaderPass/ShaderPass.cs.hlsl"
//-------------------------------------------------------------------------------------
// Fill SurfaceData/Builtin data function
#include "ShaderLibrary/Packing.hlsl"
#include "ShaderLibrary/Sampling/SampleUVMapping.hlsl"
#include "CoreRP/ShaderLibrary/Packing.hlsl"
#include "CoreRP/ShaderLibrary/Sampling/SampleUVMapping.hlsl"
void GetSurfaceData(float2 texCoordDS, out DecalSurfaceData surfaceData)
// Ref: PBRT v3, 13.6.7 "Piecewise-Constant 2D Distributions".
// Note that we use the equiareal sphere-to-square mapping instead of the latitude-longitude one.
/* --- Input --- */
// Precomputes data for IntegrateLD(). See that function for a detailed description.
#ifdef SHADER_API_MOBILE
#define MAX_IBL_SAMPLE_CNT 34
#include "GGXConvolution.cs.hlsl"
return BlendLayeredScalar(height0, height1, height2, height3, weights);
#include "ShaderLibrary/PerPixelDisplacement.hlsl"
#include "CoreRP/ShaderLibrary/PerPixelDisplacement.hlsl"
#endif // defined(_PIXEL_DISPLACEMENT) && LAYERS_HEIGHTMAP_ENABLE
#include "ShaderLibrary/GeometricTools.hlsl"
#include "ShaderLibrary/tessellation.hlsl"
#include "CoreRP/ShaderLibrary/GeometricTools.hlsl"
#include "CoreRP/ShaderLibrary/tessellation.hlsl"
// Define refraction keyword helpers
#define HAS_REFRACTION (defined(_REFRACTION_PLANE) || defined(_REFRACTION_SPHERE))
#if HAS_REFRACTION
# include "ShaderLibrary/Refraction.hlsl"
# include "CoreRP/ShaderLibrary/Refraction.hlsl"
# if defined(_REFRACTION_PLANE)
# define REFRACTION_MODEL(V, posInputs, bsdfData) RefractionModelPlane(V, posInputs.positionWS, bsdfData.normalWS, bsdfData.ior, bsdfData.thickness)
#include "../MaterialUtilities.hlsl"
#include "../Decal/DecalUtilities.hlsl"
return SAMPLE_TEXTURE2D_LOD(_HeightMap, sampler_HeightMap, param.uv + texOffsetCurrent, lod).r;
void ApplyDisplacementTileScale(inout float height)
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#include "../../../ShaderVariables.hlsl"
struct Attributes
#ifndef UNITY_MATERIAL_INCLUDED
#define UNITY_MATERIAL_INCLUDED
#include "ShaderLibrary/Color.hlsl"
#include "ShaderLibrary/BSDF.hlsl"
#include "ShaderLibrary/Debug.hlsl"
#include "ShaderLibrary/CommonMaterial.hlsl"
#include "ShaderLibrary/EntityLighting.hlsl"
#include "CoreRP/ShaderLibrary/Color.hlsl"
#include "CoreRP/ShaderLibrary/BSDF.hlsl"
#include "CoreRP/ShaderLibrary/Debug.hlsl"
#include "CoreRP/ShaderLibrary/CommonMaterial.hlsl"
#include "CoreRP/ShaderLibrary/EntityLighting.hlsl"
#include "../Sky/AtmosphericScattering/AtmosphericScattering.hlsl"
// Guidelines for Material Keyword.
TEXTURE2D(_IrradianceSource);
// Included headers
//--------------------------------------------------------------------------------------------------
#include "ShaderLibrary/SpaceFillingCurves.hlsl"
#include "CoreRP/ShaderLibrary/SpaceFillingCurves.hlsl"
#include "../../Lighting/LightDefinition.cs.hlsl"
#include "SubsurfaceScattering.hlsl"
#include "SubsurfaceScatteringSettings.cs.hlsl"
#include "ShaderLibrary\Packing.hlsl"
#include "CommonSubsurfaceScattering.hlsl"
// Subsurface scattering constant
#include "ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "../Material/Builtin/BuiltinData.hlsl"
TEXTURE2D(_DistortionTexture);
#include "../ShaderPass/FragInputs.hlsl"
#include "../ShaderPass/VaryingMesh.hlsl"
#include "../Lighting/LightDefinition.cs.hlsl"
Texture2D<float> _Source;
RWTexture2D<float> _Result;
#define USE_LEGACY_UNITY_MATRIX_VARIABLES
#ifdef SSS_MODEL_BASIC
#include "../../Material/SubsurfaceScattering/CommonSubsurfaceScattering.hlsl"
#ifndef UNITY_ATMOSPHERIC_SCATTERING_INCLUDED
#define UNITY_ATMOSPHERIC_SCATTERING_INCLUDED
#include "ShaderLibrary/VolumeRendering.hlsl"
#include "CoreRP/ShaderLibrary/VolumeRendering.hlsl"
#include "AtmosphericScattering.cs.hlsl"
#include "../SkyVariables.hlsl"
#pragma fragment frag
TEXTURECUBE(_MainTex);
SAMPLER(sampler_MainTex);
TEXTURECUBE(_Cubemap);
SAMPLER(sampler_Cubemap);
#pragma enable_d3d11_debug_symbols
#include "AtmosphericScattering/AtmosphericScattering.hlsl"
#pragma multi_compile _ _ENABLE_SUN_DISK
float4 _SkyParam; // x exposure, y multiplier, z rotation
float4x4 _PixelCoordToViewDirWS; // Actually just 3x3, but Unity can only set 4x4
#ifndef LIGHTWEIGHT_PIPELINE_CORE_INCLUDED
#define LIGHTWEIGHT_PIPELINE_CORE_INCLUDED
#include "Input.hlsl"
#ifdef _NORMALMAP
#define LIGHTWEIGHT_SURFACE_INPUT_INCLUDED
#include "Core.hlsl"
#ifdef _SPECULAR_SETUP
#define SAMPLE_METALLICSPECULAR(uv) SAMPLE_TEXTURE2D(_SpecGlossMap, sampler_SpecGlossMap, uv)
#ifndef LIGHTWEIGHT_LIGHTING_INCLUDED
#define LIGHTWEIGHT_LIGHTING_INCLUDED
#include "Shadows.hlsl"
#include "InputSurface.hlsl"
#if defined (_COLORADDSUBDIFF_ON)
half4 _ColorAddSubDiff;
#ifndef LIGHTWEIGHT_SHADOWS_INCLUDED
#define LIGHTWEIGHT_SHADOWS_INCLUDED
#include "ShaderLibrary\Common.hlsl"
#define MAX_SHADOW_CASCADES 4
#define CUBEMAPFACE_NEGATIVE_Z 5
#if defined(SHADER_API_D3D11)
# include "ShaderLibrary/API/D3D11.hlsl"
# include "CoreRP/ShaderLibrary/API/D3D11.hlsl"
# include "ShaderLibrary/API/PSSL.hlsl"
# include "CoreRP/ShaderLibrary/API/PSSL.hlsl"
# include "ShaderLibrary/API/D3D11_1.hlsl"
# include "CoreRP/ShaderLibrary/API/D3D11_1.hlsl"
# include "ShaderLibrary/API/Metal.hlsl"
# include "CoreRP/ShaderLibrary/API/Metal.hlsl"
#include "ShaderLibrary/API/Validate.hlsl"
#include "CoreRP/ShaderLibrary/API/Validate.hlsl"
#include "Shadow.hlsl"
#define SHADOWCONTEXT_MAX_SAMPLER 0
TEXTURE2D_ARRAY(_ShadowmapExp_PCF);
SAMPLER2D_SHADOW(sampler_ShadowmapExp_PCF);
#define DIRECTIONAL_LIGHT (3)
#include "../../Fptl/Shadow.hlsl"
UNITY_DECLARE_DEPTH_TEXTURE(_CameraGBufferZ);
Cull Off
HLSLPROGRAM
#pragma vertex vert
#include "ShaderLibrary/BC6H.hlsl"
#include "CoreRP/ShaderLibrary/BC6H.hlsl"
TextureCube<float4> _Source;
RWTexture2DArray<uint4> _Target;
float4 _TextureScaleBias;
float _TextureSlice;
// Ref: http://jcgt.org/published/0003/02/01/paper.pdf
// Encode with Oct, this function work with any size of output
// return float between [-1, 1]
float2 PackNormalOctEncode(float3 n)
//float l1norm = dot(abs(n), 1.0);
//float2 res0 = n.xy * (1.0 / l1norm);
//float2 val = 1.0 - abs(res0.yx);
//return (n.zz < float2(0.0, 0.0) ? (res0 >= 0.0 ? val : -val) : res0);
// Optimized version of above code:
n *= rcp(dot(abs(n), 1.0));
float t = saturate(-n.z);
return n.xy + (n.xy >= 0.0 ? t : -t);
float3 UnpackNormalOctEncode(float2 f)
#define SHADOW_OPTIMIZE_REGISTER_USAGE 0
#endif
#include "Shadow/ShadowBase.cs.hlsl" // ShadowData definition, auto generated (don't modify)
#include "CoreRP/Shadow/ShadowBase.cs.hlsl" // ShadowData definition, auto generated (don't modify)
#include "ShadowTexFetch.hlsl" // Resource sampling definitions (don't modify)
struct ShadowContext
fileFormatVersion: 2
guid: ece10b06a2a0821449c2c303c83ac5b2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: