From 18ff55684fe77d58493218f748b012afee50423e Mon Sep 17 00:00:00 2001 From: Anis Date: Thu, 24 Sep 2020 17:09:29 +0200 Subject: [PATCH 1/2] Fixed the diffusion profile becoming invalid when hitting the reset (case 1269462). --- .../CHANGELOG.md | 2 ++ .../DiffusionProfileSettings.cs | 27 ++++++++++++++----- .../Utilities/DiffusionProfileHashTable.cs | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index d2cd053a6af..54ae24cae01 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -83,6 +83,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed SSGI compilation issues on PS4. - Fixed "Screen position out of view frustum" error when camera is on exactly the planar reflection probe plane. - Workaround issue that caused objects using eye shader to not be rendered on xbox. +- Fixed the usage of GUIEnable for volume components (case 1280018). +- Fixed the diffusion profile becoming invalid when hitting the reset (case 1269462). ### Changed - Preparation pass for RTSSShadows to be supported by render graph. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/DiffusionProfile/DiffusionProfileSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/Material/DiffusionProfile/DiffusionProfileSettings.cs index 3ec6613de7e..3b60ac18899 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/DiffusionProfile/DiffusionProfileSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/DiffusionProfile/DiffusionProfileSettings.cs @@ -1,4 +1,5 @@ using System; +using UnityEditor.Rendering.HighDefinition; namespace UnityEngine.Rendering.HighDefinition { @@ -52,14 +53,19 @@ public enum TransmissionMode : uint // Here we need to have one parameter in the diffusion profile parameter because the deserialization call the default constructor public DiffusionProfile(bool dontUseDefaultConstructor) + { + ResetToDefault(); + } + + public void ResetToDefault() { scatteringDistance = Color.grey; - transmissionTint = Color.white; - texturingMode = TexturingMode.PreAndPostScatter; - transmissionMode = TransmissionMode.ThinObject; - thicknessRemap = new Vector2(0f, 5f); - worldScale = 1f; - ior = 1.4f; // Typical value for skin specular reflectance + transmissionTint = Color.white; + texturingMode = TexturingMode.PreAndPostScatter; + transmissionMode = TransmissionMode.ThinObject; + thicknessRemap = new Vector2(0f, 5f); + worldScale = 1f; + ior = 1.4f; // Typical value for skin specular reflectance } internal void Validate() @@ -223,6 +229,15 @@ void OnEnable() #endif } + internal void Reset() + { + if (profile.hash == 0) + { + profile.ResetToDefault(); + profile.hash = DiffusionProfileHashTable.GenerateUniqueHash(this); + } + } + internal void UpdateCache() { worldScaleAndFilterRadiusAndThicknessRemap = new Vector4(profile.worldScale, diff --git a/com.unity.render-pipelines.high-definition/Runtime/Utilities/DiffusionProfileHashTable.cs b/com.unity.render-pipelines.high-definition/Runtime/Utilities/DiffusionProfileHashTable.cs index bb0fe224938..644b4252363 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Utilities/DiffusionProfileHashTable.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Utilities/DiffusionProfileHashTable.cs @@ -32,7 +32,7 @@ static uint GetDiffusionProfileHash(DiffusionProfileSettings asset) return (exponent << 23) | mantissa; } - static uint GenerateUniqueHash(DiffusionProfileSettings asset) + static internal uint GenerateUniqueHash(DiffusionProfileSettings asset) { uint hash = GetDiffusionProfileHash(asset); From bddc246ca6fd84a28df3fd31b8888e529830f2b8 Mon Sep 17 00:00:00 2001 From: Anis Date: Mon, 28 Sep 2020 09:26:04 +0200 Subject: [PATCH 2/2] removing unwanted changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 54ae24cae01..1191342d71d 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -83,7 +83,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed SSGI compilation issues on PS4. - Fixed "Screen position out of view frustum" error when camera is on exactly the planar reflection probe plane. - Workaround issue that caused objects using eye shader to not be rendered on xbox. -- Fixed the usage of GUIEnable for volume components (case 1280018). - Fixed the diffusion profile becoming invalid when hitting the reset (case 1269462). ### Changed