Skip to content

Conversation

jenniferd-unity
Copy link
Contributor

@jenniferd-unity jenniferd-unity commented Mar 26, 2021

Purpose of this PR

This PR aims to finish and polish the implementation of HDRP Global Settings for 2021.2.
Here is a list of changes:

Code-only changes:

  • Refactored code to use m_globalSettings instead of HDRenderPipelineGlobalSettings.instance for partial class of HDRenderPipeline [suggested by Julien Ignace]
  • Removed internal API HDRenderPipeline.defaultAsset
  • Renamed SerializedFrameSettings defaultFrameSettings; to defaultCameraFrameSettings
  • Cleaned a bit HDRenderPipeline localized strings (removed unnecessary ones)
  • Renamed VolumeProfileLookDev to LookDevVolumeProfile - as suggested by Remi Slysz

Fixed broken fixes:

  • Wizard - profile creation: default PR 3873 - previously fixed by Julien Ignace
  • DXR - missing resources depending on Quality Level: 1320304 - previously fixed by Anis Benyoub
  • 1313426

Fixes:

  • HDRP Global Settings Asset deletion when HDRP is active or not (the asset is recreated only if HDRP is active + an WARNING message displays in the console)
    image
    (Example showing error message when switching from URP to HDRP and no HDRP Global Settings asset was assigned in the Graphics Settings)
  • Warnings and Info messages in the HDRP Settings menu are clearer
    image
  • Fixed HDRP Asset creation when HDRP Global Settings was not present (for ex. my project was on URP only)
  • Frame Settings refactor (see below)
  • incl. fix for https://fogbugz.unity3d.com/f/cases/1323947/

image

Frame Settings refactor (see here):

  • Renamed in the HDRP Settings window Frame Settings to Frame Settings (Default Values)
  • made sure the value displayed in the Custom Frame Settings showed the value of the HDRP Global Settings asset
  • Changed: you can always edit a setting no matter the active HDRP Asset
  • Changed: when you edit Custom Frame Settings, you can always override values no matter the parent or HDRP Asset. it is disabled only when you cannot change them because it has no impact.
  • Changed: Virtual Texturing setting is no longer disabled in the UI but sanitized instead, better tooltip to show
  • Improved a few tooltips - still more to do but will be another PR
  • Checked the Debug Render Pipeline menu to ensure values shown are still correct

Example of how Frame Settings behave now (Camera / HDRP Global Settings):
frame-settings-behavior

Example of changes:
image


Testing status

Tested on Windows Editor for local test project and Template HD.
Tried also a build of Template HD.

Known issues: https://fogbugz.unity3d.com/f/cases/1323947/
Important to test that broken fixes are actually fixed + Frame Settings behave as expected


Comments to reviewers

This is the last PR for HDRP Global Settings planned before cut-off.

@github-actions github-actions bot added the HDRP label Mar 26, 2021
var hdrp = HDRenderPipeline.defaultAsset;
var material = hdrp != null ? hdrp.GetDefaultMirrorMaterial() : null;

var material = HDRenderPipeline.currentAsset?.GetDefaultMirrorMaterial();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we switch from default (gfx one) to current (potentially quality). Is this ok ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are fine, since GetDefaultMirrorMaterial will get the HDRP Global Settings one ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i could actually rewrite that to grab the HDRP Global Settings one!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in upcoming commit

hasMixedValues: serialized.maximumLODLevel.hasMultipleDifferentValues);

area.AmmendInfo(FrameSettingsField.MaterialQualityLevel,
overridedDefaultValue: defaultFrameSettings?.materialQuality.Into() ?? MaterialQualityMode.Medium,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it should be Medium above all other possibility? I mean if defaultFrameSettings is null, it means we are displaying the version in the global settings. So why it should be linked to Medium quality mode? This seams strange. At least it need comments to explain why we chose this default here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we needed to chose a value, i didnt know which one to use so i chose medium

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this need to be checked, perhaps ask TA and UX for this point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it can be fixed in a later PR perhaps

Comment on lines 10 to 11
const string renderingSettingsHeaderContent = "Rendering";
const string lightSettingsHeaderContent = "Lighting";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be localized?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! will fix

bool enabled = field.IsOverrideableWithDependencies(serializedFrameSettings, defaultFrameSettings);
withOverride &= enabled & GUI.enabled;
bool shouldBeDisabled = withOverride || !enabled || !GUI.enabled;
bool shouldBeDisabled = (withOverride || !enabled || !GUI.enabled);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uneeded parenthesis

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 101 to 102
volumeProfileDefault = serializedObject.FindProperty("m_VolumeProfileDefault");
volumeProfileLookDev = serializedObject.FindProperty("m_VolumeProfileLookDev");
lookDevVolumeProfile = serializedObject.FindProperty("m_LookDevVolumeProfile");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha sorry but now we have another name inconsistency here:
LookDevVolumeProfile
VolumeProfileDefault

Should this be defaultVolumeProfile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i could yes. will update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait if i change it, i need to obsolete and automatically rename no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any release with this version landed?
yes -> yes you need to
no -> just change it quickly before any release land

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those changes landed in srp2core so i did a migration pass in updated file

Comment on lines 96 to 97
m_OverrideState: 0
m_Value: 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too: value changed. Please check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove this file from the PR - i am not supposed to change it

m_Value: 1
m_Resolution:
m_OverrideState: 0
m_OverrideState: 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too: value changed. Please check

m_Value: 0
m_HighQualityFiltering:
m_OverrideState: 0
m_OverrideState: 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too: value changed. Please check

Comment on lines 28 to 39
cameraMotionBlur:
m_OverrideState: 0
m_Value: 1
specialCameraClampMode:
m_OverrideState: 0
m_Value: 0
cameraVelocityClamp:
m_OverrideState: 0
m_Value: 0.05
cameraTranslationVelocityClamp:
m_OverrideState: 0
m_Value: 0.05
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also for all added entry (here and bellow), check if it is still the default from code

@RSlysz
Copy link
Contributor

RSlysz commented Mar 29, 2021

Better :)
Check value in asset change and add a comment on why default on MaterialQualityMode.Medium and it will be good :)

internal static readonly GUIContent lensAttenuationModeContentLabel = EditorGUIUtility.TrTextContent("Lens Attenuation Mode", "Set the attenuation mode of the lens that is used to compute exposure. With imperfect lens some energy is lost when converting from EV100 to the exposure multiplier.");

internal static readonly GUIContent diffusionProfileSettingsLabel = EditorGUIUtility.TrTextContent("Diffusion Profile Assets");
internal static readonly string warningHdrpNotActive = "No HD Render Pipeline currently active. Verify your Graphics Settings and active Quality Level.";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewers: Currently error and warning messages in C# are left unlocalized.
See https://confluence.unity3d.com/display/LOC/Editor+Localization+Coding+Guidelines

{
}

void Draw_Warnings(ref SerializedHDRenderPipelineGlobalSettings serialized, Editor owner)
Copy link
Contributor

@JulienIgnace-Unity JulienIgnace-Unity Mar 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think code convention does not allow '_' inside names

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the file is like that and other windows UI code, so it should be good no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, according to code convention, we should not use _ except for prefixing https://ono.unity3d.com/unity-extra/unity-meta/raw/@/ReferenceSource/CSharp/Assets/CSharpReference.cs

So I assum it was already wrong at the time :/

@jenniferd-unity jenniferd-unity requested review from a team and eh-unity March 29, 2021 16:36
Removed _ in function names
Fixed issue when created HDRP Asset where HDRP Global Settings was not created
Removed changes on Default LookDev Profile
Changed Error to Warning when creating automatically Global Settings asset for the user
Copy link
Contributor

@RSlysz RSlysz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seams good. Check with UX/TA for default on medium quality for material. This need to be clarified (can be in later PR)

@jenniferd-unity jenniferd-unity self-assigned this Mar 30, 2021
# Conflicts:
#	com.unity.render-pipelines.high-definition/CHANGELOG.md
@jenniferd-unity jenniferd-unity marked this pull request as ready for review March 31, 2021 13:58
Copy link
Contributor

@eh-unity eh-unity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

// If ray tracing is not enabled we do not want to have ray tracing resources referenced
m_GlobalSettings.ClearRayTracingResources();
int qualityLevelCount = QualitySettings.names.Length;
for (int i = 0; i < qualityLevelCount && !requiresRayTracingResources; ++i)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just use break in the if instead of second condition of !requiresRayTracingResources
I think it's a bit easier to read that way.

Copy link
Contributor

@iM0ve iM0ve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing: Done

Whats tested:

  • Regression testing
    • Creating a new HDRP project and running the DXR wizard
    • Using Frame settings on multiple cameras
    • Frame settings can override Default settings. ex. If you turn on Opaque on camera but turn it off in Default - opaque objects will be rendered.
    • Switching quality settings Low->Med->High on Template. Works as intended.
    • Debug Scene camera and Other cameras correctly display active Frame Settings
    • If something is Off in the HDRP asset, but On in Frame settings. The feature will not be present in the scene, as expected.
    • Real-world usage: Upgrading Amalienborg, changing Frame Settings
    • Building a player
    • Changing Frame settings via Inspector and via Project Settings tab
    • Editing light layer names
  • Every fix as requested in PR
    • Wizard - profile creation: default PR 3873 - previously fixed by Julien Ignace
    • Building DXR HDRP template on High preset
    • Null ref when URP and HDRP are installed 1313426
    • HDRP Global Settings Asset is no longer created when URP or Default is the current renderer
    • HDRP Default settings not saving, case 1323947
  • Frame Settings refactor
    • Frame Settings is renamed
    • You can always edit a setting no matter the active HDRP Asset
    • you edit Custom Frame Settings, you can always override values no matter the parent or HDRP Asset. it is disabled only when you cannot change them because it has no impact.

Issues blocking the PR:

  1. [Fixed] Frame settings can not be saved
j0qFUlOGMR.mp4
  1. [Fixed] Error on reflection probe change
BKk2Dsm7yb.mp4

Issues I found that I will file fogbugz for, not blocking the PR:

  1. The path no longer exists described in the warning

image

  1. Global settings ignore the name specified in HDRP wizard
LCgkLo0eFZ.mp4

# Conflicts:
#	com.unity.render-pipelines.high-definition/CHANGELOG.md
#	com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs
#	com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs
@jenniferd-unity
Copy link
Contributor Author

Submitted fixes for the 3 issues reported @iM0ve and synced to latest master yesterday :)
Changes reviewed by @RSlysz too.
will relaunch a yamato but we should be good for another QA pass

@jenniferd-unity jenniferd-unity requested a review from iM0ve April 8, 2021 13:05
Copy link
Contributor

@iM0ve iM0ve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the review above. Should be good to merge now.
Filed 2 fogbugz for cosmetic issues:
https://fogbugz.unity3d.com/f/cases/1327978/
https://fogbugz.unity3d.com/f/cases/1327981/

@sebastienlagarde sebastienlagarde merged commit 67cb89a into master Apr 9, 2021
@sebastienlagarde sebastienlagarde deleted the hd/global-settings-polish branch April 9, 2021 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants