Fix incorrect directional light shadows influence on secondary render views

#1758
This commit is contained in:
Wojtek Figat
2023-11-06 14:20:30 +01:00
parent 1e9ded55b0
commit 9a9e32d4c5
3 changed files with 11 additions and 1 deletions

View File

@@ -343,6 +343,7 @@ void RenderInner(SceneRenderTask* task, RenderContext& renderContext, RenderCont
// Prepare
renderContext.View.Prepare(renderContext);
renderContext.Buffers->Prepare();
ShadowsPass::Instance()->Prepare();
// Build batch of render contexts (main view and shadow projections)
{

View File

@@ -549,10 +549,17 @@ void ShadowsPass::Dispose()
SAFE_DELETE_GPU_RESOURCE(_shadowMapCube);
}
void ShadowsPass::Prepare()
{
// Clear cached data
_shadowData.Clear();
LastDirLightIndex = -1;
LastDirLightShadowMap = nullptr;
}
void ShadowsPass::SetupShadows(RenderContext& renderContext, RenderContextBatch& renderContextBatch)
{
PROFILE_CPU();
_shadowData.Clear();
auto& view = renderContext.View;
// Update shadow map

View File

@@ -94,6 +94,8 @@ public:
LightShadowData LastDirLight;
public:
void Prepare();
/// <summary>
/// Setups the shadows rendering for batched scene drawing. Checks which lights will cast a shadow.
/// </summary>