From 5758b07e60a6b1e35a7d2fa62ee4ef56e9d6f474 Mon Sep 17 00:00:00 2001 From: Antoine Lelievre Date: Wed, 28 Apr 2021 17:41:56 +0200 Subject: [PATCH 1/2] Fixed emission material properties not being animable --- .../Editor/Material/UIBlocks/EmissionUIBlock.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/EmissionUIBlock.cs b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/EmissionUIBlock.cs index d95718b4cc0..9a6cb060e80 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/EmissionUIBlock.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/EmissionUIBlock.cs @@ -116,6 +116,9 @@ internal static void UpdateEmissiveColorFromIntensityAndEmissiveColorLDR(Materia materialEditor.serializedObject.Update(); } + internal static void UpdateEmissiveColorFromIntensityAndEmissiveColorLDR(MaterialProperty emissiveColorLDR, MaterialProperty emissiveIntensity, MaterialProperty emissiveColor) + => emissiveColor.colorValue = emissiveColorLDR.colorValue.linear * emissiveIntensity.floatValue; + internal static void UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(MaterialEditor materialEditor, Material[] materials) { materialEditor.serializedObject.ApplyModifiedProperties(); @@ -126,6 +129,12 @@ internal static void UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(Materia materialEditor.serializedObject.Update(); } + internal static void UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(MaterialProperty emissiveColorLDR, MaterialProperty emissiveIntensity, MaterialProperty emissiveColor) + { + Color emissiveColorLDRLinear = emissiveColorLDR.colorValue / emissiveIntensity.floatValue; + emissiveColorLDR.colorValue = emissiveColorLDRLinear.gamma; + } + internal static void DoEmissiveIntensityGUI(MaterialEditor materialEditor, MaterialProperty emissiveIntensity, MaterialProperty emissiveIntensityUnit) { bool unitIsMixed = emissiveIntensityUnit.hasMixedValue; @@ -186,13 +195,13 @@ protected override void OnGUIOpen() else { if (updateEmissiveColor) - UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(materialEditor, materials); + UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(emissiveColorLDR, emissiveIntensity, emissiveColor); EditorGUI.BeginChangeCheck(); DoEmissiveTextureProperty(emissiveColorLDR); DoEmissiveIntensityGUI(materialEditor, emissiveIntensity, emissiveIntensityUnit); if (EditorGUI.EndChangeCheck()) - UpdateEmissiveColorFromIntensityAndEmissiveColorLDR(materialEditor, materials); + UpdateEmissiveColorFromIntensityAndEmissiveColorLDR(emissiveColorLDR, emissiveIntensity, emissiveColor); } materialEditor.ShaderProperty(emissiveExposureWeight, Styles.emissiveExposureWeightText); From 626f06e0e2c65d01a48fe2fd9c4625ed3aea9de3 Mon Sep 17 00:00:00 2001 From: Antoine Lelievre Date: Wed, 28 Apr 2021 17:46:16 +0200 Subject: [PATCH 2/2] 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 d29b7633109..72812c339e2 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -167,6 +167,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue where sometime a docked lookdev could be rendered at zero size and break. - Fixed an issue where runtime debug window UI would leak game objects. - Fixed NaNs when denoising pixels where the dot product between normal and view direction is near zero (case 1329624). +- Fixed material Emission properties not begin animated when recording an animation (case 1328108). ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard