From b79df81cb1ffef09eedc47119dc81e24a48d36ee Mon Sep 17 00:00:00 2001 From: Benjamin John Spencer Date: Wed, 29 Jul 2020 14:48:17 +0100 Subject: [PATCH] GFXGI-237: Force update for static skies when camera type is set to SceneView --- .../Runtime/Sky/SkyManager.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs index 4bd8e47cb1e..b6c1199677d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs @@ -823,8 +823,10 @@ public void UpdateEnvironment(HDCamera hdCamera, ScriptableRenderContext renderC StaticLightingSky staticLightingSky = GetStaticLightingSky(); #if UNITY_EDITOR // In the editor, we might need the static sky ready for baking lightmaps/lightprobes regardless of the current ambient mode so we force it to update in this case if it's not been computed yet.. - // We don't test if the hash of the static sky has changed here because it depends on the sun direction and in the case of LookDev, sun will be different from the main rendering so it will induce improper recomputation. - forceStaticUpdate = staticLightingSky != null && m_StaticLightingSky.skyParametersHash == -1; + // We always force an update of the static sky when we're in scene view mode. Previous behaviour was to prevent forced updates if the hash of the static sky was non-null, but this was preventing + // the lightmapper from updating in response to changes in environment. See GFXGI-237 for a better description of this issue. + + forceStaticUpdate = hdCamera.camera.cameraType == CameraType.SceneView; #endif if ((ambientMode == SkyAmbientMode.Static || forceStaticUpdate) && hdCamera.camera.cameraType != CameraType.Preview) {