Skip to content

Fix cached directional shadows disappearing when going out of shadow range to never reappear #6802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed Normal Map assiignation when importing FBX Materials.
- Fixed issue with HDRI Sky and shadow filtering quality set to high.
- Fixed the default custom pass buffer format from R8G8B8A8_SNorm to R8G8B8A8_UNorm. Additionally, an option in the custom pass buffer format settings is available to use the old format.
- Fixed cached directional light shadows disappearing without reappearing when the going outside of the range of shadow validity.

## [14.0.0] - 2021-11-17

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ public TextureHandle GetOutputTexture(RenderGraph renderGraph)
if (m_UseSharedTexture)
{
Debug.Assert(m_Output.IsValid());
var requestedDesc = GetAtlasDesc();
// We check if we need to refresh the desc. It is needed for directional lights.
if (renderGraph.GetTextureDesc(m_Output).width != requestedDesc.width)
{
renderGraph.RefreshSharedTextureDesc(m_Output, requestedDesc);
}

return m_Output; // Should always be valid.
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public void InitShadowManager(HDRenderPipelineRuntimeResources renderPipelineRes
HDShadowAtlas.BlurAlgorithm cascadeBlur = GetDirectionalShadowAlgorithm() == DirectionalShadowAlgorithm.IMS ? HDShadowAtlas.BlurAlgorithm.IM : HDShadowAtlas.BlurAlgorithm.None;

HDShadowAtlas.HDShadowAtlasInitParameters dirAtlasInitParams = punctualAtlasInitParams;
dirAtlasInitParams.useSharedTexture = false;
dirAtlasInitParams.useSharedTexture = true;
dirAtlasInitParams.width = 1;
dirAtlasInitParams.height = 1;
dirAtlasInitParams.atlasShaderID = HDShaderIDs._ShadowmapCascadeAtlas;
Expand Down