diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 85e32356676..cd7a777a286 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -151,6 +151,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Add support of lightlayers on indirect lighting controller - Added compute shader stripping. - Added Cull Mode option for opaque materials and ShaderGraphs. +- Added scene view exposure override. ### Fixed - Fix when rescale probe all direction below zero (1219246) diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs index 3a396a67f00..9f0b17d71bf 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs @@ -394,7 +394,7 @@ public void BeginFrame(CommandBuffer cmd, HDCamera camera, HDRenderPipeline hdIn // Fix exposure is store in Exposure Textures at the beginning of the frame as there is no need for color buffer // Dynamic exposure (Auto, curve) is store in Exposure Textures at the end of the frame (as it rely on color buffer) // Texture current and previous are swapped at the beginning of the frame. - bool isFixedExposure = IsExposureFixed(); + bool isFixedExposure = IsExposureFixed(camera); if (isFixedExposure) { using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.FixedExposure))) @@ -489,7 +489,7 @@ void PoolSource(ref RTHandle src, RTHandle dst) // Dynamic exposure - will be applied in the next frame // Not considered as a post-process so it's not affected by its enabled state - if (!IsExposureFixed() && m_ExposureControlFS) + if (!IsExposureFixed(camera) && m_ExposureControlFS) { using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.DynamicExposure))) { @@ -894,7 +894,7 @@ static void DoCopyAlpha(in DoCopyAlphaParameters parameters, RTHandle source, RT #region Exposure [MethodImpl(MethodImplOptions.AggressiveInlining)] - bool IsExposureFixed() => m_Exposure.mode.value == ExposureMode.Fixed || m_Exposure.mode.value == ExposureMode.UsePhysicalCamera; + bool IsExposureFixed(HDCamera camera) => m_Exposure.mode.value == ExposureMode.Fixed || m_Exposure.mode.value == ExposureMode.UsePhysicalCamera || (camera.camera.cameraType == CameraType.SceneView && HDAdditionalSceneViewSettings.sceneExposureOverriden); public RTHandle GetExposureTexture(HDCamera camera) { @@ -979,10 +979,15 @@ void DoFixedExposure(CommandBuffer cmd, HDCamera camera) int kernel = 0; - if (m_Exposure.mode.value == ExposureMode.Fixed) + if (m_Exposure.mode.value == ExposureMode.Fixed || (HDAdditionalSceneViewSettings.sceneExposureOverriden && camera.camera.cameraType == CameraType.SceneView)) { kernel = cs.FindKernel("KFixedExposure"); - cmd.SetComputeVectorParam(cs, HDShaderIDs._ExposureParams, new Vector4(m_Exposure.compensation.value + m_DebugExposureCompensation, m_Exposure.fixedExposure.value, 0f, 0f)); + var exposureParam = new Vector4(m_Exposure.compensation.value + m_DebugExposureCompensation, m_Exposure.fixedExposure.value, 0f, 0f); + if (HDAdditionalSceneViewSettings.sceneExposureOverriden) + { + exposureParam = new Vector4(0.0f, HDAdditionalSceneViewSettings.sceneExposure, 0f, 0f); + } + cmd.SetComputeVectorParam(cs, HDShaderIDs._ExposureParams, exposureParam); } else if (m_Exposure.mode == ExposureMode.UsePhysicalCamera) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDAdditionalSceneViewSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDAdditionalSceneViewSettings.cs index 6f629822036..99670b5ad96 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDAdditionalSceneViewSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Utilities/HDAdditionalSceneViewSettings.cs @@ -11,6 +11,8 @@ static class Styles { public static readonly GUIContent AAMode = EditorGUIUtility.TrTextContent("Camera Anti-aliasing", "The anti-alising mode that will be used in the scene view camera."); public static readonly GUIContent StopNaNs = EditorGUIUtility.TrTextContent("Camera Stop NaNs", "When enabled, any NaNs in the color buffer of the scene view camera will be suppressed."); + public static readonly GUIContent OverrideExposure = EditorGUIUtility.TrTextContent("Override Exposure", "When enabled, the scene exposure is overridden with the selected value."); + public static readonly GUIContent OverriddenExposure = EditorGUIUtility.TrTextContent("Scene Exposure", "The value for the overridden exposure."); #if UNITY_2020_2_OR_NEWER public static readonly string HelpBox = "Temporal Anti - aliasing in the Scene View is only supported when Always Refresh is enabled."; #else @@ -102,6 +104,21 @@ public static bool sceneViewStopNaNs set => s_SceneViewStopNaNs.value = value; } + static CachedEditorPref s_SceneExposureOverride = new CachedEditorPref("HDRP:SceneViewCamera:OverrideExposure", false); + + public static bool sceneExposureOverriden + { + get => s_SceneExposureOverride.value; + set => s_SceneExposureOverride.value = value; + } + + static CachedEditorPref s_SceneExposure = new CachedEditorPref("HDRP:SceneViewCamera:Exposure", 10.0f); + + public static float sceneExposure + { + get => s_SceneExposure.value; + set => s_SceneExposure.value = value; + } static HDAdditionalSceneViewSettings() { SceneViewCameraWindow.additionalSettingsGui += DoAdditionalSettings; @@ -111,12 +128,15 @@ static void DoAdditionalSettings(SceneView sceneView) { EditorGUILayout.Space(); EditorGUILayout.LabelField("HD Render Pipeline", EditorStyles.boldLabel); - sceneViewAntialiasing = (AntialiasingMode)EditorGUILayout.EnumPopup(Styles.AAMode, sceneViewAntialiasing); if (sceneViewAntialiasing == AntialiasingMode.TemporalAntialiasing) EditorGUILayout.HelpBox(Styles.HelpBox, MessageType.Info); sceneViewStopNaNs = EditorGUILayout.Toggle(Styles.StopNaNs, sceneViewStopNaNs); + + sceneExposureOverriden = EditorGUILayout.Toggle(Styles.OverrideExposure, sceneExposureOverriden); + if (sceneExposureOverriden) + sceneExposure = EditorGUILayout.Slider(Styles.OverriddenExposure, sceneExposure, -11.0f, 16.0f); } } #endif