Skip to content

Fixed emission material properties not being animable #4366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed ray traced reflections that were too dark for unlit materials. Reflections are now more consistent with the material emissiveness.
- Fixed pyramid color being incorrect when hardware dynamic resolution is enabled.
- Fixed SSR Accumulation with Offset with Viewport Rect Offset on Camera
- 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down