Skip to content

Added a warning when trying to bake with static lighting being in an invalid state. #2597

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 2 commits into from
Nov 13, 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 @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down