From 738e848dc51ec72e2d3442967f7d72e84cabb626 Mon Sep 17 00:00:00 2001 From: troublemaker52025 Date: Wed, 13 Jan 2021 13:37:33 +0800 Subject: [PATCH] After the shadowMap rendering of all lights is completed,restore the ShadowUBO data of the main light. (#3214) --- native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp b/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp index 3dd3fd2e26..e708fec871 100644 --- a/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp +++ b/native/cocos/renderer/pipeline/shadow/ShadowFlow.cpp @@ -67,7 +67,6 @@ void ShadowFlow::render(Camera *camera) { if (!shadowInfo->enabled) return; lightCollecting(camera, _validLights); shadowCollecting(pipeline, camera); - pipeline->updateShadowUBO(camera); if (shadowInfo->getShadowType() != ShadowType::SHADOWMAP || pipeline->getShadowObjects().size() == 0) return; const auto &shadowFramebufferMap = pipeline->getShadowFramebufferMap(); for (const auto *light : _validLights) { @@ -85,6 +84,10 @@ void ShadowFlow::render(Camera *camera) { shadowStage->render(camera); } } + + // After the shadowMap rendering of all lights is completed, + // restore the ShadowUBO data of the main light. + pipeline->updateShadowUBO(camera); } void ShadowFlow::resizeShadowMap(const Light *light, const uint width, const uint height) const {