Skip to content

Fix flickering lighting in the scene and game view when lookdev is open. #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed issue with screen-space shadows not enabled properly when RT is disabled (case 1235821)
- Fixed a performance issue with stochastic ray traced area shadows.
- Fixed cookie texture not updated when changing an import settings (srgb for example).
- Fixed flickering of the game/scene view when lookdev is running.

### Changed
- Improve MIP selection for decals on Transparents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down