diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index 4ae4c37000c..8a77735a6d3 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue in shaderGraph target where the ShaderPass.hlsl was being included after SHADERPASS was defined - Fixed an issue where Particle Lit shader had an incorrect fallback shader [case 1312459] - Fixed an issue with backbuffer MSAA on Vulkan desktop platforms. +- Fixed shadow cascade blend culling factor. ### Changed - Change Asset/Create/Shader/Universal Render Pipeline/Lit Shader Graph to Asset/Create/Shader Graph/URP/Lit Shader Graph diff --git a/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs b/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs index cb10b6961cd..fded7ef5189 100644 --- a/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs +++ b/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs @@ -176,10 +176,7 @@ void RenderMainLightCascadeShadowmap(ref ScriptableRenderContext context, ref Cu for (int cascadeIndex = 0; cascadeIndex < m_ShadowCasterCascadesCount; ++cascadeIndex) { - //settings.splitData = m_CascadeSlices[cascadeIndex].splitData; // NOTE: currently DrawShadows culls more casters if no ShadowSplitData.cullingPlanes are set (version cds 8652678b), so it is currently better to not pass the m_CascadeSlices[cascadeIndex].splitData object returned by CullingResults.ComputeDirectionalShadowMatricesAndCullingPrimitives (change introduced in 8bf71cf). Culling is only based on the ShadowSplitData.cullingSphere distances. - var splitData = settings.splitData; - splitData.cullingSphere = m_CascadeSplitDistances[cascadeIndex]; - settings.splitData = splitData; + settings.splitData = m_CascadeSlices[cascadeIndex].splitData; Vector4 shadowBias = ShadowUtils.GetShadowBias(ref shadowLight, shadowLightIndex, ref shadowData, m_CascadeSlices[cascadeIndex].projectionMatrix, m_CascadeSlices[cascadeIndex].resolution); ShadowUtils.SetupShadowCasterConstantBuffer(cmd, ref shadowLight, shadowBias); diff --git a/com.unity.render-pipelines.universal/Runtime/ShadowUtils.cs b/com.unity.render-pipelines.universal/Runtime/ShadowUtils.cs index e8dd7b4dce8..6437e3577d9 100644 --- a/com.unity.render-pipelines.universal/Runtime/ShadowUtils.cs +++ b/com.unity.render-pipelines.universal/Runtime/ShadowUtils.cs @@ -57,6 +57,10 @@ public static bool ExtractDirectionalLightMatrix(ref CullingResults cullResults, shadowSliceData.resolution = shadowResolution; shadowSliceData.shadowTransform = GetShadowTransform(shadowSliceData.projectionMatrix, shadowSliceData.viewMatrix); + // This used to be fixed to .6f, but is now configureable. + // It is the culling sphere radius multiplier for shadow cascade blending + shadowSliceData.splitData.shadowCascadeBlendCullingFactor = 0.6f; + // If we have shadow cascades baked into the atlas we bake cascade transform // in each shadow matrix to save shader ALU and L/S if (shadowData.mainLightShadowCascadesCount > 1)