From 8d11ace1a6b147769b1e49fbee12da6e90274e47 Mon Sep 17 00:00:00 2001 From: Nissim Hadar Date: Wed, 25 Oct 2017 13:46:59 -0700 Subject: [PATCH 1/2] Bug 8610. --- libraries/render-utils/src/DeferredLightingEffect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index b6a91888a1..711094979f 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -509,7 +509,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, auto& program = deferredLightingEffect->_directionalSkyboxLight; LightLocationsPtr locations = deferredLightingEffect->_directionalSkyboxLightLocations; - auto keyLight = lightAndShadow.first; + auto keyLight = lightStage->getLight(0); // Setup the global directional pass pipeline { From bfab4668279a14f683a26b35778e328c8c1e6260 Mon Sep 17 00:00:00 2001 From: Nissim Hadar Date: Wed, 25 Oct 2017 14:13:53 -0700 Subject: [PATCH 2/2] Bug 8610. --- .../render-utils/src/DeferredLightingEffect.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index 711094979f..2187cb70b1 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -509,14 +509,21 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, auto& program = deferredLightingEffect->_directionalSkyboxLight; LightLocationsPtr locations = deferredLightingEffect->_directionalSkyboxLightLocations; - auto keyLight = lightStage->getLight(0); + auto keyLight = lightAndShadow.first; + + model::LightPointer keyAmbientLight; + if (lightStage && lightStage->_currentFrame._ambientLights.size()) { + keyAmbientLight = lightStage->getLight(lightStage->_currentFrame._ambientLights.front()); + } + bool hasAmbientMap = (keyAmbientLight != nullptr); // Setup the global directional pass pipeline { if (deferredLightingEffect->_shadowMapEnabled) { + // If the keylight has an ambient Map then use the Skybox version of the pass // otherwise use the ambient sphere version - if (keyLight->getAmbientMap()) { + if (hasAmbientMap) { program = deferredLightingEffect->_directionalSkyboxLightShadow; locations = deferredLightingEffect->_directionalSkyboxLightShadowLocations; } else { @@ -526,7 +533,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, } else { // If the keylight has an ambient Map then use the Skybox version of the pass // otherwise use the ambient sphere version - if (keyLight->getAmbientMap()) { + if (hasAmbientMap) { program = deferredLightingEffect->_directionalSkyboxLight; locations = deferredLightingEffect->_directionalSkyboxLightLocations; } else {