diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index c91b6526b68..9384939ddc1 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added documentation for LODs not being supported by ray tracing. - Added more options to control how the component of motion vectors coming from the camera transform will affect the motion blur with new clamping modes. - Added anamorphism support for phsyical DoF, switched to blue noise sampling and fixed tiling artifacts. +- Added a warning when trying to bake with static lighting being in an invalid state. ### Fixed - Fixed an issue where the Exposure Shader Graph node had clipped text. (case 1265057) 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 42c93cf1f3c..223dac3910c 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs @@ -1073,8 +1073,18 @@ void OnBakeStarted() if (m_StandardSkyboxMaterial == null) m_StandardSkyboxMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.shaders.skyboxCubemapPS); - // At the start of baking we need to update the GI system with the static lighting sky in order for lightmaps and probes to be baked with it. + // It is possible that HDRP hasn't rendered any frame when clicking the bake lighting button. + // This can happen when baked lighting debug are used for example and no other window with HDRP is visible. + // This will result in the static lighting cubemap not being up to date with what the user put in the Environment Lighting panel. + // We detect this here (basically we just check if the skySetting in the currently processed m_StaticLightingSky is the same as the one the user set). + // And issue a warning if applicable. var staticLightingSky = GetStaticLightingSky(); + if (staticLightingSky != null && staticLightingSky.skySettings != m_StaticLightingSky.skySettings) + { + Debug.LogWarning("Static Lighting Sky is not ready for baking. Please make sure that at least one frame has been rendered with HDRP before baking. For example you can achieve this by having Scene View visible with Draw Mode set to Shaded."); + } + + // At the start of baking we need to update the GI system with the static lighting sky in order for lightmaps and probes to be baked with it. if (m_StaticLightingSky.skySettings != null && IsCachedContextValid(m_StaticLightingSky)) { var renderingContext = m_CachedSkyContexts[m_StaticLightingSky.cachedSkyRenderingContextId].renderingContext;