Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed custom pass injection point not visible in the UI when using the Camera mode.
- Fixed film grain & dithering when using spatial upscaling methods for DRS.
- Fixed a regression that was introduced in the diffuse denoiser in a previous PR.
- Fixed sky override layer mask having no effect.

### Changed
- Use RayTracingAccelerationStructure.CullInstances to filter Renderers and populate the acceleration structure with ray tracing instances for improved CPU performance on the main thread.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ public override LayerMask selectedCameraLayerMask
{
#if UNITY_EDITOR
if (m_SelectedCameraIndex <= 0 || m_SelectedCameraIndex > additionalCameraDatas.Count + 1)
return (LayerMask)0;
return 0;
if (m_SelectedCameraIndex == 1)
return -1;
{
// For scene view, use main camera volum layer mask. See HDCamera.cs
var mainCamera = Camera.main;
if (mainCamera != null && mainCamera.TryGetComponent<HDAdditionalCameraData>(out var mainCamAdditionalData))
return mainCamAdditionalData.volumeLayerMask;
return HDCamera.GetSceneViewLayerMaskFallback();
}
return additionalCameraDatas[m_SelectedCameraIndex - 2].volumeLayerMask;
#else
if (m_SelectedCameraIndex <= 0 || m_SelectedCameraIndex > additionalCameraDatas.Count)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1325,12 +1325,12 @@ internal void UpdateCurrentSky(SkyManager skyManager)
// When we switch from override to no override, we need to make sure that the visual sky will actually be properly re-rendered.
// Resetting the visual sky hash will ensure that.
visualSky.skyParametersHash = -1;

m_LightingOverrideSky.skySettings = newSkyOverride;
m_LightingOverrideSky.cloudSettings = newCloudOverride;
m_LightingOverrideSky.volumetricClouds = newVolumetricCloudsOverride;
lightingSky = m_LightingOverrideSky;
}

m_LightingOverrideSky.skySettings = newSkyOverride;
m_LightingOverrideSky.cloudSettings = newCloudOverride;
m_LightingOverrideSky.volumetricClouds = newVolumetricCloudsOverride;
lightingSky = m_LightingOverrideSky;
}
}
}
Expand Down Expand Up @@ -1650,6 +1650,19 @@ void UpdateFrustum(in ViewConstants viewConstants)
}
}

internal static int GetSceneViewLayerMaskFallback()
{
HDRenderPipeline hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline;
// If the override layer is "Everything", we fall-back to "Everything" for the current layer mask to avoid issues by having no current layer
// In practice we should never have "Everything" as an override mask as it does not make sense (a warning is issued in the UI)
if (hdPipeline.asset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyLightingOverrideLayerMask == -1)
return -1;

// Remove lighting override mask and layer 31 which is used by preview/lookdev
return (-1 & ~(hdPipeline.asset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyLightingOverrideLayerMask | (1 << 31)));

}

void UpdateVolumeAndPhysicalParameters()
{
volumeAnchor = null;
Expand Down Expand Up @@ -1684,15 +1697,7 @@ void UpdateVolumeAndPhysicalParameters()

if (needFallback)
{
HDRenderPipeline hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline;
// If the override layer is "Everything", we fall-back to "Everything" for the current layer mask to avoid issues by having no current layer
// In practice we should never have "Everything" as an override mask as it does not make sense (a warning is issued in the UI)
if (hdPipeline.asset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyLightingOverrideLayerMask == -1)
volumeLayerMask = -1;
else
// Remove lighting override mask and layer 31 which is used by preview/lookdev
volumeLayerMask = (-1 & ~(hdPipeline.asset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyLightingOverrideLayerMask | (1 << 31)));

volumeLayerMask = GetSceneViewLayerMaskFallback();
// Use the default physical camera values so the exposure will look reasonable
physicalParameters = HDPhysicalCamera.GetDefaults();
}
Expand Down