From 7f2ba53e75e1eb581616b946b7c98ab51a61b424 Mon Sep 17 00:00:00 2001 From: Julien Ignace Date: Tue, 28 Apr 2020 10:07:12 +0200 Subject: [PATCH 1/2] Fixed flickering of the game/scene view when lookdev is running. --- .../Runtime/Sky/SkyManager.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 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 52bb03f685c..1192bc4e189 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs @@ -697,7 +697,7 @@ public void UpdateEnvironment( HDCamera hdCamera, // This is to avoid cases in which the probe camera is below ground and the parent is not, leading to // in case of PBR sky to a black sky. All other parameters are left as is. // This can introduce inaccuracies, but they should be acceptable if the distance parent camera - probe camera is - // small. + // small. if (hdCamera.camera.cameraType == CameraType.Reflection && hdCamera.parentCamera != null) { worldSpaceCameraPos = hdCamera.parentCamera.transform.position; @@ -794,13 +794,14 @@ public void UpdateEnvironment(HDCamera hdCamera, ScriptableRenderContext renderC // because we only maintain one static sky. Since we don't care that the static lighting may be a bit different in the preview we never recompute // and we use the one from the main camera. bool forceStaticUpdate = false; + 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. - forceStaticUpdate = true; + // 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; ; #endif if ((ambientMode == SkyAmbientMode.Static || forceStaticUpdate) && hdCamera.camera.cameraType != CameraType.Preview) { - StaticLightingSky staticLightingSky = GetStaticLightingSky(); if (staticLightingSky != null) { m_StaticLightingSky.skySettings = staticLightingSky.skySettings; From 51895716e6c21ab4e8b3d7380a5fcbba898652c4 Mon Sep 17 00:00:00 2001 From: Julien Ignace Date: Wed, 6 May 2020 14:18:39 +0200 Subject: [PATCH 2/2] Update changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 6bc9f3a247e..8a3b62f0e58 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -66,6 +66,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Made more explicit the warning about raytracing and asynchronous compute. Also fixed the condition in which it appears. - Fixed a null ref exception in static sky when the default volume profile is invalid. - Fixed an error about procedural sky being logged by mistake. +- Fixed flickering of the game/scene view when lookdev is running. ### Changed - Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history.