From e1ed9fb3fb463a44c1ad0a32c2f768b2344949f5 Mon Sep 17 00:00:00 2001 From: alelievr Date: Wed, 26 Jan 2022 16:20:34 +0100 Subject: [PATCH 1/4] Fixed static lighting sky update when using an HDRI sky with a render texture in parameter --- .../Runtime/Sky/HDRISky/HDRISky.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs index f2704227e30..55eb79d0c02 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs @@ -150,8 +150,8 @@ public override int GetHashCode() hash = hash * 23 + dirLightShadow.overrideState.GetHashCode(); hash = hash * 23 + rectLightShadow.overrideState.GetHashCode(); #else - hash = hdriSky.value != null ? hash * 23 + hdriSky.GetHashCode() : hash; - hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; + hash = hdriSky.value != null ? hash * 23 + CoreUtils.GetTextureHash(hdriSky.value) : hash; + hash = flowmap.value != null ? hash * 23 + CoreUtils.GetTextureHash(flowmap.value) : hash; hash = hash * 23 + distortionMode.GetHashCode(); hash = hash * 23 + upperHemisphereOnly.GetHashCode(); hash = hash * 23 + scrollOrientation.GetHashCode(); From cac05452f8251267ae910453f5b6e2e1260f3ef1 Mon Sep 17 00:00:00 2001 From: alelievr Date: Wed, 26 Jan 2022 16:20:46 +0100 Subject: [PATCH 2/4] updated changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index a53c1c6d89f..1c24a690f4a 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -67,6 +67,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue where APV cells were not populated properly when probe volumes have rotations - Fixed issue where changes to APV baking set lists were not saved. - Fixed Correlated Color Temperature not being applied in Player builds for Enlighten realtime GI lights (case 1370438); +- Fixed static lighting sky update when using an HDRI sky with a render texture in parameter. ## [14.0.0] - 2021-11-17 From f313c10dfcc3c97ae15f9104979373392b76cdfe Mon Sep 17 00:00:00 2001 From: alelievr Date: Wed, 26 Jan 2022 18:58:58 +0100 Subject: [PATCH 3/4] Added hashcodes for all volume texture parameters --- .../Runtime/Volume/VolumeParameter.cs | 104 ++++++++++++++++++ .../Runtime/Sky/HDRISky/HDRISky.cs | 4 +- 2 files changed, 106 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.core/Runtime/Volume/VolumeParameter.cs b/com.unity.render-pipelines.core/Runtime/Volume/VolumeParameter.cs index 724f19a4646..d27da86dbe0 100644 --- a/com.unity.render-pipelines.core/Runtime/Volume/VolumeParameter.cs +++ b/com.unity.render-pipelines.core/Runtime/Volume/VolumeParameter.cs @@ -1449,6 +1449,19 @@ public TextureParameter(Texture value, bool overrideState = false) : base(value, overrideState) { } // TODO: Texture interpolation + + public override int GetHashCode() + { + int hash = base.GetHashCode(); + + unchecked + { + if (value != null) + hash = 23 * CoreUtils.GetTextureHash(value); + } + + return hash; + } } /// @@ -1464,6 +1477,19 @@ public class NoInterpTextureParameter : VolumeParameter /// The initial override state for the parameter. public NoInterpTextureParameter(Texture value, bool overrideState = false) : base(value, overrideState) { } + + public override int GetHashCode() + { + int hash = base.GetHashCode(); + + unchecked + { + if (value != null) + hash = 23 * CoreUtils.GetTextureHash(value); + } + + return hash; + } } /// @@ -1479,6 +1505,19 @@ public class Texture2DParameter : VolumeParameter /// The initial override state for the parameter. public Texture2DParameter(Texture value, bool overrideState = false) : base(value, overrideState) { } + + public override int GetHashCode() + { + int hash = base.GetHashCode(); + + unchecked + { + if (value != null) + hash = 23 * CoreUtils.GetTextureHash(value); + } + + return hash; + } } /// @@ -1494,6 +1533,19 @@ public class Texture3DParameter : VolumeParameter /// The initial override state for the parameter. public Texture3DParameter(Texture value, bool overrideState = false) : base(value, overrideState) { } + + public override int GetHashCode() + { + int hash = base.GetHashCode(); + + unchecked + { + if (value != null) + hash = 23 * CoreUtils.GetTextureHash(value); + } + + return hash; + } } /// @@ -1511,6 +1563,19 @@ public RenderTextureParameter(RenderTexture value, bool overrideState = false) : base(value, overrideState) { } // TODO: RenderTexture interpolation + + public override int GetHashCode() + { + int hash = base.GetHashCode(); + + unchecked + { + if (value != null) + hash = 23 * CoreUtils.GetTextureHash(value); + } + + return hash; + } } /// @@ -1526,6 +1591,19 @@ public class NoInterpRenderTextureParameter : VolumeParameter /// The initial override state for the parameter. public NoInterpRenderTextureParameter(RenderTexture value, bool overrideState = false) : base(value, overrideState) { } + + public override int GetHashCode() + { + int hash = base.GetHashCode(); + + unchecked + { + if (value != null) + hash = 23 * CoreUtils.GetTextureHash(value); + } + + return hash; + } } /// @@ -1542,6 +1620,19 @@ public class CubemapParameter : VolumeParameter public CubemapParameter(Texture value, bool overrideState = false) : base(value, overrideState) { } // TODO: Cubemap interpolation + + public override int GetHashCode() + { + int hash = base.GetHashCode(); + + unchecked + { + if (value != null) + hash = 23 * CoreUtils.GetTextureHash(value); + } + + return hash; + } } /// @@ -1557,6 +1648,19 @@ public class NoInterpCubemapParameter : VolumeParameter /// The initial override state for the parameter. public NoInterpCubemapParameter(Cubemap value, bool overrideState = false) : base(value, overrideState) { } + + public override int GetHashCode() + { + int hash = base.GetHashCode(); + + unchecked + { + if (value != null) + hash = 23 * CoreUtils.GetTextureHash(value); + } + + return hash; + } } /// diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs index 55eb79d0c02..f2704227e30 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs @@ -150,8 +150,8 @@ public override int GetHashCode() hash = hash * 23 + dirLightShadow.overrideState.GetHashCode(); hash = hash * 23 + rectLightShadow.overrideState.GetHashCode(); #else - hash = hdriSky.value != null ? hash * 23 + CoreUtils.GetTextureHash(hdriSky.value) : hash; - hash = flowmap.value != null ? hash * 23 + CoreUtils.GetTextureHash(flowmap.value) : hash; + hash = hdriSky.value != null ? hash * 23 + hdriSky.GetHashCode() : hash; + hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; hash = hash * 23 + distortionMode.GetHashCode(); hash = hash * 23 + upperHemisphereOnly.GetHashCode(); hash = hash * 23 + scrollOrientation.GetHashCode(); From 67906394ebe573df4bb2178b6859bb39ef593e27 Mon Sep 17 00:00:00 2001 From: alelievr Date: Thu, 27 Jan 2022 16:06:16 +0100 Subject: [PATCH 4/4] Fix hdri sky code --- .../Runtime/Sky/HDRISky/HDRISky.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs index f2704227e30..37ba44e6357 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs @@ -150,8 +150,8 @@ public override int GetHashCode() hash = hash * 23 + dirLightShadow.overrideState.GetHashCode(); hash = hash * 23 + rectLightShadow.overrideState.GetHashCode(); #else - hash = hdriSky.value != null ? hash * 23 + hdriSky.GetHashCode() : hash; - hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; + hash = hash * 23 + hdriSky.GetHashCode(); + hash = hash * 23 + flowmap.GetHashCode(); hash = hash * 23 + distortionMode.GetHashCode(); hash = hash * 23 + upperHemisphereOnly.GetHashCode(); hash = hash * 23 + scrollOrientation.GetHashCode();