Skip to content

Commit 56ace1e

Browse files
[7.x.x backport] Fix quality settings UI and shadow mask UI #122 (#123)
* Update HDRenderPipeline.cs * Update HDRenderPipeline.cs * Update HDRenderPipeline.cs * Update CHANGELOG.md * fix typo * fix typo 2
1 parent ea70f9b commit 56ace1e

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
5959
- Fixed unneeded cookie texture allocation for cone stop lights.
6060
- Fixed issue when toggling anything in HDRP asset that will produce an error (case 1238155)
6161
- Diffusion Profile and Material references in HDRP materials are now correctly exported to unity packages. Note that the diffusion profile or the material references need to be edited once before this can work properly.
62+
- Fixed shadowmask UI now correctly showing shadowmask disable
6263

6364
### Changed
6465
- Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history.

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ internal static Volume GetOrCreateDefaultVolume()
103103
readonly PostProcessSystem m_PostProcessSystem;
104104
readonly XRSystem m_XRSystem;
105105

106+
// Keep track of previous Graphic and QualitySettings value to reset when switching to another pipeline
107+
bool m_PreviousLightsUseLinearIntensity;
108+
bool m_PreviousLightsUseColorTemperature;
109+
bool m_PreviousSRPBatcher;
110+
ShadowmaskMode m_PreviousShadowMaskMode;
111+
106112
bool m_FrameSettingsHistoryEnabled = false;
107113

108114
/// <summary>
@@ -660,16 +666,22 @@ void SetRenderingFeatures()
660666
Shader.globalRenderPipeline = "HDRenderPipeline";
661667

662668
// HD use specific GraphicsSettings
669+
m_PreviousLightsUseLinearIntensity = GraphicsSettings.lightsUseLinearIntensity;
663670
GraphicsSettings.lightsUseLinearIntensity = true;
671+
m_PreviousLightsUseColorTemperature = GraphicsSettings.lightsUseColorTemperature;
664672
GraphicsSettings.lightsUseColorTemperature = true;
665-
673+
m_PreviousSRPBatcher = GraphicsSettings.useScriptableRenderPipelineBatching;
666674
GraphicsSettings.useScriptableRenderPipelineBatching = m_Asset.enableSRPBatcher;
667675

676+
// In case shadowmask mode isn't setup correctly, force it to correct usage (as there is no UI to fix it)
677+
m_PreviousShadowMaskMode = QualitySettings.shadowmaskMode;
678+
QualitySettings.shadowmaskMode = ShadowmaskMode.DistanceShadowmask;
679+
668680
SupportedRenderingFeatures.active = new SupportedRenderingFeatures()
669681
{
670682
reflectionProbeModes = SupportedRenderingFeatures.ReflectionProbeModes.Rotation,
671683
defaultMixedLightingModes = SupportedRenderingFeatures.LightmapMixedBakeModes.IndirectOnly,
672-
mixedLightingModes = SupportedRenderingFeatures.LightmapMixedBakeModes.IndirectOnly | SupportedRenderingFeatures.LightmapMixedBakeModes.Shadowmask,
684+
mixedLightingModes = SupportedRenderingFeatures.LightmapMixedBakeModes.IndirectOnly | (m_Asset.currentPlatformRenderPipelineSettings.supportShadowMask ? SupportedRenderingFeatures.LightmapMixedBakeModes.Shadowmask : 0),
673685
lightmapBakeTypes = LightmapBakeType.Baked | LightmapBakeType.Mixed | LightmapBakeType.Realtime,
674686
lightmapsModes = LightmapsMode.NonDirectional | LightmapsMode.CombinedDirectional,
675687
lightProbeProxyVolumes = true,
@@ -774,10 +786,12 @@ void UnsetRenderingFeatures()
774786
{
775787
Shader.globalRenderPipeline = "";
776788

777-
SupportedRenderingFeatures.active = new SupportedRenderingFeatures();
789+
GraphicsSettings.lightsUseLinearIntensity = m_PreviousLightsUseLinearIntensity;
790+
GraphicsSettings.lightsUseColorTemperature = m_PreviousLightsUseColorTemperature;
791+
GraphicsSettings.useScriptableRenderPipelineBatching = m_PreviousSRPBatcher;
792+
QualitySettings.shadowmaskMode = m_PreviousShadowMaskMode;
778793

779-
// Reset srp batcher state just in case
780-
GraphicsSettings.useScriptableRenderPipelineBatching = false;
794+
SupportedRenderingFeatures.active = new SupportedRenderingFeatures();
781795

782796
Lightmapping.ResetDelegate();
783797
}

0 commit comments

Comments
 (0)