Skip to content

Commit 1be6758

Browse files
Fixed emission material properties not being animable (#4366)
* Fixed emission material properties not being animable * Updated changelog Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
1 parent 0aefd6d commit 1be6758

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
170170
- Fixed ray traced reflections that were too dark for unlit materials. Reflections are now more consistent with the material emissiveness.
171171
- Fixed pyramid color being incorrect when hardware dynamic resolution is enabled.
172172
- Fixed SSR Accumulation with Offset with Viewport Rect Offset on Camera
173+
- Fixed material Emission properties not begin animated when recording an animation (case 1328108).
173174

174175
### Changed
175176
- Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard

com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/EmissionUIBlock.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ internal static void UpdateEmissiveColorFromIntensityAndEmissiveColorLDR(Materia
116116
materialEditor.serializedObject.Update();
117117
}
118118

119+
internal static void UpdateEmissiveColorFromIntensityAndEmissiveColorLDR(MaterialProperty emissiveColorLDR, MaterialProperty emissiveIntensity, MaterialProperty emissiveColor)
120+
=> emissiveColor.colorValue = emissiveColorLDR.colorValue.linear * emissiveIntensity.floatValue;
121+
119122
internal static void UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(MaterialEditor materialEditor, Material[] materials)
120123
{
121124
materialEditor.serializedObject.ApplyModifiedProperties();
@@ -126,6 +129,12 @@ internal static void UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(Materia
126129
materialEditor.serializedObject.Update();
127130
}
128131

132+
internal static void UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(MaterialProperty emissiveColorLDR, MaterialProperty emissiveIntensity, MaterialProperty emissiveColor)
133+
{
134+
Color emissiveColorLDRLinear = emissiveColorLDR.colorValue / emissiveIntensity.floatValue;
135+
emissiveColorLDR.colorValue = emissiveColorLDRLinear.gamma;
136+
}
137+
129138
internal static void DoEmissiveIntensityGUI(MaterialEditor materialEditor, MaterialProperty emissiveIntensity, MaterialProperty emissiveIntensityUnit)
130139
{
131140
bool unitIsMixed = emissiveIntensityUnit.hasMixedValue;
@@ -186,13 +195,13 @@ protected override void OnGUIOpen()
186195
else
187196
{
188197
if (updateEmissiveColor)
189-
UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(materialEditor, materials);
198+
UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(emissiveColorLDR, emissiveIntensity, emissiveColor);
190199

191200
EditorGUI.BeginChangeCheck();
192201
DoEmissiveTextureProperty(emissiveColorLDR);
193202
DoEmissiveIntensityGUI(materialEditor, emissiveIntensity, emissiveIntensityUnit);
194203
if (EditorGUI.EndChangeCheck())
195-
UpdateEmissiveColorFromIntensityAndEmissiveColorLDR(materialEditor, materials);
204+
UpdateEmissiveColorFromIntensityAndEmissiveColorLDR(emissiveColorLDR, emissiveIntensity, emissiveColor);
196205
}
197206

198207
materialEditor.ShaderProperty(emissiveExposureWeight, Styles.emissiveExposureWeightText);

0 commit comments

Comments
 (0)