diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 81158c24c67..49507a57591 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -101,7 +101,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed ability to override AlphaToMask FrameSetting while camera in deferred lit shader mode - Fixed Missing lighting quality settings for SSGI (case 1312067). - Fixed HDRP material being constantly dirty. -- Fixed wizard checking FrameSettings not in HDRP Default Settings +- Fixed wizard checking FrameSettings not in HDRP Global Settings - Fixed error when opening the default composition graph in the Graphics Compositor (case 1318933). - Fixed gizmo rendering when wireframe mode is selected. - Fixed issue in path tracing, where objects would cast shadows even if not present in the path traced layers (case 1318857). @@ -115,7 +115,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed Nans happening when the history render target is bigger than the current viewport (case 1321139). - Fixed Tube and Disc lights mode selection (case 1317776) - Fixed preview camera updating the skybox material triggering GI baking (case 1314361/1314373). -- The default LookDev volume profile is now copied and referened in the Asset folder instead of the package folder. +- The default LookDev volume profile is now copied and referenced in the Asset folder instead of the package folder. - Fixed SSS on console platforms. - Assets going through the migration system are now dirtied. - Fixed warning fixed on ShadowLoop include (HDRISky and Unlit+ShadowMatte) @@ -197,6 +197,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Updated Wizard to better handle RenderPipelineAsset in Quality Settings - Added Global settings check in Wizard - Added localization on Wizard window +- UI for Frame Settings has been updated: default values in the HDRP Settings and Custom Frame Settings are always editable ## [11.0.0] - 2020-10-21 @@ -2230,6 +2231,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Remove unused _ComputeEyeIndex - Updated HDRenderPipelineAsset inspector - Re-enable SRP batcher for metal +- Updated Frame Settings UX in the HDRP Settings and Camera ## [5.2.0-preview] - 2018-11-27 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Custom-Post-Process.md b/com.unity.render-pipelines.high-definition/Documentation~/Custom-Post-Process.md index 7bbd6a984eb..0ad4427e76a 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Custom-Post-Process.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Custom-Post-Process.md @@ -203,7 +203,7 @@ By default, the Shader template provides you with the following inputs: HDRP allows you to customize the order of your custom post-processing effect at each injection point. To order your effects: -1. Go to **Edit > Project Settings** and select the **HDRP Default Settings** tab. +1. Go to **Edit > Project Settings > Graphics** and select the [HDRP Global Settings](Default-Settings-Window.md) tab. 2. Scroll down until you find the **Custom Post Process Orders** section. This section contains three lists, one for each injection point. diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Decal.md b/com.unity.render-pipelines.high-definition/Documentation~/Decal.md index 91d4e1bf3e9..c86b95789db 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Decal.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Decal.md @@ -15,9 +15,9 @@ Decal Meshes can only affect opaque Materials with either a [Decal Shader](Decal To use Decal Layers, first enable them in your Project’s [HDRP Asset](HDRP-Asset.md). You can then enable Decal Layers in your [Frame Settings](Frame-Settings.md) to set your Cameras to process Decal Layers. 1. Select the HDRP Asset in the Project window and, in the Inspector, go to **Decal > Layers** and enable the checkbox. -2. To enable Decal Layers in the default Frame Settings for all Cameras, in your HDRP Asset, go to the **Default Frame Settings For** section, select **Camera** from the drop-down and, in the **Rendering** section, enable the **Decal Layers** checkbox. +2. To enable Decal Layers for all Cameras, open the [HDRP Global Settings](Default-Settings-Window.md), go to the **Frame Settings (Default Values) > Camera** section and, in the **Rendering** section, enable the **Decal Layers** checkbox. -To override the Frame Settings for Cameras and set Decal Layers on an individual basis: +To override the Frame Settings for a specific Camera and set Decal Layers on an individual basis: 1. Click on a Camera in the Scene view or Hierarchy window to view its properties in the Inspector. 2. Go to the **General** section and enable the **Custom Frame Settings** checkbox. This exposes the **Frame Settings Overrides,** which you can use to customize this Camera only. @@ -34,7 +34,7 @@ After you enable Decal Layers, you can then use them to decouple Meshes from cer ## Renaming Decal Layers -By default, in the UI for Decal Projectors, Mesh Renderers, or Terrain, Decal Layers are named **Decal Layer 1-7**. To more easily differentiate between them, you can give each Decal Layer a specific name. To do this, open the [Default Settings Windows](Default-Settings-Window.md), and go to **Decal Layer Names**. Here you can set the name of each Decal Layer individually. +By default, in the UI for Decal Projectors, Mesh Renderers, or Terrain, Decal Layers are named **Decal Layer 1-7**. To more easily differentiate between them, you can give each Decal Layer a specific name. To do this, open the [HDRP Global Settings](Default-Settings-Window.md), and go to **Decal Layer Names**. Here you can set the name of each Decal Layer individually. ## Performance implications diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Default-Settings-Window.md b/com.unity.render-pipelines.high-definition/Documentation~/Default-Settings-Window.md index 4bbb5d4b2aa..841c18b3833 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Default-Settings-Window.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Default-Settings-Window.md @@ -4,7 +4,7 @@ The High Definition Render Pipeline (HDRP) adds the HDRP Settings tab to Unity's - Assign Render Pipeline Resources Assets for your HDRP Project. - Set the verboseness of Shader variant information that Unity writes to the Console window when you build your Project. -- Set up default [Frame Settings](Frame-Settings.md) for [Cameras](HDRP-Camera.md) to use. +- Set up default [Frame Setting](Frame-Settings.md) values for [Cameras](HDRP-Camera.md) to use. - Assign and edit a default [Volume Profile](Volume-Profile.md). The HDRP Settings tab is part of the Graphics Settings window. To get to this tab, select **Edit > Project Settings > Graphics** and then, in the sidebar, click **HDRP Settings**. @@ -22,7 +22,7 @@ Resources assets list the Shaders, Materials, Textures, and other Assets needed ## Frame Settings -[Frame Settings](Frame-Settings.md) control the rendering passes that Cameras make at runtime. This section allows you to set default Frame Settings that all Cameras use if you do not enable their Custom Frame Settings checkbox. For information about what each property does, see [Frame Settings](Frame-Settings.md). +[Frame Settings](Frame-Settings.md) control the rendering passes that Cameras make at runtime. This section allows you to set default values for the Frame Settings that all Cameras use if you do not enable their Custom Frame Settings checkbox. For information about what each property does, see [Frame Settings](Frame-Settings.md). ### Volume Profiles diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings-API.md b/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings-API.md index 7d1385e7574..75b6cacd1ae 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings-API.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings-API.md @@ -1,27 +1,27 @@ # Frame Settings Scripting API -In the High Definition Render Pipelines (HDRP), [Frame Settings](Frame-Settings.md) control how a rendering component, such as a [Camera](HDRP-Camera.md), [Reflection Probe](Reflection-Probe.md), or [Planar Reflection Probe](Planar-Reflection-Probe.md), renders a Scene. You can specify default Frame Settings for your entire Project and then override them for a particular rendering component. This means that each Frame Setting has a default value, set in the [HDRP Asset](HDRP-Asset.md), then each individual rendering component in your Scene can have an override for it. This is useful if you have lower priority rendering components that do not need to use certain effects. To specify which default Frame Settings a rendering component overrides, each rendering component contains an [override mask](../api/UnityEngine.Rendering.HighDefinition.FrameSettingsOverrideMask.html). A mask is an array of bits, where each bit represents one of two states (0 for disabled and 1 for enabled). Each bit in the override mask represents the override state of a particular Frame Setting. +In the High Definition Render Pipelines (HDRP), [Frame Settings](Frame-Settings.md) control how a rendering component, such as a [Camera](HDRP-Camera.md), [Reflection Probe](Reflection-Probe.md), or [Planar Reflection Probe](Planar-Reflection-Probe.md), renders a Scene. You can specify default Frame Setting values for your entire Project and then override them for a particular rendering component. This means that each Frame Setting has a default value, set in the [HDRP Global Settings](Default-Settings-Window.md), then each individual rendering component in your Scene can have an override for it. This is useful if you have lower priority rendering components that do not need to use certain effects. To specify which default Frame Setting values a rendering component overrides, each rendering component contains an [override mask](../api/UnityEngine.Rendering.HighDefinition.FrameSettingsOverrideMask.html). A mask is an array of bits, where each bit represents one of two states (0 for disabled and 1 for enabled). Each bit in the override mask represents the override state of a particular Frame Setting. To get the final value of a Frame Setting for a particular rendering component, HDRP performs the following steps: -1. Checks the Project-wide default value for the Frame Setting. In this step, HDRP checks the current value stored for the Frame Setting in the HDRP Asset. +1. Checks the Project-wide default value for the Frame Setting. In this step, HDRP checks the current value stored for the Frame Setting in the HDRP Global Settings Asset. 2. Checks the rendering component's override mask to see if the bit that corresponds to the Frame Setting is set. The state of the Frame Setting's bit in the override mask corresponds to the state of the override checkbox to the left of the Frame Setting in the rendering component's Inspector. 3. Gets the Frame Setting's override value from the rendering component's custom Frame Settings. 4. Sanitizes the result. To lighten your Project, you can specify which features to use in the HDRP Asset. If the Frame Setting you try to modify affects an unavailable feature, Unity discards it in this final sanitization pass. To make sure it is not possible for HDRP to process features that are not available, you cannot access the sanitization process via scripting API. -## Modifying default Frame Settings +## Modifying default Frame Setting values -The Default Frame Settings are in the HDRP Asset, so it is not good practice to modify them at runtime. Instead, you can modify them in Edit mode in [Default Settings tab](Default-Settings-Window.md). +The project's HDRP Global Settings asset stores default values to apply to Frame Settings, so it is not good practice to modify them at runtime. Instead, you can modify them in Edit mode in [HDRP Global Settings](Default-Settings-Window.md). -Note that you can set individual default Frame Settings for three types of rendering component: +Note that you can set individual default values for three types of rendering component: - Cameras - Realtime Reflection Probes and Realtime Planar Reflection Probes - Baked/custom Reflection Probes and Baked/custom Planar Reflection Probe -There is currently no scripting API to modify default Frame Settings. +There is currently no scripting API to modify default values for the Frame Settings. -## Modifying Frame Settings for a particular rendering component +## Modifying Frame Setting values for a particular rendering component HDRP stores the Frame Settings for rendering components in additional data components attached to the rendering component. The additional data components are: diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings.md b/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings.md index fe1ff211161..937a6c763d2 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Frame-Settings.md @@ -1,16 +1,16 @@ # Frame Settings -Frame Settings are settings HDRP uses to render Cameras, real-time, baked, and custom reflections. You can set the default Frame Settings for each of these three individually from within the [HDRP Default Settings](Default-Settings-Window.md) tab (menu: **Edit > Project Settings > HDRP Default Settings**). +Frame Settings are settings HDRP uses to render Cameras, real-time, baked, and custom reflections. You can set the default values for Frame Settings for each of these three individually from within the [HDRP Global Settings](Default-Settings-Window.md) tab (menu: **Edit > Project Settings > Graphics > HDRP Settings**). ![](Images/FrameSettings1.png) -**Default Frame Settings For** is not just the title of the section, it also corresponds to the drop-down menu, to its right, that allows you to select which component to change the default Frame Settings for. Before you change any Frame Settings, select a component from the drop-down menu. The options are Camera, Baked or Custom Reflection, and Realtime Reflection. After you select a component, you can change the default settings HDRP uses to render a frame using that component. To make Cameras and Reflection Probes use their respective default Frame Settings, disable the **Custom Frame Settings** checkbox under the **General** settings of Cameras or under **Capture Settings** of Reflection Probes. +To make Cameras and Reflection Probes use their respective default values for Frame Settings, disable the **Custom Frame Settings** checkbox under the **General** settings of Cameras or under **Capture Settings** of Reflection Probes. -You can override the default Frame Settings on a per component basis. Enable the **Custom Frame Settings** checkbox to set specific Frame Settings for individual Cameras and Reflection Probes.This exposes the Frame Settings Override which gives you access to the same settings as in default Frame Settings within the HDRP Asset. Edit the settings within the Frame Settings Override to create a Frame Settings profile for an individual component. +You can override the default value of a Frame Setting on a per component basis. Enable the **Custom Frame Settings** checkbox to set specific Frame Settings for individual Cameras and Reflection Probes. This exposes the Frame Settings Override which gives you access to the same settings as within the HDRP Global Settings. Edit the settings within the Frame Settings Override to create a Frame Settings profile for an individual component. Note that baked Reflection Probes use the Frame Settings at baking time only. After that, HDRP uses the baked texture without modifying it with updated Frame Settings. -Note: Some options are grayed-out depending on whether you have enabled/disabled them in the Render Pipeline Supported Features section of your HDRP Asset. +Note: If [Virtual Texturing](https://docs.unity3d.com/Documentation/Manual/svt-streaming-virtual-texturing.html) is disabled in your project, the **Virtual Texturing** setting is grayed-out. Frame Settings affect all Cameras and Reflection Probes. HDRP handles Reflection Probes in the same way it does Cameras, this includes Frame Settings. All Cameras and Reflection Probes either use the default Frame Settings or a Frame Settings Override to render the Scene. @@ -83,7 +83,7 @@ These settings control lighting features for your rendering components. Here you | **Screen Space Ambient Occlusion** | Enable the checkbox to make HDRP process Screen Space Ambient Occlusion (SSAO). This allows HDRP to calculate SSAO for this Camera/Reflection Probe. | | **Transmission** | Enable the checkbox to make HDRP process the transmission effect. This allows subsurface scattering Materials to use transmission, for example, light transmits through a leaf with a subsurface scattering Material. | | **Fog** | Enable the checkbox to make HDRP process atmospheric scattering. This allows your Camera/Reflection Probe to process atmospheric scattering effects such as the [fog](HDRP-Features.md#fog) from your Scene’s Volumes. | -| - **Volumetrics** | Enable the checkbox to make HDRP process Volumetrics. Enabling this setting allows your rendering component to render volumetric fog and lighting. | +| - **Volumetrics** | Enable the checkbox to make HDRP process Volumetrics. Enabling this setting allows your rendering component to render volumetric fog and lighting. | | - - **Reprojection** | Enable the checkbox to improve the quality of volumetrics at runtime. Enabling this feature causes HDRP to use several previous frames to calculate the volumetric effects. Using these previous frames helps to reduce noise and smooth out the effects. | | **Light Layers** | Enable the checkbox to make HDRP process Light Layers. | | **Exposure Control** | Enable the checkbox to use the exposure values you can set on relevant components in HDRP. Disable this checkbox to use a neutral value (0 Ev100) instead. | diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/CustomPostProcess1.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/CustomPostProcess1.png index 15027bb0f1a..f4277a3a833 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Images/CustomPostProcess1.png +++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/CustomPostProcess1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:87793912d9710c40c12e3e38bfb3a5a040ddd61396eb5b07ec60c252196ac881 -size 46741 +oid sha256:61147bbe5277ee849faa4ba34075ad2d314a7d8088028e6abe646094a9ffec52 +size 44219 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/FrameSettings1.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/FrameSettings1.png index 8a8e6015ab7..d25442d37d5 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Images/FrameSettings1.png +++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/FrameSettings1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4180272b9d6fe2421557e4c1a3d6702fd67d9d50849883850a6c6f9b1bfbc148 -size 10000 +oid sha256:5d9d6e624030432bb40daa6313b27025017412a7859f3f299c57802da3acf90c +size 49001 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRPQualitySettingsPanel.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRPQualitySettingsPanel.png index 000ab5eb017..d5ad915a700 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRPQualitySettingsPanel.png +++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRPQualitySettingsPanel.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:253f67db34a6b7be1269e836cbd4c096af75de5a3b192c8b761f2124da615f43 -size 37840 +oid sha256:0fd18051cc4dafd81b58ecdc1924a27c814b92279c665f854b47037ba2bb85e4 +size 59284 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/PostProcessOrder_ProjectSettings.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/PostProcessOrder_ProjectSettings.png index 817a45780b4..a907bceef67 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Images/PostProcessOrder_ProjectSettings.png +++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/PostProcessOrder_ProjectSettings.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:408965cd5f2b379de38d8312f2eb67a34e503cbc62072909deccf5431e933d41 -size 36157 +oid sha256:49bbb9a7b56d54f7c280f1486d10ac9a9330b1be12f82343a2611326890d0009 +size 41880 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Light-Layers.md b/com.unity.render-pipelines.high-definition/Documentation~/Light-Layers.md index e3def188563..c0c261a3041 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Light-Layers.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Light-Layers.md @@ -6,10 +6,10 @@ The High Definition Render Pipeline (HDRP) allows you to use Light Layers, which ## Enabling Light Layers -To use Light Layers, you must enable them in your Project’s [HDRP Asset](HDRP-Asset.md). You can then enable Light Layers in your default [Frame Settings](Frame-Settings.md) to set your Cameras to process Light Layers. +To use Light Layers, you must enable them in your Project’s [HDRP Asset](HDRP-Asset.md). You can then enable Light Layers in the [Frame Settings](Frame-Settings.md) to set your Cameras to process Light Layers. 1. Select the HDRP Asset in the Project window and, in the Inspector, go to **Lighting > Light Layers** and enable the **Enable** checkbox. -2. To enable Light Layers in the default Frame Settings for all Cameras, in the [Default Settings Windows](Default-Settings-Window.md), go to the **Default Frame Settings For** section, select **Camera** from the drop-down and, in the **Lighting** section, enable the **Light Layers** checkbox. +2. To enable Light Layers for all Cameras, open the [HDRP Global Settings](Default-Settings-Window.md), go to the **Frame Settings (Default Values) > Camera** section and, in the **Rendering** section, enable the **Light Layers** checkbox. To override the Frame Settings for Cameras and set Light Layers on an individual basis: @@ -42,7 +42,7 @@ You can now use the **Light Layers** drop-down in the **Shadows** section to set ## Renaming Light Layers -By default, in the UI for Lights, Mesh Renderers or Terrain, Light Layers are named **Light Layer 1-7**. To more easily differentiate between them, you can give each Light Layer a specific name. To do this, open the [Default Settings Windows](Default-Settings-Window.md), and go to **Light Layer Names**. Here you can set the name of each Light Layer individually. +By default, in the UI for Lights, Mesh Renderers or Terrain, Light Layers are named **Light Layer 1-7**. To more easily differentiate between them, you can give each Light Layer a specific name. To do this, open the [HDRP Global Settings](Default-Settings-Window.md), and go to **Light Layer Names**. Here you can set the name of each Light Layer individually. ## Example scenario for Light Layers diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Post-Processing-Main.md b/com.unity.render-pipelines.high-definition/Documentation~/Post-Processing-Main.md index 50189c3ffaf..d1e799c6c6e 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Post-Processing-Main.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Post-Processing-Main.md @@ -2,7 +2,7 @@ The High Definition Render Pipeline (HDRP) includes its own purpose-built implementation for [post-processing](https://docs.unity3d.com/Manual/PostProcessingOverview.html). This is built into HDRP, so you do not need to install any other package. -This implementation uses the [Volume](Volumes.md) system. You add post-processing effects to your Camera in the same way you add any other [Volume Override](Volume-Components.md). Note that HDRP already enables some post-processing effects in the [Default Settings Volume Profile](Default-Settings-Window.md). +This implementation uses the [Volume](Volumes.md) system. You add post-processing effects to your Camera in the same way you add any other [Volume Override](Volume-Components.md). Note that HDRP already enables some post-processing effects in the [HDRP Global Settings](Default-Settings-Window.md), go to Section **Volume Profiles**. The images below show a Scene with and without HDRP post-processing. diff --git a/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md b/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md index 0e050649116..1417d58323a 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md @@ -70,7 +70,7 @@ * Render Pipeline Settings * [HDRP Asset](HDRP-Asset.md) * [Frame Settings](Frame-Settings.md) - * [Default Settings](Default-Settings-Window.md) + * [HDRP Global Settings](Default-Settings-Window.md) * [HDRP Config Package](HDRP-Config-Package.md) * [Scalability](Scalability-Manual.md) * Materials diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/PlanarReflectionProbeEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/PlanarReflectionProbeEditor.cs index 236b976da8c..61d1fd525e5 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/PlanarReflectionProbeEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/PlanarReflectionProbeEditor.cs @@ -13,7 +13,7 @@ namespace UnityEditor.Rendering.HighDefinition sealed class PlanarReflectionProbeEditor : HDProbeEditor { public static Material GUITextureBlit2SRGBMaterial - => HDRenderPipeline.defaultAsset.renderPipelineEditorResources.materials.GUITextureBlit2SRGB; + => HDRenderPipelineGlobalSettings.instance?.renderPipelineEditorResources?.materials.GUITextureBlit2SRGB; const float k_PreviewHeight = 128; @@ -32,8 +32,8 @@ static Material previewMaterial { get { - if (_previewMaterial == null) - _previewMaterial = new Material(HDRenderPipeline.defaultAsset.renderPipelineEditorResources.materials.GUITextureBlit2SRGB); + if (_previewMaterial == null && HDRenderPipeline.isReady) + _previewMaterial = new Material(GUITextureBlit2SRGBMaterial); return _previewMaterial; } } diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/ReflectionMenuItem.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/ReflectionMenuItem.cs index a8a4bc6ffbb..a103a7740ea 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/ReflectionMenuItem.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/ReflectionMenuItem.cs @@ -18,9 +18,7 @@ static void CreateMirrorGameObject(MenuCommand menuCommand) var planarProbe = plane.AddComponent(); planarProbe.influenceVolume.boxSize = new Vector3(10, 0.01f, 10); - var hdrp = HDRenderPipeline.defaultAsset; - var material = hdrp != null ? hdrp.GetDefaultMirrorMaterial() : null; - + var material = HDRenderPipelineGlobalSettings.instance?.GetDefaultMirrorMaterial(); if (material) { plane.GetComponent().sharedMaterial = material; diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DiffusionProfileMaterialUI.cs b/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DiffusionProfileMaterialUI.cs index bf56b3fa28a..2decade7f27 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DiffusionProfileMaterialUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/DiffusionProfile/DiffusionProfileMaterialUI.cs @@ -56,7 +56,7 @@ public static void OnGUI(MaterialEditor materialEditor, MaterialProperty diffusi static void DrawDiffusionProfileWarning(DiffusionProfileSettings materialProfile) { - if (materialProfile != null && !HDRenderPipeline.defaultAsset.diffusionProfileSettingsList.Any(d => d == materialProfile)) + if (materialProfile != null && !HDRenderPipelineGlobalSettings.instance.diffusionProfileSettingsList.Any(d => d == materialProfile)) { using (new EditorGUILayout.HorizontalScope(EditorStyles.helpBox)) { @@ -65,7 +65,7 @@ static void DrawDiffusionProfileWarning(DiffusionProfileSettings materialProfile EditorGUILayout.LabelField(diffusionProfileNotInHDRPAsset, wordWrap); if (GUILayout.Button("Fix", GUILayout.ExpandHeight(true))) { - HDRenderPipeline.defaultAsset.AddDiffusionProfile(materialProfile); + HDRenderPipelineGlobalSettings.instance.AddDiffusionProfile(materialProfile); } } } diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Skin.cs index 02f45013d75..f910cc97218 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Skin.cs @@ -26,7 +26,7 @@ class Styles public static readonly GUIContent TAAQualityLevel = EditorGUIUtility.TrTextContent("Quality Preset", "Low quality is fast, but can lead to more ghosting and blurrier output when moving, Medium quality has better ghosting handling and sharper results upon movement, High allows for velocity rejection policy, has better antialiasing and has mechanism to combat ringing for over sharpening the history."); public static readonly GUIContent TAAAntiRinging = EditorGUIUtility.TrTextContent("Anti-ringing", "When enabled, ringing artifacts (dark or strangely saturated edges) caused by history sharpening will be improved. This comes at a potential loss of sharpness upon motion."); - public static readonly GUIContent renderingPath = EditorGUIUtility.TrTextContent("Custom Frame Settings", "Define the custom Frame Settings for this Camera to use."); + public static readonly GUIContent renderingPath = EditorGUIUtility.TrTextContent("Custom Frame Settings", "Define custom values for Frame Settings for this Camera to use."); public static readonly GUIContent fullScreenPassthrough = EditorGUIUtility.TrTextContent("Fullscreen Passthrough", "This will skip rendering settings to directly rendering in fullscreen(for instance: Useful for video)"); public static readonly GUIContent exposureTarget = EditorGUIUtility.TrTextContent("Exposure Target", "The object used as a target for centering the Exposure's Procedural Mask metering mode when target object option is set (See Exposure Volume Component)."); } diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs index 4cba81bc54d..182240c577c 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineUI.Skin.cs @@ -9,14 +9,6 @@ static partial class HDRenderPipelineUI { public class Styles { - public class GeneralSection - { - public static readonly GUIContent renderPipelineResourcesContent = EditorGUIUtility.TrTextContent("Render Pipeline Resources", "Set of resources that need to be loaded when creating stand alone"); - public static readonly GUIContent renderPipelineRayTracingResourcesContent = EditorGUIUtility.TrTextContent("Render Pipeline Ray Tracing Resources", "Set of resources that need to be loaded when using ray tracing"); - public static readonly GUIContent renderPipelineEditorResourcesContent = EditorGUIUtility.TrTextContent("Render Pipeline Editor Resources", "Set of resources that need to be loaded for working in editor"); - } - - public static readonly GUIContent generalSectionTitle = EditorGUIUtility.TrTextContent("General"); public static readonly GUIContent renderingSectionTitle = EditorGUIUtility.TrTextContent("Rendering"); public static readonly GUIContent lightingSectionTitle = EditorGUIUtility.TrTextContent("Lighting"); public static readonly GUIContent materialSectionTitle = EditorGUIUtility.TrTextContent("Material"); @@ -27,7 +19,6 @@ public class GeneralSection public static readonly GUIContent postProcessQualitySubTitle = EditorGUIUtility.TrTextContent("Post-processing Quality Settings"); public static readonly GUIContent lightingQualitySettings = EditorGUIUtility.TrTextContent("Lighting Quality Settings"); - public static readonly GUIContent lightLayerSubTitle = EditorGUIUtility.TrTextContent("Light Layers"); public static readonly GUIContent volumetricSubTitle = EditorGUIUtility.TrTextContent("Volumetrics"); public static readonly GUIContent volumetricCloudsSubTitle = EditorGUIUtility.TrTextContent("Volumetric Clouds"); public static readonly GUIContent probeVolumeSubTitle = EditorGUIUtility.TrTextContent("Probe Volume"); @@ -118,11 +109,7 @@ public class GeneralSection public static readonly GUIContent FogSettingsBudget = EditorGUIUtility.TrTextContent("Volumetric Fog Budget"); public static readonly GUIContent FogSettingsRatio = EditorGUIUtility.TrTextContent("Volumetric Fog Ratio"); - public static readonly GUIContent defaultFrameSettingsContent = EditorGUIUtility.TrTextContent("Default Frame Settings For"); - public static readonly GUIContent materialQualityLevelContent = EditorGUIUtility.TrTextContent("Default Material Quality Level", ""); - public static readonly GUIContent diffusionProfileSettingsContent = EditorGUIUtility.TrTextContent("Diffusion Profile List"); - public static readonly GUIContent SRPBatcher = EditorGUIUtility.TrTextContent("SRP Batcher", "When enabled, the render pipeline uses the SRP batcher."); public static readonly GUIContent supportShadowMaskContent = EditorGUIUtility.TrTextContent("Shadowmask", "When enabled, HDRP allocates Shader variants and memory for processing shadow masks. This allows you to use shadow masks in your Unity Project."); public static readonly GUIContent supportSSRContent = EditorGUIUtility.TrTextContent("Screen Space Reflection", "When enabled, HDRP allocates memory for processing screen space reflection (SSR). This allows you to use SSR in your Unity Project."); @@ -136,14 +123,6 @@ public class GeneralSection public static readonly GUIContent supportVolumetricCloudsContent = EditorGUIUtility.TrTextContent("Volumetric Clouds", "When enabled, HDRP allocates memory for processing volumetric clouds. This allows you to use volumetric clouds in your Unity Project."); public static readonly GUIContent volumetricResolutionContent = EditorGUIUtility.TrTextContent("High Quality ", "When enabled, HDRP increases the resolution of volumetric lighting buffers. Warning: There is a high performance cost, do not enable on consoles."); public static readonly GUIContent supportLightLayerContent = EditorGUIUtility.TrTextContent("Light Layers", "When enabled, HDRP allocates memory for processing Light Layers. This allows you to use Light Layers in your Unity Project. For deferred rendering, this allocation includes an extra render target in memory and extra cost."); - public static readonly GUIContent lightLayerName0 = EditorGUIUtility.TrTextContent("Light Layer Name 0", "The display name for Light Layer 0. This is purely cosmetic, and can be used to articulate intended use of Light Layer 0"); - public static readonly GUIContent lightLayerName1 = EditorGUIUtility.TrTextContent("Light Layer Name 1", "The display name for Light Layer 1. This is purely cosmetic, and can be used to articulate intended use of Light Layer 1"); - public static readonly GUIContent lightLayerName2 = EditorGUIUtility.TrTextContent("Light Layer Name 2", "The display name for Light Layer 2. This is purely cosmetic, and can be used to articulate intended use of Light Layer 2"); - public static readonly GUIContent lightLayerName3 = EditorGUIUtility.TrTextContent("Light Layer Name 3", "The display name for Light Layer 3. This is purely cosmetic, and can be used to articulate intended use of Light Layer 3"); - public static readonly GUIContent lightLayerName4 = EditorGUIUtility.TrTextContent("Light Layer Name 4", "The display name for Light Layer 4. This is purely cosmetic, and can be used to articulate intended use of Light Layer 4"); - public static readonly GUIContent lightLayerName5 = EditorGUIUtility.TrTextContent("Light Layer Name 5", "The display name for Light Layer 5. This is purely cosmetic, and can be used to articulate intended use of Light Layer 5"); - public static readonly GUIContent lightLayerName6 = EditorGUIUtility.TrTextContent("Light Layer Name 6", "The display name for Light Layer 6. This is purely cosmetic, and can be used to articulate intended use of Light Layer 6"); - public static readonly GUIContent lightLayerName7 = EditorGUIUtility.TrTextContent("Light Layer Name 7", "The display name for Light Layer 7. This is purely cosmetic, and can be used to articulate intended use of Light Layer 7"); public static readonly GUIContent colorBufferFormatContent = EditorGUIUtility.TrTextContent("Color Buffer Format", "Specifies the format used by the scene color render target. R11G11B10 is a faster option and should have sufficient precision."); public static readonly GUIContent supportCustomPassContent = EditorGUIUtility.TrTextContent("Custom Pass", "When enabled, HDRP allocates a custom pass buffer. It also enable custom passes inside Custom Pass Volume components."); public static readonly GUIContent customBufferFormatContent = EditorGUIUtility.TrTextContent("Custom Buffer Format", "Specifies the format used by the custom pass render target."); @@ -174,12 +153,9 @@ public class GeneralSection public static readonly GUIContent maxLocalVolumetricFogOnScreenStyle = EditorGUIUtility.TrTextContent("Max Local Fog On Screen", "Sets the maximum number of Local Volumetric Fog can handle on screen at once. This settings will affect your memory consumption."); public const string probeVolumeNotEnabled = "Warning: Probe Volumes are not enabled.\nIt is an highly experimental feature and disabled by default for this reason.\nIt's functionality is subject to breaking changes and whole sale removal.\nIt is not recommended for use outside of for providing feedback.\nIt should not be used in production.\nTo enable, set:\nEnableProbeVolumes = 1\ninside of ShaderConfig.cs\and inside of the editor run:\nEdit > Rendering > Generate Shader Includes\nProbe Volumes feature must also be enabled here."; - public const string cacheErrorFormat = "This configuration will lead to more than 2 GB reserved for this cache at runtime! ({0} requested) Only {1} element will be reserved instead."; public const string cacheInfoFormat = "Reserving {0} in memory at runtime."; public const string multipleDifferenteValueMessage = "Multiple different values"; - public const string decalLayerNamesText = "Decal Layer names"; - public const string lightLayerNamesText = "Light Layer names"; public static readonly GUIContent cookieSizeContent = EditorGUIUtility.TrTextContent("Cookie Size", "Specifies the maximum size for the individual 2D cookies that HDRP uses for Directional and Spot Lights."); public static readonly GUIContent cookieTextureArraySizeContent = EditorGUIUtility.TrTextContent("Texture Array Size", "Sets the maximum Texture Array size for the 2D cookies HDRP uses for Directional and Spot Lights. Higher values allow HDRP to use more cookies concurrently on screen."); diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/DefaultSettingsPanel.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/DefaultSettingsPanel.cs index 6c2365564a8..3bdba4ff2db 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/DefaultSettingsPanel.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/DefaultSettingsPanel.cs @@ -39,7 +39,7 @@ public class Styles internal static readonly GUIContent defaultVolumeProfileLabel = EditorGUIUtility.TrTextContent("Default Volume Profile Asset"); internal static readonly GUIContent lookDevVolumeProfileLabel = EditorGUIUtility.TrTextContent("LookDev Volume Profile Asset"); - internal static readonly GUIContent frameSettingsLabel = EditorGUIUtility.TrTextContent("Frame Settings"); + internal static readonly GUIContent frameSettingsLabel = EditorGUIUtility.TrTextContent("Frame Settings (Default Values)"); internal static readonly GUIContent frameSettingsLabel_Camera = EditorGUIUtility.TrTextContent("Camera"); internal static readonly GUIContent frameSettingsLabel_RTProbe = EditorGUIUtility.TrTextContent("Realtime Reflection"); internal static readonly GUIContent frameSettingsLabel_BakedProbe = EditorGUIUtility.TrTextContent("Baked or Custom Reflection"); @@ -84,6 +84,9 @@ public class Styles 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."; + internal static readonly string warningGlobalSettingsMissing = "No active settings for HDRP. Rendering may be broken until a new one is assigned."; + internal static readonly string infoGlobalSettingsMissing = "No active Global Settings for HDRP. You may assign one below."; } public static readonly CED.IDrawer Inspector; @@ -111,30 +114,35 @@ static DefaultSettingsPanelIMGUI() HDRenderPipelineGlobalSettings settingsSerialized; public void DoGUI(string searchContext) { - if (HDRenderPipeline.currentPipeline == null) + // When the asset being serialized has been deleted before its reconstruction + if (serializedSettings != null && serializedSettings.serializedObject.targetObject == null) { - EditorGUILayout.HelpBox("No HDRP pipeline currently active (see Quality Settings active level).", MessageType.Warning); + serializedSettings = null; + settingsSerialized = null; } - if ((serializedSettings == null) || (settingsSerialized != HDRenderPipelineGlobalSettings.instance)) + if (serializedSettings == null || settingsSerialized != HDRenderPipelineGlobalSettings.instance) { - settingsSerialized = HDRenderPipelineGlobalSettings.Ensure(); - var serializedObject = new SerializedObject(settingsSerialized); - serializedSettings = new SerializedHDRenderPipelineGlobalSettings(serializedObject); + if (HDRenderPipeline.currentAsset != null || HDRenderPipelineGlobalSettings.instance != null) + { + settingsSerialized = HDRenderPipelineGlobalSettings.Ensure(); + var serializedObject = new SerializedObject(settingsSerialized); + serializedSettings = new SerializedHDRenderPipelineGlobalSettings(serializedObject); + } } - else + else if (settingsSerialized != null && serializedSettings != null) { serializedSettings.serializedObject.Update(); } - Draw_AssetSelection(ref serializedSettings, null); + DrawWarnings(ref serializedSettings, null); + DrawAssetSelection(ref serializedSettings, null); if (settingsSerialized != null && serializedSettings != null) { EditorGUILayout.Space(); Inspector.Draw(serializedSettings, null); + serializedSettings.serializedObject?.ApplyModifiedProperties(); } - - serializedSettings.serializedObject.ApplyModifiedProperties(); } /// @@ -146,16 +154,29 @@ public void OnActivate(string searchContext, VisualElement rootElement) { } - #region Global HDRenderPipelineGlobalSettings asset selection - void Draw_AssetSelection(ref SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) + void DrawWarnings(ref SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { - var oldWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = Styles.labelWidth; + bool isHDRPinUse = HDRenderPipeline.currentAsset != null; + if (isHDRPinUse && serialized != null) + return; - if (settingsSerialized == null) + if (isHDRPinUse) { - EditorGUILayout.HelpBox("No active settings for HDRP. Rendering may be broken until a new one is assigned.", MessageType.Warning); + EditorGUILayout.HelpBox(Styles.warningGlobalSettingsMissing, MessageType.Warning); } + else + { + EditorGUILayout.HelpBox(Styles.warningHdrpNotActive, MessageType.Warning); + if (serialized == null) + EditorGUILayout.HelpBox(Styles.infoGlobalSettingsMissing, MessageType.Info); + } + } + + #region Global HDRenderPipelineGlobalSettings asset selection + void DrawAssetSelection(ref SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) + { + var oldWidth = EditorGUIUtility.labelWidth; + EditorGUIUtility.labelWidth = Styles.labelWidth; using (new EditorGUILayout.HorizontalScope()) { EditorGUI.BeginChangeCheck(); @@ -163,13 +184,15 @@ void Draw_AssetSelection(ref SerializedHDRenderPipelineGlobalSettings serialized if (EditorGUI.EndChangeCheck()) { HDRenderPipelineGlobalSettings.UpdateGraphicsSettings(newAsset); - EditorUtility.SetDirty(settingsSerialized); + if (settingsSerialized != null && !settingsSerialized.Equals(null)) + EditorUtility.SetDirty(settingsSerialized); } if (GUILayout.Button(EditorGUIUtility.TrTextContent("New", "Create a HD Global Settings Asset in your default resource folder (defined in Wizard)"), GUILayout.Width(45), GUILayout.Height(18))) { HDAssetFactory.HDRenderPipelineGlobalSettingsCreator.Create(useProjectSettingsFolder: true, activateAsset: true); } + bool guiEnabled = GUI.enabled; GUI.enabled = guiEnabled && (settingsSerialized != null); if (GUILayout.Button(EditorGUIUtility.TrTextContent("Clone", "Clone a HD Global Settings Asset in your default resource folder (defined in Wizard)"), GUILayout.Width(45), GUILayout.Height(18))) @@ -189,10 +212,10 @@ void Draw_AssetSelection(ref SerializedHDRenderPipelineGlobalSettings serialized static readonly CED.IDrawer ResourcesSection = CED.Group( CED.Group((serialized, owner) => EditorGUILayout.LabelField(Styles.resourceLabel, Styles.sectionHeaderStyle)), CED.Group((serialized, owner) => EditorGUILayout.Space()), - CED.Group(Drawer_ResourcesSection), + CED.Group(DrawResourcesSection), CED.Group((serialized, owner) => EditorGUILayout.Space()) ); - static void Drawer_ResourcesSection(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) + static void DrawResourcesSection(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { using (new EditorGUI.IndentLevelScope()) { @@ -221,11 +244,11 @@ static void Drawer_ResourcesSection(SerializedHDRenderPipelineGlobalSettings ser #region Frame Settings static readonly CED.IDrawer FrameSettingsSection = CED.Group( - CED.Group(Drawer_FrameSettings), + CED.Group(DrawFrameSettings), CED.Group((serialized, owner) => EditorGUILayout.Space()) ); - static void Drawer_FrameSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) + static void DrawFrameSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { EditorGUILayout.LabelField(Styles.frameSettingsLabel, Styles.sectionHeaderStyle); EditorGUILayout.Space(); @@ -233,15 +256,15 @@ static void Drawer_FrameSettings(SerializedHDRenderPipelineGlobalSettings serial using (new EditorGUI.IndentLevelScope()) { EditorGUILayout.LabelField(Styles.frameSettingsLabel_Camera, Styles.subSectionHeaderStyle); - Drawer_FrameSettings_Custom(0, serialized.defaultFrameSettings, owner); + DrawFrameSettingsSubsection(0, serialized.defaultCameraFrameSettings, owner); EditorGUILayout.Space(); EditorGUILayout.LabelField(Styles.frameSettingsLabel_RTProbe, Styles.subSectionHeaderStyle); - Drawer_FrameSettings_Custom(1, serialized.defaultRealtimeReflectionFrameSettings, owner); + DrawFrameSettingsSubsection(1, serialized.defaultRealtimeReflectionFrameSettings, owner); EditorGUILayout.Space(); EditorGUILayout.LabelField(Styles.frameSettingsLabel_BakedProbe, Styles.subSectionHeaderStyle); - Drawer_FrameSettings_Custom(2, serialized.defaultBakedOrCustomReflectionFrameSettings, owner); + DrawFrameSettingsSubsection(2, serialized.defaultBakedOrCustomReflectionFrameSettings, owner); EditorGUILayout.Space(); } } @@ -251,7 +274,7 @@ static void Drawer_FrameSettings(SerializedHDRenderPipelineGlobalSettings serial static private bool[] m_ShowFrameSettings_AsyncCompute = { false, false, false }; static private bool[] m_ShowFrameSettings_LightLoopDebug = { false, false, false }; - static void Drawer_FrameSettings_Custom(int index, SerializedFrameSettings serialized, Editor owner) + static void DrawFrameSettingsSubsection(int index, SerializedFrameSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; @@ -306,9 +329,9 @@ static void Drawer_FrameSettings_Custom(int index, SerializedFrameSettings seria static readonly CED.IDrawer CustomPostProcessesSection = CED.Group( CED.Group((serialized, owner) => EditorGUILayout.LabelField(Styles.customPostProcessOrderLabel, Styles.sectionHeaderStyle)), CED.Group((serialized, owner) => EditorGUILayout.Space()), - CED.Group(Drawer_CustomPostProcess) + CED.Group(DrawCustomPostProcess) ); - static void Drawer_CustomPostProcess(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) + static void DrawCustomPostProcess(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { using (new EditorGUILayout.HorizontalScope()) { @@ -342,9 +365,9 @@ static void Drawer_CustomPostProcess(SerializedHDRenderPipelineGlobalSettings se static readonly CED.IDrawer DiffusionProfileSettingsSection = CED.Group( CED.Group((serialized, owner) => EditorGUILayout.LabelField(Styles.diffusionProfileSettingsLabel, Styles.sectionHeaderStyle)), CED.Group((serialized, owner) => EditorGUILayout.Space()), - CED.Group(Drawer_DiffusionProfileSettings) + CED.Group(DrawDiffusionProfileSettings) ); - static void Drawer_DiffusionProfileSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) + static void DrawDiffusionProfileSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { using (new EditorGUILayout.HorizontalScope()) { @@ -363,11 +386,11 @@ static void Drawer_DiffusionProfileSettings(SerializedHDRenderPipelineGlobalSett static readonly CED.IDrawer VolumeSection = CED.Group( CED.Group((serialized, owner) => EditorGUILayout.LabelField(Styles.volumeComponentsLabel, Styles.sectionHeaderStyle)), CED.Group((serialized, owner) => EditorGUILayout.Space()), - CED.Group(Drawer_VolumeSection), + CED.Group(DrawVolumeSection), CED.Group((serialized, owner) => EditorGUILayout.Space()) ); - static void Drawer_VolumeSection(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) + static void DrawVolumeSection(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { using (new EditorGUI.IndentLevelScope()) { @@ -378,13 +401,13 @@ static void Drawer_VolumeSection(SerializedHDRenderPipelineGlobalSettings serial VolumeProfile asset = null; using (new EditorGUILayout.HorizontalScope()) { - var oldAssetValue = serialized.volumeProfileDefault.objectReferenceValue; - EditorGUILayout.PropertyField(serialized.volumeProfileDefault, Styles.defaultVolumeProfileLabel); - asset = serialized.volumeProfileDefault.objectReferenceValue as VolumeProfile; + var oldAssetValue = serialized.defaultVolumeProfile.objectReferenceValue; + EditorGUILayout.PropertyField(serialized.defaultVolumeProfile, Styles.defaultVolumeProfileLabel); + asset = serialized.defaultVolumeProfile.objectReferenceValue as VolumeProfile; if (asset == null && oldAssetValue != null) { Debug.Log("Default Volume Profile Asset cannot be null. Rolling back to previous value."); - serialized.volumeProfileDefault.objectReferenceValue = oldAssetValue; + serialized.defaultVolumeProfile.objectReferenceValue = oldAssetValue; } if (GUILayout.Button(EditorGUIUtility.TrTextContent("New", "Create a new Volume Profile for default in your default resource folder (defined in Wizard)"), GUILayout.Width(38), GUILayout.Height(18))) @@ -413,13 +436,13 @@ static void Drawer_VolumeSection(SerializedHDRenderPipelineGlobalSettings serial VolumeProfile lookDevAsset = null; using (new EditorGUILayout.HorizontalScope()) { - var oldAssetValue = serialized.volumeProfileLookDev.objectReferenceValue; - EditorGUILayout.PropertyField(serialized.volumeProfileLookDev, Styles.lookDevVolumeProfileLabel); - lookDevAsset = serialized.volumeProfileLookDev.objectReferenceValue as VolumeProfile; + var oldAssetValue = serialized.lookDevVolumeProfile.objectReferenceValue; + EditorGUILayout.PropertyField(serialized.lookDevVolumeProfile, Styles.lookDevVolumeProfileLabel); + lookDevAsset = serialized.lookDevVolumeProfile.objectReferenceValue as VolumeProfile; if (lookDevAsset == null && oldAssetValue != null) { Debug.Log("LookDev Volume Profile Asset cannot be null. Rolling back to previous value."); - serialized.volumeProfileLookDev.objectReferenceValue = oldAssetValue; + serialized.lookDevVolumeProfile.objectReferenceValue = oldAssetValue; } if (GUILayout.Button(EditorGUIUtility.TrTextContent("New", "Create a new Volume Profile for default in your default resource folder (defined in Wizard)"), GUILayout.Width(38), GUILayout.Height(18))) @@ -451,10 +474,10 @@ static void Drawer_VolumeSection(SerializedHDRenderPipelineGlobalSettings serial static readonly CED.IDrawer MiscSection = CED.Group( CED.Group((serialized, owner) => EditorGUILayout.LabelField(Styles.generalSettingsLabel, Styles.sectionHeaderStyle)), CED.Group((serialized, owner) => EditorGUILayout.Space()), - CED.Group(Drawer_MiscSettings), + CED.Group(DrawMiscSettings), CED.Group((serialized, owner) => EditorGUILayout.Space()) ); - static void Drawer_MiscSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) + static void DrawMiscSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; @@ -474,20 +497,20 @@ static void Drawer_MiscSettings(SerializedHDRenderPipelineGlobalSettings seriali static readonly CED.IDrawer LayerNamesSection = CED.Group( CED.Group((serialized, owner) => EditorGUILayout.LabelField(Styles.layerNamesLabel, Styles.sectionHeaderStyle)), CED.Group((serialized, owner) => EditorGUILayout.Space()), - CED.Group(Drawer_LayerNamesSettings), + CED.Group(DrawLayerNamesSettings), CED.Group((serialized, owner) => EditorGUILayout.Space()) ); - static void Drawer_LayerNamesSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) + static void DrawLayerNamesSettings(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { var oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = Styles.labelWidth; using (new EditorGUI.IndentLevelScope()) { - Drawer_LightLayerNames(serialized, owner); + DrawLightLayerNames(serialized, owner); EditorGUILayout.Space(); - Drawer_DecalLayerNames(serialized, owner); + DrawDecalLayerNames(serialized, owner); EditorGUILayout.Space(); } EditorGUIUtility.labelWidth = oldWidth; @@ -495,7 +518,7 @@ static void Drawer_LayerNamesSettings(SerializedHDRenderPipelineGlobalSettings s static private bool m_ShowLightLayerNames = false; static private bool m_ShowDecalLayerNames = false; - static void Drawer_LightLayerNames(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) + static void DrawLightLayerNames(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { m_ShowLightLayerNames = EditorGUILayout.Foldout(m_ShowLightLayerNames, Styles.lightLayersLabel, true); if (m_ShowLightLayerNames) @@ -521,7 +544,7 @@ static void Drawer_LightLayerNames(SerializedHDRenderPipelineGlobalSettings seri } } - static void Drawer_DecalLayerNames(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) + static void DrawDecalLayerNames(SerializedHDRenderPipelineGlobalSettings serialized, Editor owner) { m_ShowDecalLayerNames = EditorGUILayout.Foldout(m_ShowDecalLayerNames, Styles.decalLayersLabel, true); if (m_ShowDecalLayerNames) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Drawers.cs index ae548125444..2ce8902c4c0 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Drawers.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Drawers.cs @@ -129,6 +129,11 @@ static HDRenderPipelineAsset GetHDRPAssetFor(Editor owner) // When drawing the inspector of a selected HDRPAsset in Project windows, access HDRP by owner drawing itself hdrpAsset = (owner as HDRenderPipelineEditor).target as HDRenderPipelineAsset; } + else if (owner is HDRenderPipelineGlobalSettingsEditor || owner == null) + { + // When drawing the inspector of a selected HDRPAsset in Project windows, access HDRP by owner drawing itself + hdrpAsset = null; + } else { // Else rely on GraphicsSettings are you should be in hdrp and owner could be probe or camera. @@ -137,161 +142,96 @@ static HDRenderPipelineAsset GetHDRPAssetFor(Editor owner) return hdrpAsset; } - static FrameSettings GetDefaultFrameSettingsFor(Editor owner) + static FrameSettings? GetDefaultFrameSettingsFor(Editor owner) { - return owner is IDefaultFrameSettingsType getType - ? HDRenderPipelineGlobalSettings.instance.GetDefaultFrameSettings(getType.GetFrameSettingsType()) - : HDRenderPipelineGlobalSettings.instance.GetDefaultFrameSettings(FrameSettingsRenderType.Camera); + if (owner is IHDProbeEditor) + { + var getType = owner as IDefaultFrameSettingsType; + return HDRenderPipelineGlobalSettings.instance.GetDefaultFrameSettings(getType.GetFrameSettingsType()); + } + else if (owner is HDCameraEditor) + { + return HDRenderPipelineGlobalSettings.instance.GetDefaultFrameSettings(FrameSettingsRenderType.Camera); + } + return null; } static internal void Drawer_SectionRenderingSettings(SerializedFrameSettings serialized, Editor owner, bool withOverride) { bool isGUIenabled = GUI.enabled; - FrameSettings defaultFrameSettings = GetDefaultFrameSettingsFor(owner); - var frameSettingType = owner is IDefaultFrameSettingsType getType ? getType.GetFrameSettingsType() : FrameSettingsRenderType.Camera; - var area = OverridableFrameSettingsArea.GetGroupContent(0, defaultFrameSettings, serialized); - var hdrpAsset = GetHDRPAssetFor(owner); - if (hdrpAsset != null) - { - RenderPipelineSettings hdrpSettings = hdrpAsset.currentPlatformRenderPipelineSettings; - LitShaderMode defaultShaderLitMode; - switch (hdrpSettings.supportedLitShaderMode) - { - case RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly: - defaultShaderLitMode = LitShaderMode.Forward; - break; - case RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly: - defaultShaderLitMode = LitShaderMode.Deferred; - break; - case RenderPipelineSettings.SupportedLitShaderMode.Both: - defaultShaderLitMode = defaultFrameSettings.litShaderMode; - break; - default: - throw new System.ArgumentOutOfRangeException("Unknown ShaderLitMode"); - } - - area.AmmendInfo(FrameSettingsField.LitShaderMode, - overrideable: () => hdrpSettings.supportedLitShaderMode == RenderPipelineSettings.SupportedLitShaderMode.Both, - overridedDefaultValue: defaultShaderLitMode); - - bool hdrpAssetSupportForward = hdrpSettings.supportedLitShaderMode != RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly; - bool hdrpAssetSupportDeferred = hdrpSettings.supportedLitShaderMode != RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly; - bool hdrpAssetIsForward = hdrpSettings.supportedLitShaderMode == RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly; - bool hdrpAssetIsDeferred = hdrpSettings.supportedLitShaderMode == RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly; - bool frameSettingsOverrideToForward = serialized.GetOverrides(FrameSettingsField.LitShaderMode) && serialized.litShaderMode == LitShaderMode.Forward; - bool frameSettingsOverrideToDeferred = serialized.GetOverrides(FrameSettingsField.LitShaderMode) && serialized.litShaderMode == LitShaderMode.Deferred; - bool defaultForwardUsed = !serialized.GetOverrides(FrameSettingsField.LitShaderMode) && defaultShaderLitMode == LitShaderMode.Forward; - bool defaultDeferredUsed = !serialized.GetOverrides(FrameSettingsField.LitShaderMode) && defaultShaderLitMode == LitShaderMode.Deferred; - - // Due to various reasons, MSAA and ray tracing are not compatible, if ray tracing is enabled on the asset. MSAA can not be enabled on the frame settings. - bool msaaEnablable = hdrpSettings.supportMSAA && ((hdrpAssetSupportForward && (frameSettingsOverrideToForward || defaultForwardUsed)) || hdrpAssetIsForward) && !hdrpSettings.supportRayTracing; - area.AmmendInfo(FrameSettingsField.MSAA, - overrideable: () => msaaEnablable, - ignoreDependencies: true, - overridedDefaultValue: msaaEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.MSAA)); - - bool msaaIsOff = (msaaEnablable && serialized.GetOverrides(FrameSettingsField.MSAA)) ? !(serialized.IsEnabled(FrameSettingsField.MSAA) ?? false) : !defaultFrameSettings.IsEnabled(FrameSettingsField.MSAA); - area.AmmendInfo(FrameSettingsField.AlphaToMask, - overrideable: () => msaaEnablable && !msaaIsOff, - ignoreDependencies: true, - overridedDefaultValue: msaaEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.AlphaToMask) && !msaaIsOff); - - bool depthPrepassEnablable = (hdrpAssetSupportDeferred && (defaultDeferredUsed || frameSettingsOverrideToDeferred)) || (hdrpAssetIsDeferred); - area.AmmendInfo(FrameSettingsField.DepthPrepassWithDeferredRendering, - overrideable: () => depthPrepassEnablable, - ignoreDependencies: true, - overridedDefaultValue: depthPrepassEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.DepthPrepassWithDeferredRendering)); - - bool clearGBufferEnablable = (hdrpAssetSupportDeferred && (defaultDeferredUsed || frameSettingsOverrideToDeferred)) || (hdrpAssetIsDeferred); - area.AmmendInfo(FrameSettingsField.ClearGBuffers, - overrideable: () => clearGBufferEnablable, - ignoreDependencies: true, - overridedDefaultValue: clearGBufferEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.ClearGBuffers)); - - area.AmmendInfo(FrameSettingsField.RayTracing, overrideable: () => hdrpSettings.supportRayTracing); -#if !ENABLE_VIRTUALTEXTURES - area.AmmendInfo(FrameSettingsField.VirtualTexturing, overrideable: () => false); -#endif - - area.AmmendInfo(FrameSettingsField.RayTracing, overrideable: () => hdrpSettings.supportRayTracing); -#if !ENABLE_VIRTUALTEXTURES - area.AmmendInfo(FrameSettingsField.VirtualTexturing, overrideable: () => false); -#endif - area.AmmendInfo(FrameSettingsField.MotionVectors, overrideable: () => hdrpSettings.supportMotionVectors); - area.AmmendInfo(FrameSettingsField.ObjectMotionVectors, overrideable: () => hdrpSettings.supportMotionVectors); - area.AmmendInfo(FrameSettingsField.TransparentsWriteMotionVector, overrideable: () => hdrpSettings.supportMotionVectors); - area.AmmendInfo(FrameSettingsField.Decals, overrideable: () => hdrpSettings.supportDecals); - area.AmmendInfo(FrameSettingsField.DecalLayers, overrideable: () => hdrpSettings.supportDecalLayers); - area.AmmendInfo(FrameSettingsField.Distortion, overrideable: () => hdrpSettings.supportDistortion); - area.AmmendInfo(FrameSettingsField.RoughDistortion, overrideable: () => hdrpSettings.supportDistortion); - - area.AmmendInfo(FrameSettingsField.Postprocess, overrideable: () => (frameSettingType != FrameSettingsRenderType.CustomOrBakedReflection && - frameSettingType != FrameSettingsRenderType.RealtimeReflection)); - - area.AmmendInfo( - FrameSettingsField.LODBiasMode, - overridedDefaultValue: LODBiasMode.FromQualitySettings, - customGetter: () => serialized.lodBiasMode.GetEnumValue(), - customSetter: v => serialized.lodBiasMode.SetEnumValue((LODBiasMode)v), - hasMixedValues: serialized.lodBiasMode.hasMultipleDifferentValues - ); - area.AmmendInfo(FrameSettingsField.LODBiasQualityLevel, - overridedDefaultValue: ScalableLevel3ForFrameSettingsUIOnly.Low, - customGetter: () => (ScalableLevel3ForFrameSettingsUIOnly)serialized.lodBiasQualityLevel.intValue, - customSetter: v => serialized.lodBiasQualityLevel.intValue = (int)v, - overrideable: () => serialized.lodBiasMode.GetEnumValue() != LODBiasMode.OverrideQualitySettings, - ignoreDependencies: true, - hasMixedValues: serialized.lodBiasQualityLevel.hasMultipleDifferentValues); - - if (hdrpAsset != null) - { - area.AmmendInfo(FrameSettingsField.LODBias, - overridedDefaultValue: hdrpAsset.currentPlatformRenderPipelineSettings.lodBias[serialized.lodBiasQualityLevel.intValue], - customGetter: () => serialized.lodBias.floatValue, - customSetter: v => serialized.lodBias.floatValue = (float)v, - overrideable: () => serialized.lodBiasMode.GetEnumValue() != LODBiasMode.FromQualitySettings, - ignoreDependencies: true, - labelOverride: serialized.lodBiasMode.GetEnumValue() == LODBiasMode.ScaleQualitySettings ? "Scale Factor" : "LOD Bias", - hasMixedValues: serialized.lodBias.hasMultipleDifferentValues); - } + FrameSettings? defaultFrameSettings = GetDefaultFrameSettingsFor(owner); + var area = OverridableFrameSettingsArea.GetGroupContent(0, defaultFrameSettings, serialized); - area.AmmendInfo( - FrameSettingsField.MaximumLODLevelMode, - overridedDefaultValue: MaximumLODLevelMode.FromQualitySettings, - customGetter: () => serialized.maximumLODLevelMode.GetEnumValue(), - customSetter: v => serialized.maximumLODLevelMode.SetEnumValue((MaximumLODLevelMode)v), - hasMixedValues: serialized.maximumLODLevelMode.hasMultipleDifferentValues - ); - area.AmmendInfo(FrameSettingsField.MaximumLODLevelQualityLevel, - overridedDefaultValue: ScalableLevel3ForFrameSettingsUIOnly.Low, - customGetter: () => (ScalableLevel3ForFrameSettingsUIOnly)serialized.maximumLODLevelQualityLevel.intValue, - customSetter: v => serialized.maximumLODLevelQualityLevel.intValue = (int)v, - overrideable: () => serialized.maximumLODLevelMode.GetEnumValue() != MaximumLODLevelMode.OverrideQualitySettings, - ignoreDependencies: true, - hasMixedValues: serialized.maximumLODLevelQualityLevel.hasMultipleDifferentValues); + area.AmmendInfo(FrameSettingsField.DepthPrepassWithDeferredRendering, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.ClearGBuffers, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.MSAA, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.AlphaToMask, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.DecalLayers, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.ObjectMotionVectors, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.TransparentsWriteMotionVector, ignoreDependencies: true); - if (hdrpAsset != null) - { - area.AmmendInfo(FrameSettingsField.MaximumLODLevel, - overridedDefaultValue: hdrpAsset.currentPlatformRenderPipelineSettings.maximumLODLevel[serialized.maximumLODLevelQualityLevel.intValue], - customGetter: () => serialized.maximumLODLevel.intValue, - customSetter: v => serialized.maximumLODLevel.intValue = (int)v, - overrideable: () => serialized.maximumLODLevelMode.GetEnumValue() != MaximumLODLevelMode.FromQualitySettings, - ignoreDependencies: true, - labelOverride: serialized.maximumLODLevelMode.GetEnumValue() == MaximumLODLevelMode.OffsetQualitySettings ? "Offset Factor" : "Maximum LOD Level", - hasMixedValues: serialized.maximumLODLevel.hasMultipleDifferentValues); - } + var isEditingCamera = owner is HDCameraEditor; + area.AmmendInfo(FrameSettingsField.Postprocess, overrideable: () => isEditingCamera); - area.AmmendInfo(FrameSettingsField.MaterialQualityLevel, - overridedDefaultValue: defaultFrameSettings.materialQuality.Into(), - customGetter: () => ((MaterialQuality)serialized.materialQuality.intValue).Into(), - customSetter: v => serialized.materialQuality.intValue = (int)((MaterialQualityMode)v).Into(), - hasMixedValues: serialized.materialQuality.hasMultipleDifferentValues - ); + var hdrpAsset = GetHDRPAssetFor(owner); + RenderPipelineSettings qualityLevelSettings = hdrpAsset?.currentPlatformRenderPipelineSettings ?? default; + area.AmmendInfo( + FrameSettingsField.LODBiasMode, + overridedDefaultValue: LODBiasMode.FromQualitySettings, + customGetter: () => serialized.lodBiasMode.GetEnumValue(), + customSetter: v => serialized.lodBiasMode.SetEnumValue((LODBiasMode)v), + hasMixedValues: serialized.lodBiasMode.hasMultipleDifferentValues + ); + area.AmmendInfo(FrameSettingsField.LODBiasQualityLevel, + overridedDefaultValue: ScalableLevel3ForFrameSettingsUIOnly.Low, + customGetter: () => (ScalableLevel3ForFrameSettingsUIOnly)serialized.lodBiasQualityLevel.intValue, + customSetter: v => serialized.lodBiasQualityLevel.intValue = (int)v, + overrideable: () => serialized.lodBiasMode.GetEnumValue() != LODBiasMode.OverrideQualitySettings, + ignoreDependencies: true, + hasMixedValues: serialized.lodBiasQualityLevel.hasMultipleDifferentValues); + + area.AmmendInfo(FrameSettingsField.LODBias, + overridedDefaultValue: hdrpAsset ? qualityLevelSettings.lodBias[serialized.lodBiasQualityLevel.intValue] : 0, + customGetter: () => serialized.lodBias.floatValue, + customSetter: v => serialized.lodBias.floatValue = (float)v, + overrideable: () => serialized.lodBiasMode.GetEnumValue() != LODBiasMode.FromQualitySettings, + ignoreDependencies: true, + labelOverride: serialized.lodBiasMode.GetEnumValue() == LODBiasMode.ScaleQualitySettings ? "Scale Factor" : "LOD Bias", + hasMixedValues: serialized.lodBias.hasMultipleDifferentValues); + + area.AmmendInfo( + FrameSettingsField.MaximumLODLevelMode, + overridedDefaultValue: MaximumLODLevelMode.FromQualitySettings, + customGetter: () => serialized.maximumLODLevelMode.GetEnumValue(), + customSetter: v => serialized.maximumLODLevelMode.SetEnumValue((MaximumLODLevelMode)v), + hasMixedValues: serialized.maximumLODLevelMode.hasMultipleDifferentValues + ); + area.AmmendInfo(FrameSettingsField.MaximumLODLevelQualityLevel, + overridedDefaultValue: ScalableLevel3ForFrameSettingsUIOnly.Low, + customGetter: () => (ScalableLevel3ForFrameSettingsUIOnly)serialized.maximumLODLevelQualityLevel.intValue, + customSetter: v => serialized.maximumLODLevelQualityLevel.intValue = (int)v, + overrideable: () => serialized.maximumLODLevelMode.GetEnumValue() != MaximumLODLevelMode.OverrideQualitySettings, + ignoreDependencies: true, + hasMixedValues: serialized.maximumLODLevelQualityLevel.hasMultipleDifferentValues); + + area.AmmendInfo(FrameSettingsField.MaximumLODLevel, + overridedDefaultValue: hdrpAsset ? qualityLevelSettings.maximumLODLevel[serialized.maximumLODLevelQualityLevel.intValue] : 0, + customGetter: () => serialized.maximumLODLevel.intValue, + customSetter: v => serialized.maximumLODLevel.intValue = (int)v, + overrideable: () => serialized.maximumLODLevelMode.GetEnumValue() != MaximumLODLevelMode.FromQualitySettings, + ignoreDependencies: true, + labelOverride: serialized.maximumLODLevelMode.GetEnumValue() == MaximumLODLevelMode.OffsetQualitySettings ? "Offset Factor" : "Maximum LOD Level", + hasMixedValues: serialized.maximumLODLevel.hasMultipleDifferentValues); + + area.AmmendInfo(FrameSettingsField.MaterialQualityLevel, + overridedDefaultValue: defaultFrameSettings?.materialQuality.Into() ?? MaterialQualityMode.Medium, + customGetter: () => ((MaterialQuality)serialized.materialQuality.intValue).Into(), + customSetter: v => serialized.materialQuality.intValue = (int)((MaterialQualityMode)v).Into(), + hasMixedValues: serialized.materialQuality.hasMultipleDifferentValues + ); - area.Draw(withOverride); - } + area.Draw(withOverride); GUI.enabled = isGUIenabled; } @@ -308,81 +248,75 @@ static internal void Drawer_SectionLightingSettings(SerializedFrameSettings seri { bool isGUIenabled = GUI.enabled; + FrameSettings? defaultFrameSettings = GetDefaultFrameSettingsFor(owner); var hdrpAsset = GetHDRPAssetFor(owner); - if (hdrpAsset != null) - { - RenderPipelineSettings hdrpSettings = hdrpAsset.currentPlatformRenderPipelineSettings; - FrameSettings defaultFrameSettings = GetDefaultFrameSettingsFor(owner); - var area = OverridableFrameSettingsArea.GetGroupContent(1, defaultFrameSettings, serialized); - area.AmmendInfo(FrameSettingsField.Shadowmask, overrideable: () => hdrpSettings.supportShadowMask); - area.AmmendInfo(FrameSettingsField.SSR, overrideable: () => hdrpSettings.supportSSR); - area.AmmendInfo(FrameSettingsField.TransparentSSR, overrideable: () => (hdrpSettings.supportSSR && hdrpSettings.supportSSRTransparent)); - area.AmmendInfo(FrameSettingsField.SSAO, overrideable: () => hdrpSettings.supportSSAO); - area.AmmendInfo(FrameSettingsField.SSGI, overrideable: () => hdrpSettings.supportSSGI); - area.AmmendInfo(FrameSettingsField.VolumetricClouds, overrideable: () => hdrpSettings.supportVolumetricClouds); - - // SSS - area.AmmendInfo( - FrameSettingsField.SubsurfaceScattering, - overridedDefaultValue: hdrpSettings.supportSubsurfaceScattering, - overrideable: () => hdrpSettings.supportSubsurfaceScattering - ); - area.AmmendInfo( - FrameSettingsField.SssQualityMode, - overridedDefaultValue: SssQualityMode.FromQualitySettings, - customGetter: () => serialized.sssQualityMode.GetEnumValue(), - customSetter: v => serialized.sssQualityMode.SetEnumValue((SssQualityMode)v), - overrideable: () => hdrpSettings.supportSubsurfaceScattering - && (serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false), - ignoreDependencies: true, - hasMixedValues: serialized.sssQualityMode.hasMultipleDifferentValues - ); - area.AmmendInfo(FrameSettingsField.SssQualityLevel, - overridedDefaultValue: ScalableLevel3ForFrameSettingsUIOnly.Low, - customGetter: () => (ScalableLevel3ForFrameSettingsUIOnly)serialized.sssQualityLevel.intValue,// 3 levels - customSetter: v => serialized.sssQualityLevel.intValue = Math.Max(0, Math.Min((int)v, 2)),// Levels 0-2 - overrideable: () => hdrpSettings.supportSubsurfaceScattering - && (serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false) - && (serialized.sssQualityMode.GetEnumValue() == SssQualityMode.FromQualitySettings), - ignoreDependencies: true, - hasMixedValues: serialized.sssQualityLevel.hasMultipleDifferentValues - ); - area.AmmendInfo(FrameSettingsField.SssCustomSampleBudget, - overridedDefaultValue: (int)DefaultSssSampleBudgetForQualityLevel.Low, - customGetter: () => serialized.sssCustomSampleBudget.intValue, - customSetter: v => serialized.sssCustomSampleBudget.intValue = Math.Max(1, Math.Min((int)v, (int)DefaultSssSampleBudgetForQualityLevel.Max)), - overrideable: () => hdrpSettings.supportSubsurfaceScattering - && (serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false) - && (serialized.sssQualityMode.GetEnumValue() != SssQualityMode.FromQualitySettings), - ignoreDependencies: true, - hasMixedValues: serialized.sssCustomSampleBudget.hasMultipleDifferentValues - ); - - area.AmmendInfo(FrameSettingsField.Volumetrics, overrideable: () => hdrpSettings.supportVolumetrics); - area.AmmendInfo(FrameSettingsField.ReprojectionForVolumetrics, overrideable: () => hdrpSettings.supportVolumetrics); - area.AmmendInfo(FrameSettingsField.LightLayers, overrideable: () => hdrpSettings.supportLightLayers); - area.AmmendInfo(FrameSettingsField.ProbeVolume, overrideable: () => hdrpSettings.supportProbeVolume); - area.AmmendInfo(FrameSettingsField.ScreenSpaceShadows, overrideable: () => hdrpSettings.hdShadowInitParams.supportScreenSpaceShadows); - area.Draw(withOverride); - } + RenderPipelineSettings qualityLevelSettings = hdrpAsset?.currentPlatformRenderPipelineSettings ?? default; + + var area = OverridableFrameSettingsArea.GetGroupContent(1, defaultFrameSettings, serialized); + + area.AmmendInfo(FrameSettingsField.Volumetrics, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.ReprojectionForVolumetrics, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.TransparentSSR, ignoreDependencies: true); + + area.AmmendInfo( + FrameSettingsField.SssQualityMode, + overridedDefaultValue: SssQualityMode.FromQualitySettings, + customGetter: () => serialized.sssQualityMode.GetEnumValue(), + customSetter: v => serialized.sssQualityMode.SetEnumValue((SssQualityMode)v), + overrideable: () => serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false, + ignoreDependencies: true, + hasMixedValues: serialized.sssQualityMode.hasMultipleDifferentValues + ); + area.AmmendInfo(FrameSettingsField.SssQualityLevel, + overridedDefaultValue: ScalableLevel3ForFrameSettingsUIOnly.Low, + customGetter: () => (ScalableLevel3ForFrameSettingsUIOnly)serialized.sssQualityLevel.intValue,// 3 levels + customSetter: v => serialized.sssQualityLevel.intValue = Math.Max(0, Math.Min((int)v, 2)),// Levels 0-2 + overrideable: () => (serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false) + && (serialized.sssQualityMode.GetEnumValue() == SssQualityMode.FromQualitySettings), + ignoreDependencies: true, + hasMixedValues: serialized.sssQualityLevel.hasMultipleDifferentValues + ); + area.AmmendInfo(FrameSettingsField.SssCustomSampleBudget, + overridedDefaultValue: (int)DefaultSssSampleBudgetForQualityLevel.Low, + customGetter: () => serialized.sssCustomSampleBudget.intValue, + customSetter: v => serialized.sssCustomSampleBudget.intValue = Math.Max(1, Math.Min((int)v, (int)DefaultSssSampleBudgetForQualityLevel.Max)), + overrideable: () => (serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false) + && (serialized.sssQualityMode.GetEnumValue() != SssQualityMode.FromQualitySettings), + ignoreDependencies: true, + hasMixedValues: serialized.sssCustomSampleBudget.hasMultipleDifferentValues + ); + area.Draw(withOverride); + GUI.enabled = isGUIenabled; } static internal void Drawer_SectionAsyncComputeSettings(SerializedFrameSettings serialized, Editor owner, bool withOverride) { var area = GetFrameSettingSectionContent(2, serialized, owner); + + area.AmmendInfo(FrameSettingsField.LightListAsync, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.SSRAsync, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.SSAOAsync, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.ContactShadowsAsync, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.VolumeVoxelizationsAsync, ignoreDependencies: true); + area.Draw(withOverride); } static internal void Drawer_SectionLightLoopSettings(SerializedFrameSettings serialized, Editor owner, bool withOverride) { var area = GetFrameSettingSectionContent(3, serialized, owner); + + area.AmmendInfo(FrameSettingsField.ComputeLightEvaluation, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.ComputeLightVariants, ignoreDependencies: true); + area.AmmendInfo(FrameSettingsField.ComputeMaterialVariants, ignoreDependencies: true); + area.Draw(withOverride); } static OverridableFrameSettingsArea GetFrameSettingSectionContent(int group, SerializedFrameSettings serialized, Editor owner) { - FrameSettings defaultFrameSettings = GetDefaultFrameSettingsFor(owner); + FrameSettings? defaultFrameSettings = GetDefaultFrameSettingsFor(owner); var area = OverridableFrameSettingsArea.GetGroupContent(group, defaultFrameSettings, serialized); return area; } diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Skin.cs index eafb9f25c39..bd4329ef2b0 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Skin.cs @@ -5,11 +5,11 @@ namespace UnityEditor.Rendering.HighDefinition { partial class FrameSettingsUI { - static readonly GUIContent frameSettingsHeaderContent = EditorGUIUtility.TrTextContent("Frame Settings Overrides", "Default FrameSettings are defined in your Unity Project's HDRP Asset."); + static readonly GUIContent frameSettingsHeaderContent = EditorGUIUtility.TrTextContent("Frame Settings Overrides", "Default values for Frame Settings are defined in the Global Settings asset located in Project Settings > Graphics > HDRP Settings."); - const string renderingSettingsHeaderContent = "Rendering"; - const string lightSettingsHeaderContent = "Lighting"; - const string asyncComputeSettingsHeaderContent = "Asynchronous Compute Shaders"; - const string lightLoopSettingsHeaderContent = "Light Loop Debug"; + static readonly GUIContent renderingSettingsHeaderContent = EditorGUIUtility.TrTextContent("Rendering"); + static readonly GUIContent lightSettingsHeaderContent = EditorGUIUtility.TrTextContent("Lighting"); + static readonly GUIContent asyncComputeSettingsHeaderContent = EditorGUIUtility.TrTextContent("Asynchronous Compute Shaders"); + static readonly GUIContent lightLoopSettingsHeaderContent = EditorGUIUtility.TrTextContent("Light Loop Debug"); } } diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/OverridableFrameSettingsArea.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/OverridableFrameSettingsArea.cs index 43a566f3cb2..756d7ce60aa 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/OverridableFrameSettingsArea.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/OverridableFrameSettingsArea.cs @@ -19,7 +19,7 @@ internal struct OverridableFrameSettingsArea /// Enumerates the keywords corresponding to frame settings properties. internal static readonly string[] frameSettingsKeywords; - FrameSettings defaultFrameSettings; + FrameSettings? defaultFrameSettings; SerializedFrameSettings serializedFrameSettings; static OverridableFrameSettingsArea() @@ -55,7 +55,7 @@ private struct Field /// public bool hasMixedValues; public GUIContent label => EditorGUIUtility.TrTextContent(attributes[field].displayedName, attributes[field].tooltip); - public bool IsOverrideableWithDependencies(SerializedFrameSettings serialized, FrameSettings defaultFrameSettings) + public bool IsOverrideableWithDependencies(SerializedFrameSettings serialized, FrameSettings? defaultFrameSettings) { FrameSettingsFieldAttribute attribute = attributes[field]; bool locallyOverrideable = overrideable == null || overrideable(); @@ -63,6 +63,9 @@ public bool IsOverrideableWithDependencies(SerializedFrameSettings serialized, F if (dependencies == null || ignoreDependencies || !locallyOverrideable) return locallyOverrideable; + if (!defaultFrameSettings.HasValue) + return true; + bool dependenciesOverrideable = true; for (int index = dependencies.Length - 1; index >= 0 && dependenciesOverrideable; --index) { @@ -74,14 +77,14 @@ public bool IsOverrideableWithDependencies(SerializedFrameSettings serialized, F } private List fields; - public OverridableFrameSettingsArea(int capacity, FrameSettings defaultFrameSettings, SerializedFrameSettings serializedFrameSettings) + public OverridableFrameSettingsArea(int capacity, FrameSettings? defaultFrameSettings, SerializedFrameSettings serializedFrameSettings) { fields = new List(capacity); this.defaultFrameSettings = defaultFrameSettings; this.serializedFrameSettings = serializedFrameSettings; } - public static OverridableFrameSettingsArea GetGroupContent(int groupIndex, FrameSettings defaultFrameSettings, SerializedFrameSettings serializedFrameSettings) + public static OverridableFrameSettingsArea GetGroupContent(int groupIndex, FrameSettings? defaultFrameSettings, SerializedFrameSettings serializedFrameSettings) { if (!attributesGroup.ContainsKey(groupIndex) || attributesGroup[groupIndex] == null) attributesGroup[groupIndex] = attributes?.Where(pair => pair.Value?.group == groupIndex)?.OrderBy(pair => pair.Value.orderInGroup); @@ -119,13 +122,13 @@ public void AmmendInfo(FrameSettingsField field, Func overrideable = null, fields[matchIndex] = match; } - static bool EvaluateBoolWithOverride(FrameSettingsField field, Field forField, FrameSettings defaultFrameSettings, SerializedFrameSettings serializedFrameSettings, bool negative) + static bool EvaluateBoolWithOverride(FrameSettingsField field, Field forField, FrameSettings? defaultFrameSettings, SerializedFrameSettings serializedFrameSettings, bool negative) { - bool value; + bool value = false; if (serializedFrameSettings.GetOverrides(field)) value = serializedFrameSettings.IsEnabled(field) ?? false; - else - value = defaultFrameSettings.IsEnabled(field); + else if (defaultFrameSettings.HasValue) + value = defaultFrameSettings.Value.IsEnabled(field); return value ^ negative; } @@ -217,12 +220,12 @@ void DrawField(Field field, bool withOverride) switch (attributes[field.field].type) { case FrameSettingsFieldAttribute.DisplayType.BoolAsCheckbox: - DrawFieldShape(fieldRect, defaultFrameSettings.IsEnabled(field.field)); + DrawFieldShape(fieldRect, defaultFrameSettings.HasValue ? defaultFrameSettings.Value.IsEnabled(field.field) : false); break; case FrameSettingsFieldAttribute.DisplayType.BoolAsEnumPopup: //shame but it is not possible to use Convert.ChangeType to convert int into enum in current C# //rely on string parsing for the moment - var oldEnumValue = Enum.Parse(attributes[field.field].targetType, defaultFrameSettings.IsEnabled(field.field) ? "1" : "0"); + var oldEnumValue = Enum.Parse(attributes[field.field].targetType, (defaultFrameSettings.HasValue && defaultFrameSettings.Value.IsEnabled(field.field)) ? "1" : "0"); DrawFieldShape(fieldRect, oldEnumValue); break; case FrameSettingsFieldAttribute.DisplayType.Others: @@ -236,7 +239,7 @@ void DrawField(Field field, bool withOverride) else DrawFieldShape(fieldRect, field.overridedDefaultValue); } - else + else //is enabled { switch (attributes[field.field].type) { @@ -275,6 +278,7 @@ void DrawField(Field field, bool withOverride) } break; case FrameSettingsFieldAttribute.DisplayType.Others: + // TODO: refactor to get a default customGetter from GetGroupContent var oldValue = field.customGetter(); EditorGUI.BeginChangeCheck(); var newValue = DrawFieldShape(fieldRect, oldValue); diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/QualitySettingsPanel.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/QualitySettingsPanel.cs index e854c82e74a..cd0825e358c 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/QualitySettingsPanel.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/QualitySettingsPanel.cs @@ -28,7 +28,6 @@ public static SettingsProvider CreateSettingsProvider() activateHandler = s_IMGUIImpl.OnActivate, keywords = SettingsProvider.GetSearchKeywordsFromGUIContentProperties() .Concat(SettingsProvider.GetSearchKeywordsFromGUIContentProperties()) - .Concat(SettingsProvider.GetSearchKeywordsFromGUIContentProperties()) .ToArray(), guiHandler = s_IMGUIImpl.OnGUI, }; diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedFrameSettings.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedFrameSettings.cs index e52b6d3ab29..b7fc10875b1 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedFrameSettings.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedFrameSettings.cs @@ -46,9 +46,9 @@ public bool HaveMultipleValue(FrameSettingsField field) => m_BitDatas.HasBitMultipleDifferentValue((uint)field); public bool GetOverrides(FrameSettingsField field) - => m_BitOverrides?.GetBitAt((uint)field) ?? false; //rootOverride can be null in case of hdrpAsset defaults + => m_BitOverrides?.GetBitAt((uint)field) ?? false; //rootOverride can be null in case of hdrp global settings public void SetOverrides(FrameSettingsField field, bool value) - => m_BitOverrides?.SetBitAt((uint)field, value); //rootOverride can be null in case of hdrpAsset defaults + => m_BitOverrides?.SetBitAt((uint)field, value); //rootOverride can be null in case of hdrp global settings public bool HaveMultipleOverride(FrameSettingsField field) => m_BitOverrides?.HasBitMultipleDifferentValue((uint)field) ?? false; diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedHDRenderPipelineGlobalSettings.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedHDRenderPipelineGlobalSettings.cs index 449b6acef9d..d22d4eddc45 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedHDRenderPipelineGlobalSettings.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/SerializedHDRenderPipelineGlobalSettings.cs @@ -16,12 +16,12 @@ class SerializedHDRenderPipelineGlobalSettings public SerializedProperty renderPipelineResources; public SerializedProperty renderPipelineRayTracingResources; - public SerializedFrameSettings defaultFrameSettings; + public SerializedFrameSettings defaultCameraFrameSettings; public SerializedFrameSettings defaultBakedOrCustomReflectionFrameSettings; public SerializedFrameSettings defaultRealtimeReflectionFrameSettings; - public SerializedProperty volumeProfileDefault; - public SerializedProperty volumeProfileLookDev; + public SerializedProperty defaultVolumeProfile; + public SerializedProperty lookDevVolumeProfile; public SerializedProperty lightLayerName0; public SerializedProperty lightLayerName1; @@ -92,14 +92,14 @@ public SerializedHDRenderPipelineGlobalSettings(SerializedObject serializedObjec renderPipelineResources = serializedObject.FindProperty("m_RenderPipelineResources"); renderPipelineRayTracingResources = serializedObject.FindProperty("m_RenderPipelineRayTracingResources"); - defaultFrameSettings = new SerializedFrameSettings(serializedObject.FindProperty("m_RenderingPathDefaultCameraFrameSettings"), null); //no overrides in HDRPAsset + defaultCameraFrameSettings = new SerializedFrameSettings(serializedObject.FindProperty("m_RenderingPathDefaultCameraFrameSettings"), null); //no overrides in HDRPAsset defaultBakedOrCustomReflectionFrameSettings = new SerializedFrameSettings(serializedObject.FindProperty("m_RenderingPathDefaultBakedOrCustomReflectionFrameSettings"), null); //no overrides in HDRPAsset defaultRealtimeReflectionFrameSettings = new SerializedFrameSettings(serializedObject.FindProperty("m_RenderingPathDefaultRealtimeReflectionFrameSettings"), null); //no overrides in HDRPAsset InitializeCustomPostProcessesLists(); - volumeProfileDefault = serializedObject.FindProperty("m_VolumeProfileDefault"); - volumeProfileLookDev = serializedObject.FindProperty("m_VolumeProfileLookDev"); + defaultVolumeProfile = serializedObject.FindProperty("m_DefaultVolumeProfile"); + lookDevVolumeProfile = serializedObject.FindProperty("m_LookDevVolumeProfile"); lightLayerName0 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.lightLayerName0); lightLayerName1 = serializedObject.Find((HDRenderPipelineGlobalSettings s) => s.lightLayerName1); diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/VolumeProfileCreator.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/VolumeProfileCreator.cs index 720e4bdbaf6..ec2623a59e1 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/VolumeProfileCreator.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/VolumeProfileCreator.cs @@ -29,7 +29,7 @@ void Assign(VolumeProfile profile) settings.volumeProfile = profile; break; case Kind.LookDev: - settings.volumeProfileLookDev = profile; + settings.lookDevVolumeProfile = profile; break; } EditorUtility.SetDirty(settings); diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs index bbb25f550d1..f6a85c05b69 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs @@ -95,9 +95,10 @@ public override void OnEnable() m_ShadowTint = Unpack(o.Find(x => x.shadowTint)); m_IntensityTexture = RTHandles.Alloc(1, 1, colorFormat: GraphicsFormat.R32G32B32A32_SFloat); - var hdrp = HDRenderPipeline.defaultAsset; - if (hdrp != null) - m_IntegrateHDRISkyMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.shaders.integrateHdriSkyPS); + if (HDRenderPipelineGlobalSettings.instance?.renderPipelineResources != null) + { + m_IntegrateHDRISkyMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.integrateHdriSkyPS); + } m_ReadBackTexture = new Texture2D(1, 1, GraphicsFormat.R32G32B32A32_SFloat, TextureCreationFlags.None); } @@ -112,10 +113,17 @@ public override void OnDisable() // Compute the lux value in the upper hemisphere of the HDRI skybox public void GetUpperHemisphereLuxValue() { - Cubemap hdri = m_hdriSky.value.objectReferenceValue as Cubemap; + // null material can happen when no HDRP asset was present at startup + if (m_IntegrateHDRISkyMaterial == null) + { + if (HDRenderPipeline.isReady) + m_IntegrateHDRISkyMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.integrateHdriSkyPS); + else + return; + } - // null material can happen when no HDRP asset is present. - if (hdri == null || m_IntegrateHDRISkyMaterial == null) + Cubemap hdri = m_hdriSky.value.objectReferenceValue as Cubemap; + if (hdri == null) return; m_IntegrateHDRISkyMaterial.SetTexture(HDShaderIDs._Cubemap, hdri); diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs index 9bdc52eaa7a..9ad0dfa3c0e 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs @@ -407,7 +407,7 @@ bool IsHdrpGlobalSettingsUsedCorrect() => HDRenderPipelineGlobalSettings.instance != null; void FixHdrpGlobalSettingsUsed(bool fromAsync) - => HDRenderPipelineGlobalSettings.Ensure(); + => HDRenderPipelineGlobalSettings.Ensure(folderPath: HDProjectSettings.projectSettingsFolderPath); bool IsRuntimeResourcesCorrect() => IsHdrpGlobalSettingsUsedCorrect() && HDRenderPipelineGlobalSettings.instance.AreResourcesCreated(); @@ -530,7 +530,7 @@ void FixDefaultLookDevVolumeProfile(bool fromAsyncUnused) FixEditorResources(fromAsyncUnused: false); var hdrpSettings = HDRenderPipelineGlobalSettings.instance; - hdrpSettings.volumeProfileLookDev = CreateDefaultVolumeProfileIfNeeded(hdrpSettings.renderPipelineEditorResources.lookDev.defaultLookDevVolumeProfile); + hdrpSettings.lookDevVolumeProfile = CreateDefaultVolumeProfileIfNeeded(hdrpSettings.renderPipelineEditorResources.lookDev.defaultLookDevVolumeProfile); EditorUtility.SetDirty(hdrpSettings); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs index 67369af95cd..710fceffc2a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs @@ -24,9 +24,10 @@ internal class ShaderIDs public override void Setup() { - var hdrpAsset = HDRenderPipeline.defaultAsset; - if (hdrpAsset != null) - m_Material = CoreUtils.CreateEngineMaterial(hdrpAsset.renderPipelineResources.shaders.alphaInjectionPS); + if (!HDRenderPipeline.isReady) + return; + + m_Material = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.alphaInjectionPS); } public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs index 0c2b031af2b..fcd96202cc1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs @@ -27,9 +27,10 @@ internal class ShaderIDs public override void Setup() { - var hdrpAsset = HDRenderPipeline.defaultAsset; - if (hdrpAsset != null) - m_Material = CoreUtils.CreateEngineMaterial(hdrpAsset.renderPipelineResources.shaders.chromaKeyingPS); + if (!HDRenderPipeline.isReady) + return; + + m_Material = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.chromaKeyingPS); } public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs index 3cb2436fe3b..136af8eee7a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs @@ -32,12 +32,13 @@ enum PassType // The render pipeline will ensure target setup and clearing happens in an performance manner. protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) { + if (!HDRenderPipeline.isReady) + return; + // Setup code here if (string.IsNullOrEmpty(name)) name = "CustomClear"; - var hdrpAsset = HDRenderPipeline.defaultAsset; - if (hdrpAsset != null) - m_FullscreenPassMaterial = CoreUtils.CreateEngineMaterial(hdrpAsset.renderPipelineResources.shaders.customClearPS); + m_FullscreenPassMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.customClearPS); } protected override void Execute(CustomPassContext ctx) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Core/Migration/MigrationDescription.cs b/com.unity.render-pipelines.high-definition/Runtime/Core/Migration/MigrationDescription.cs index 7cb54df3647..8bf6678fa28 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Core/Migration/MigrationDescription.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Core/Migration/MigrationDescription.cs @@ -112,8 +112,11 @@ public bool Migrate(TTarget target) { UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(targetObject); } - - UnityEditor.EditorUtility.SetDirty(targetObject); + UnityEditor.EditorApplication.delayCall += () => + { + if (targetObject != null && !targetObject.Equals(null)) + UnityEditor.EditorUtility.SetDirty(targetObject); + }; } #endif return true; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCacheCubemap.cs b/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCacheCubemap.cs index c9b5fb056af..a5ac3702b2e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCacheCubemap.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCacheCubemap.cs @@ -22,8 +22,8 @@ class TextureCacheCubemap : TextureCache public TextureCacheCubemap(string cacheName = "", int sliceSize = 1) : base(cacheName, sliceSize) { - var res = HDRenderPipeline.defaultAsset.renderPipelineResources; - m_BlitCubemapFaceMaterial = CoreUtils.CreateEngineMaterial(res.shaders.blitCubeTextureFacePS); + if (HDRenderPipeline.isReady) + m_BlitCubemapFaceMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.blitCubeTextureFacePS); m_BlitCubemapFaceProperties = new MaterialPropertyBlock(); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs index 8c20f1d1a66..6cf522b285c 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs @@ -2855,18 +2855,18 @@ internal void UpdateAreaLightEmissiveMesh(bool fromTimeLine = false) } // Update Mesh - if (HDRenderPipeline.defaultAsset != null) + if (HDRenderPipelineGlobalSettings.instance != null && !HDRenderPipelineGlobalSettings.instance.Equals(null)) { switch (areaLightShape) { case AreaLightShape.Tube: - if (m_EmissiveMeshFilter.sharedMesh != HDRenderPipeline.defaultAsset.renderPipelineResources.assets.emissiveCylinderMesh) - m_EmissiveMeshFilter.sharedMesh = HDRenderPipeline.defaultAsset.renderPipelineResources.assets.emissiveCylinderMesh; + if (m_EmissiveMeshFilter.sharedMesh != HDRenderPipelineGlobalSettings.instance.renderPipelineResources.assets.emissiveCylinderMesh) + m_EmissiveMeshFilter.sharedMesh = HDRenderPipelineGlobalSettings.instance.renderPipelineResources.assets.emissiveCylinderMesh; break; case AreaLightShape.Rectangle: default: - if (m_EmissiveMeshFilter.sharedMesh != HDRenderPipeline.defaultAsset.renderPipelineResources.assets.emissiveQuadMesh) - m_EmissiveMeshFilter.sharedMesh = HDRenderPipeline.defaultAsset.renderPipelineResources.assets.emissiveQuadMesh; + if (m_EmissiveMeshFilter.sharedMesh != HDRenderPipelineGlobalSettings.instance.renderPipelineResources.assets.emissiveQuadMesh) + m_EmissiveMeshFilter.sharedMesh = HDRenderPipelineGlobalSettings.instance.renderPipelineResources.assets.emissiveQuadMesh; break; } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightCookieManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightCookieManager.cs index d6a4af0af1a..f744421cd26 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightCookieManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightCookieManager.cs @@ -53,7 +53,7 @@ public LightCookieManager(HDRenderPipelineAsset hdAsset, int maxCacheSize) { // Keep track of the render pipeline asset m_RenderPipelineAsset = hdAsset; - var hdResources = HDRenderPipeline.defaultAsset.renderPipelineResources; + var hdResources = HDRenderPipelineGlobalSettings.instance.renderPipelineResources; // Create the texture cookie cache that we shall be using for the area lights GlobalLightLoopSettings gLightLoopSettings = hdAsset.currentPlatformRenderPipelineSettings.lightLoopSettings; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs index 952ac7da188..14007e944a0 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs @@ -192,9 +192,9 @@ void InitializeScreenSpaceShadows() // Fetch the shaders if (m_RayTracingSupported) { - m_ScreenSpaceShadowsCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.shadowRaytracingCS; - m_ScreenSpaceShadowsFilterCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.shadowFilterCS; - m_ScreenSpaceShadowsRT = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.shadowRaytracingRT; + m_ScreenSpaceShadowsCS = m_GlobalSettings.renderPipelineRayTracingResources.shadowRaytracingCS; + m_ScreenSpaceShadowsFilterCS = m_GlobalSettings.renderPipelineRayTracingResources.shadowFilterCS; + m_ScreenSpaceShadowsRT = m_GlobalSettings.renderPipelineRayTracingResources.shadowRaytracingRT; // Directional shadow kernels m_ClearShadowTexture = m_ScreenSpaceShadowsCS.FindKernel("ClearShadowTexture"); @@ -370,7 +370,7 @@ SSShadowDebugParameters PrepareSSShadowDebugParameters(HDCamera hdCamera, int ta sssdParams.debugKernel = m_WriteShadowTextureDebugKernel; // TODO: move the debug kernel outside of the ray tracing resources - sssdParams.shadowFilter = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.shadowFilterCS; + sssdParams.shadowFilter = m_GlobalSettings.renderPipelineRayTracingResources.shadowFilterCS; return sssdParams; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalProjector.cs b/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalProjector.cs index 9b85b33e7f8..0086b2e1c47 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalProjector.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalProjector.cs @@ -532,8 +532,7 @@ public bool IsValid() return false; #if UNITY_EDITOR - var hdrp = HDRenderPipeline.defaultAsset; - if ((hdrp != null) && (m_Material == hdrp.GetDefaultDecalMaterial())) + if (!HDRenderPipeline.isReady || m_Material == HDRenderPipeline.currentAsset.GetDefaultDecalMaterial()) return false; #endif diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD.cs b/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD.cs index 713d598a050..58c10911c47 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD.cs @@ -52,13 +52,12 @@ public void Build(FGDIndex index) if (m_refCounting[(int)index] == 0) { - var hdrp = HDRenderPipeline.defaultAsset; int res = (int)FGDTexture.Resolution; switch (index) { case FGDIndex.FGD_GGXAndDisneyDiffuse: - m_PreIntegratedFGDMaterial[(int)index] = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.shaders.preIntegratedFGD_GGXDisneyDiffusePS); + m_PreIntegratedFGDMaterial[(int)index] = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.preIntegratedFGD_GGXDisneyDiffusePS); m_PreIntegratedFGD[(int)index] = new RenderTexture(res, res, 0, GraphicsFormat.A2B10G10R10_UNormPack32); m_PreIntegratedFGD[(int)index].hideFlags = HideFlags.HideAndDontSave; m_PreIntegratedFGD[(int)index].filterMode = FilterMode.Bilinear; @@ -68,7 +67,7 @@ public void Build(FGDIndex index) break; case FGDIndex.FGD_CharlieAndFabricLambert: - m_PreIntegratedFGDMaterial[(int)index] = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.shaders.preIntegratedFGD_CharlieFabricLambertPS); + m_PreIntegratedFGDMaterial[(int)index] = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.preIntegratedFGD_CharlieFabricLambertPS); m_PreIntegratedFGD[(int)index] = new RenderTexture(res, res, 0, GraphicsFormat.A2B10G10R10_UNormPack32); m_PreIntegratedFGD[(int)index].hideFlags = HideFlags.HideAndDontSave; m_PreIntegratedFGD[(int)index].filterMode = FilterMode.Bilinear; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs index 6bb5624993f..df1ac32e034 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs @@ -696,7 +696,7 @@ TextureHandle RenderContactShadows(RenderGraph renderGraph, HDCamera hdCamera, T passData.rayTracingEnabled = RayTracedContactShadowsRequired(); if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing)) { - passData.contactShadowsRTS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.contactShadowRayTracingRT; + passData.contactShadowsRTS = m_GlobalSettings.renderPipelineRayTracingResources.contactShadowRayTracingRT; passData.accelerationStructure = RequestAccelerationStructure(); passData.actualWidth = hdCamera.actualWidth; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LookDev.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LookDev.cs index f47f920a1ee..f7128cf06a1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LookDev.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LookDev.cs @@ -20,7 +20,7 @@ struct LookDevDataForHDRP #if UNITY_EDITOR bool UpdateVolumeProfile(Volume volume, out VisualEnvironment visualEnvironment, out HDRISky sky, ref int volumeProfileHash) { - var lookDevVolumeProfile = HDRenderPipelineGlobalSettings.instance.GetOrAssignLookDevVolumeProfile(); + var lookDevVolumeProfile = m_GlobalSettings.GetOrAssignLookDevVolumeProfile(); int newHashCode = lookDevVolumeProfile.GetHashCode(); if (newHashCode != volumeProfileHash) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs index c2f67380dd1..e46bc0ee803 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs @@ -357,7 +357,7 @@ TextureHandle RenderPostProcess(RenderGraph renderGraph, source = DynamicExposurePass(renderGraph, hdCamera, source); - source = CustomPostProcessPass(renderGraph, hdCamera, source, depthBuffer, normalBuffer, HDRenderPipeline.defaultAsset.beforeTAACustomPostProcesses, HDProfileId.CustomPostProcessBeforeTAA); + source = CustomPostProcessPass(renderGraph, hdCamera, source, depthBuffer, normalBuffer, m_GlobalSettings.beforeTAACustomPostProcesses, HDProfileId.CustomPostProcessBeforeTAA); // Temporal anti-aliasing goes first if (m_AntialiasingFS) @@ -372,7 +372,7 @@ TextureHandle RenderPostProcess(RenderGraph renderGraph, } } - source = CustomPostProcessPass(renderGraph, hdCamera, source, depthBuffer, normalBuffer, HDRenderPipeline.defaultAsset.beforePostProcessCustomPostProcesses, HDProfileId.CustomPostProcessBeforePP); + source = CustomPostProcessPass(renderGraph, hdCamera, source, depthBuffer, normalBuffer, m_GlobalSettings.beforePostProcessCustomPostProcesses, HDProfileId.CustomPostProcessBeforePP); source = DepthOfFieldPass(renderGraph, hdCamera, depthBuffer, motionVectors, depthBufferMipChain, source); @@ -391,7 +391,7 @@ TextureHandle RenderPostProcess(RenderGraph renderGraph, source = UberPass(renderGraph, hdCamera, logLutOutput, bloomTexture, source); PushFullScreenDebugTexture(renderGraph, source, FullScreenDebugMode.ColorLog); - source = CustomPostProcessPass(renderGraph, hdCamera, source, depthBuffer, normalBuffer, HDRenderPipeline.defaultAsset.afterPostProcessCustomPostProcesses, HDProfileId.CustomPostProcessAfterPP); + source = CustomPostProcessPass(renderGraph, hdCamera, source, depthBuffer, normalBuffer, m_GlobalSettings.afterPostProcessCustomPostProcesses, HDProfileId.CustomPostProcessAfterPP); source = FXAAPass(renderGraph, hdCamera, source); @@ -1086,7 +1086,7 @@ void DoUserAfterOpaqueAndSky(RenderGraph renderGraph, HDCamera hdCamera, Texture using (new RenderGraphProfilingScope(renderGraph, ProfilingSampler.Get(HDProfileId.CustomPostProcessAfterOpaqueAndSky))) { TextureHandle source = colorBuffer; - bool needBlitToColorBuffer = DoCustomPostProcess(renderGraph, hdCamera, ref source, depthBuffer, normalBuffer, defaultAsset.beforeTransparentCustomPostProcesses); + bool needBlitToColorBuffer = DoCustomPostProcess(renderGraph, hdCamera, ref source, depthBuffer, normalBuffer, m_GlobalSettings.beforeTransparentCustomPostProcesses); if (needBlitToColorBuffer) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs index a8cce1c4222..3fc0eea86ac 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs @@ -70,7 +70,7 @@ void CleanupSubsurfaceScattering() void UpdateCurrentDiffusionProfileSettings(HDCamera hdCamera) { - var currentDiffusionProfiles = HDRenderPipeline.defaultAsset.diffusionProfileSettingsList; + var currentDiffusionProfiles = m_GlobalSettings.diffusionProfileSettingsList; var diffusionProfileOverride = hdCamera.volumeStack.GetComponent(); // If there is a diffusion profile volume override, we merge diffusion profiles that are overwritten diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 0054af0fe4b..621e54b5b40 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -24,9 +24,6 @@ namespace UnityEngine.Rendering.HighDefinition public partial class HDRenderPipeline : RenderPipeline { #region Global Settings - internal static HDRenderPipelineGlobalSettings defaultAsset - => HDRenderPipelineGlobalSettings.instance; - private HDRenderPipelineGlobalSettings m_GlobalSettings; public override RenderPipelineGlobalSettings defaultSettings => m_GlobalSettings; @@ -50,7 +47,7 @@ internal static HDRenderPipeline currentPipeline readonly HDRenderPipelineAsset m_Asset; internal HDRenderPipelineAsset asset { get { return m_Asset; } } - internal RenderPipelineResources defaultResources { get { return HDRenderPipelineGlobalSettings.instance.renderPipelineResources; } } + internal RenderPipelineResources defaultResources { get { return m_GlobalSettings.renderPipelineResources; } } internal RenderPipelineSettings currentPlatformRenderPipelineSettings { get { return m_Asset.currentPlatformRenderPipelineSettings; } } @@ -449,20 +446,27 @@ void UpgradeResourcesIfNeeded() m_GlobalSettings.EnsureRuntimeResources(forceReload: true); m_GlobalSettings.EnsureEditorResources(forceReload: true); + bool requiresRayTracingResources = false; if (GatherRayTracingSupport(asset.currentPlatformRenderPipelineSettings)) { - m_GlobalSettings.EnsureRayTracingResources(forceReload: true); + requiresRayTracingResources = true; } - else + // Also make sure to include ray-tracing resources if at least one of the quality levels needs it + else if (rayTracingSupportedBySystem) { - // 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) + { + var hdrpAsset = QualitySettings.GetRenderPipelineAssetAt(i) as HDRenderPipelineAsset; + if (hdrpAsset != null && hdrpAsset.currentPlatformRenderPipelineSettings.supportRayTracing) + requiresRayTracingResources = true; + } } - } - - void ValidateResources() - { - HDRenderPipelineGlobalSettings.instance.EnsureShadersCompiled(); + // If ray tracing is not enabled we do not want to have ray tracing resources referenced + if (requiresRayTracingResources) + m_GlobalSettings.EnsureRayTracingResources(forceReload: true); + else + m_GlobalSettings.ClearRayTracingResources(); } #endif @@ -1004,10 +1008,9 @@ protected override void Render(ScriptableRenderContext renderContext, Camera[] c #if UNITY_EDITOR // We do not want to start rendering if HDRP global settings are not ready (m_globalSettings is null) - // or been deleted/moved (m_globalSettings is not ncessarily null) + // or been deleted/moved (m_globalSettings is not necessarily null) if (m_GlobalSettings == null || HDRenderPipelineGlobalSettings.instance == null) { - Debug.LogError("No HDRP Global Settings Asset is assigned. One will be created for you. If you want to modify it, go to Project Settings > Graphics > HDRP Settings."); m_GlobalSettings = HDRenderPipelineGlobalSettings.Ensure(); m_GlobalSettings.EnsureShadersCompiled(); return; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs index 9a76913766e..ad0270887b7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs @@ -20,7 +20,14 @@ public partial class HDRenderPipelineAsset : RenderPipelineAsset, IVirtualTextur { } - void Reset() => OnValidate(); + void Reset() + { +#if UNITY_EDITOR + // we need to ensure we have a global settings asset to be able to create an HDRP Asset + HDRenderPipelineGlobalSettings.Ensure(canCreateNewAsset: true); +#endif + OnValidate(); + } /// /// CreatePipeline implementation. @@ -102,17 +109,17 @@ internal ReflectionSystemParameters reflectionSystemParameters /// Names used for display of rendering layer masks. public override string[] renderingLayerMaskNames - => HDRenderPipelineGlobalSettings.instance.renderingLayerMaskNames; + => globalSettings.renderingLayerMaskNames; /// /// Names used for display of light layers. /// - public string[] lightLayerNames => HDRenderPipelineGlobalSettings.instance.lightLayerNames; + public string[] lightLayerNames => globalSettings.lightLayerNames; /// /// Names used for display of decal layers. /// - public string[] decalLayerNames => HDRenderPipelineGlobalSettings.instance.decalLayerNames; + public string[] decalLayerNames => globalSettings.decalLayerNames; /// HDRP default shader. public override Shader defaultShader diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineGlobalSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineGlobalSettings.cs index 57b694bda42..6971d917a46 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineGlobalSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineGlobalSettings.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; //needed for list of Custom Post Processes injections using System.IO; using System.Linq; +using UnityEngine.Serialization; #if UNITY_EDITOR using UnityEditorInternal; using UnityEditor; @@ -53,7 +54,7 @@ static internal void UpdateGraphicsSettings(HDRenderPipelineGlobalSettings newSe #if UNITY_EDITOR //Making sure there is at least one HDRenderPipelineGlobalSettings instance in the project - static internal HDRenderPipelineGlobalSettings Ensure(bool canCreateNewAsset = true) + static internal HDRenderPipelineGlobalSettings Ensure(string folderPath = "HDRPDefaultResources", bool canCreateNewAsset = true) { bool needsMigration = (assetToBeMigrated != null && !assetToBeMigrated.Equals(null)); @@ -61,11 +62,13 @@ static internal HDRenderPipelineGlobalSettings Ensure(bool canCreateNewAsset = t return HDRenderPipelineGlobalSettings.instance; HDRenderPipelineGlobalSettings assetCreated = null; - string path = "Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset"; + string path = "Assets/" + folderPath + "/HDRenderPipelineGlobalSettings.asset"; if (needsMigration) { if (HDRenderPipelineGlobalSettings.instance) path = AssetDatabase.GetAssetPath(HDRenderPipelineGlobalSettings.instance); + else if (!AssetDatabase.IsValidFolder("Assets/" + folderPath)) + AssetDatabase.CreateFolder("Assets", folderPath); assetCreated = MigrateFromHDRPAsset(assetToBeMigrated, path, bClearObsoleteFields: false, canCreateNewAsset: canCreateNewAsset); if (assetCreated != null && !assetCreated.Equals(null)) @@ -86,9 +89,11 @@ static internal HDRenderPipelineGlobalSettings Ensure(bool canCreateNewAsset = t } else if (canCreateNewAsset)// or create one altogether { - if (!AssetDatabase.IsValidFolder("Assets/HDRPDefaultResources/")) - AssetDatabase.CreateFolder("Assets", "HDRPDefaultResources"); + if (!AssetDatabase.IsValidFolder("Assets/" + folderPath)) + AssetDatabase.CreateFolder("Assets", folderPath); assetCreated = Create(path); + + Debug.LogWarning("No HDRP Global Settings Asset is assigned. One will be created for you. If you want to modify it, go to Project Settings > Graphics > HDRP Settings."); } else { @@ -158,8 +163,6 @@ internal static HDRenderPipelineGlobalSettings MigrateFromHDRPAsset(HDRenderPipe Debug.LogError("Cannot migrate HDRP Asset to a new HDRP Global Settings asset. If you are building a Player, make sure to save an HDRP Global Settings asset by opening the project in the Editor."); return null; } - if (!AssetDatabase.IsValidFolder("Assets/HDRPDefaultResources/")) - AssetDatabase.CreateFolder("Assets", "HDRPDefaultResources"); assetCreated = ScriptableObject.CreateInstance(); AssetDatabase.CreateAsset(assetCreated, path); assetCreated.Init(); @@ -168,7 +171,7 @@ internal static HDRenderPipelineGlobalSettings MigrateFromHDRPAsset(HDRenderPipe #pragma warning disable 618 // Type or member is obsolete //2. Migrate obsolete assets (version DefaultSettingsAsAnAsset) assetCreated.volumeProfile = oldAsset.m_ObsoleteDefaultVolumeProfile; - assetCreated.volumeProfileLookDev = oldAsset.m_ObsoleteDefaultLookDevProfile; + assetCreated.lookDevVolumeProfile = oldAsset.m_ObsoleteDefaultLookDevProfile; assetCreated.m_RenderingPathDefaultCameraFrameSettings = oldAsset.m_ObsoleteFrameSettingsMovedToDefaultSettings; assetCreated.m_RenderingPathDefaultBakedOrCustomReflectionFrameSettings = oldAsset.m_ObsoleteBakedOrCustomReflectionFrameSettingsMovedToDefaultSettings; @@ -213,8 +216,9 @@ internal static HDRenderPipelineGlobalSettings MigrateFromHDRPAsset(HDRenderPipe oldAsset.diffusionProfileSettings.TryToUpgrade(); } - System.Array.Resize(ref assetCreated.diffusionProfileSettingsList, oldAsset.m_ObsoleteDiffusionProfileSettingsList.Length); - for (int i = 0; i < oldAsset.m_ObsoleteDiffusionProfileSettingsList.Length; ++i) + int oldSize = oldAsset.m_ObsoleteDiffusionProfileSettingsList?.Length ?? 0; + System.Array.Resize(ref assetCreated.diffusionProfileSettingsList, oldSize); + for (int i = 0; i < oldSize; ++i) assetCreated.diffusionProfileSettingsList[i] = oldAsset.m_ObsoleteDiffusionProfileSettingsList[i]; //3. Clear obsolete fields @@ -268,7 +272,7 @@ internal static HDRenderPipelineGlobalSettings Create(string path, HDRenderPipel assetCreated.renderPipelineRayTracingResources = src.renderPipelineRayTracingResources; assetCreated.volumeProfile = src.volumeProfile; - assetCreated.volumeProfileLookDev = src.volumeProfileLookDev; + assetCreated.lookDevVolumeProfile = src.lookDevVolumeProfile; assetCreated.m_RenderingPathDefaultCameraFrameSettings = src.m_RenderingPathDefaultCameraFrameSettings; assetCreated.m_RenderingPathDefaultBakedOrCustomReflectionFrameSettings = src.m_RenderingPathDefaultBakedOrCustomReflectionFrameSettings; @@ -381,12 +385,13 @@ private void DestroyDefaultVolume() #region VolumeProfile - [SerializeField] private VolumeProfile m_VolumeProfileDefault; + [SerializeField, FormerlySerializedAs("m_VolumeProfileDefault")] + private VolumeProfile m_DefaultVolumeProfile; internal VolumeProfile volumeProfile { - get => m_VolumeProfileDefault; - set => m_VolumeProfileDefault = value; + get => m_DefaultVolumeProfile; + set => m_DefaultVolumeProfile = value; } /// Get the current default VolumeProfile asset. If it is missing, the builtin one is assigned to the current settings. @@ -414,26 +419,27 @@ internal bool IsVolumeProfileFromResources() #region Look Dev Profile #if UNITY_EDITOR - [SerializeField] private VolumeProfile m_VolumeProfileLookDev; + [SerializeField, FormerlySerializedAs("VolumeProfileLookDev")] + private VolumeProfile m_LookDevVolumeProfile; - internal VolumeProfile volumeProfileLookDev + internal VolumeProfile lookDevVolumeProfile { - get => m_VolumeProfileLookDev; - set => m_VolumeProfileLookDev = value; + get => m_LookDevVolumeProfile; + set => m_LookDevVolumeProfile = value; } internal VolumeProfile GetOrAssignLookDevVolumeProfile() { - if (volumeProfileLookDev == null || volumeProfileLookDev.Equals(null)) + if (lookDevVolumeProfile == null || lookDevVolumeProfile.Equals(null)) { - volumeProfileLookDev = renderPipelineEditorResources.lookDev.defaultLookDevVolumeProfile; + lookDevVolumeProfile = renderPipelineEditorResources.lookDev.defaultLookDevVolumeProfile; } - return volumeProfileLookDev; + return lookDevVolumeProfile; } internal bool IsVolumeProfileLookDevFromResources() { - return volumeProfileLookDev != null && !volumeProfileLookDev.Equals(null) && renderPipelineEditorResources != null && volumeProfileLookDev.Equals(renderPipelineEditorResources.lookDev.defaultLookDevVolumeProfile); + return lookDevVolumeProfile != null && !lookDevVolumeProfile.Equals(null) && renderPipelineEditorResources != null && lookDevVolumeProfile.Equals(renderPipelineEditorResources.lookDev.defaultLookDevVolumeProfile); } #endif diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs index b2a40399600..6a42fce6093 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs @@ -274,7 +274,7 @@ TextureHandle RenderPathTracing(RenderGraph renderGraph, HDCamera hdCamera, in C { using (var builder = renderGraph.AddRenderPass("Render PathTracing", out var passData)) { - passData.pathTracingShader = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.pathTracing; + passData.pathTracingShader = m_GlobalSettings.renderPipelineRayTracingResources.pathTracing; passData.cameraData = cameraData; passData.ditheredTextureSet = GetBlueNoiseManager().DitheredTextureSet256SPP(); passData.backgroundColor = hdCamera.backgroundColorHDR; @@ -360,7 +360,7 @@ void RenderSky(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle skyBuff TextureHandle RenderPathTracing(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle colorBuffer) { - RayTracingShader pathTracingShader = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.pathTracing; + RayTracingShader pathTracingShader = m_GlobalSettings.renderPipelineRayTracingResources.pathTracing; m_PathTracingSettings = hdCamera.volumeStack.GetComponent(); // Check the validity of the state before moving on with the computation diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs index 32d385f1211..78a0e134cbf 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs @@ -80,7 +80,7 @@ class HDRaytracingLightCluster public void Initialize(HDRenderPipeline renderPipeline) { // Keep track of the external buffers - m_RenderPipelineResources = renderPipeline.asset.renderPipelineResources; + m_RenderPipelineResources = HDRenderPipelineGlobalSettings.instance.renderPipelineResources; m_RenderPipelineRayTracingResources = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources; // Keep track of the render pipeline diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs index 6ce9c8537f3..87ad1f69b24 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs @@ -86,7 +86,7 @@ internal void InitRayTracingManager() { // Init the ray count manager m_RayCountManager = new RayCountManager(); - m_RayCountManager.Init(HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources); + m_RayCountManager.Init(m_GlobalSettings.renderPipelineRayTracingResources); // Build the light cluster m_RayTracingLightCluster = new HDRaytracingLightCluster(); @@ -668,7 +668,7 @@ internal HDTemporalFilter GetTemporalFilter() if (m_TemporalFilter == null && m_RayTracingSupported) { m_TemporalFilter = new HDTemporalFilter(); - m_TemporalFilter.Init(HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources); + m_TemporalFilter.Init(m_GlobalSettings.renderPipelineRayTracingResources); } return m_TemporalFilter; } @@ -678,7 +678,7 @@ internal HDSimpleDenoiser GetSimpleDenoiser() if (m_SimpleDenoiser == null) { m_SimpleDenoiser = new HDSimpleDenoiser(); - m_SimpleDenoiser.Init(HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources); + m_SimpleDenoiser.Init(m_GlobalSettings.renderPipelineRayTracingResources); } return m_SimpleDenoiser; } @@ -688,7 +688,7 @@ internal SSGIDenoiser GetSSGIDenoiser() if (m_SSGIDenoiser == null) { m_SSGIDenoiser = new SSGIDenoiser(); - m_SSGIDenoiser.Init(HDRenderPipelineGlobalSettings.instance.renderPipelineResources); + m_SSGIDenoiser.Init(m_GlobalSettings.renderPipelineResources); } return m_SSGIDenoiser; } @@ -698,7 +698,7 @@ internal HDDiffuseDenoiser GetDiffuseDenoiser() if (m_DiffuseDenoiser == null) { m_DiffuseDenoiser = new HDDiffuseDenoiser(); - m_DiffuseDenoiser.Init(HDRenderPipelineGlobalSettings.instance.renderPipelineResources, HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources, this); + m_DiffuseDenoiser.Init(m_GlobalSettings.renderPipelineResources, m_GlobalSettings.renderPipelineRayTracingResources, this); } return m_DiffuseDenoiser; } @@ -708,7 +708,7 @@ internal HDReflectionDenoiser GetReflectionDenoiser() if (m_ReflectionDenoiser == null) { m_ReflectionDenoiser = new HDReflectionDenoiser(); - m_ReflectionDenoiser.Init(HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources); + m_ReflectionDenoiser.Init(m_GlobalSettings.renderPipelineRayTracingResources); } return m_ReflectionDenoiser; } @@ -718,7 +718,7 @@ internal HDDiffuseShadowDenoiser GetDiffuseShadowDenoiser() if (m_DiffuseShadowDenoiser == null) { m_DiffuseShadowDenoiser = new HDDiffuseShadowDenoiser(); - m_DiffuseShadowDenoiser.Init(HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources); + m_DiffuseShadowDenoiser.Init(m_GlobalSettings.renderPipelineRayTracingResources); } return m_DiffuseShadowDenoiser; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingAmbientOcclusion.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingAmbientOcclusion.cs index 6e46d54d621..a7b3ef2ffae 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingAmbientOcclusion.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingAmbientOcclusion.cs @@ -14,7 +14,7 @@ partial class HDRenderPipeline void InitRayTracingAmbientOcclusion() { // Grab the kernels we need - m_RTAOApplyIntensityKernel = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.aoRaytracingCS.FindKernel("RTAOApplyIntensity"); + m_RTAOApplyIntensityKernel = m_GlobalSettings.renderPipelineRayTracingResources.aoRaytracingCS.FindKernel("RTAOApplyIntensity"); } float EvaluateRTSpecularOcclusionFlag(HDCamera hdCamera, AmbientOcclusion ssoSettings) @@ -109,7 +109,7 @@ TraceAmbientOcclusionResult TraceAO(RenderGraph renderGraph, HDCamera hdCamera, // Other parameters passData.raytracingCB = shaderVariablesRaytracing; - passData.aoShaderRT = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.aoRaytracingRT; + passData.aoShaderRT = m_GlobalSettings.renderPipelineRayTracingResources.aoRaytracingRT; passData.rayTracingAccelerationStructure = RequestAccelerationStructure(); passData.ditheredTextureSet = GetBlueNoiseManager().DitheredTextureSet8SPP(); @@ -209,7 +209,7 @@ TextureHandle ComposeAO(RenderGraph renderGraph, HDCamera hdCamera, TextureHandl passData.actualWidth = hdCamera.actualWidth; passData.actualHeight = hdCamera.actualHeight; passData.viewCount = hdCamera.viewCount; - passData.aoShaderCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.aoRaytracingCS; + passData.aoShaderCS = m_GlobalSettings.renderPipelineRayTracingResources.aoRaytracingCS; passData.intensityKernel = m_RTAOApplyIntensityKernel; passData.outputTexture = builder.ReadWriteTexture(aoTexture); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingIndirectDiffuse.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingIndirectDiffuse.cs index 64f73436f9f..37820367711 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingIndirectDiffuse.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingIndirectDiffuse.cs @@ -17,7 +17,7 @@ public partial class HDRenderPipeline void InitRayTracedIndirectDiffuse() { - ComputeShader indirectDiffuseShaderCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.indirectDiffuseRaytracingCS; + ComputeShader indirectDiffuseShaderCS = m_GlobalSettings.renderPipelineRayTracingResources.indirectDiffuseRaytracingCS; // Grab all the kernels we shall be using m_RaytracingIndirectDiffuseFullResKernel = indirectDiffuseShaderCS.FindKernel("RaytracingIndirectDiffuseFullRes"); @@ -69,9 +69,9 @@ DeferredLightingRTParameters PrepareIndirectDiffuseDeferredLightingRTParameters( deferredParameters.lightCluster = RequestLightCluster(); // Shaders - deferredParameters.gBufferRaytracingRT = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.gBufferRaytracingRT; - deferredParameters.deferredRaytracingCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.deferredRaytracingCS; - deferredParameters.rayBinningCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.rayBinningCS; + deferredParameters.gBufferRaytracingRT = m_GlobalSettings.renderPipelineRayTracingResources.gBufferRaytracingRT; + deferredParameters.deferredRaytracingCS = m_GlobalSettings.renderPipelineRayTracingResources.deferredRaytracingCS; + deferredParameters.rayBinningCS = m_GlobalSettings.renderPipelineRayTracingResources.rayBinningCS; // XRTODO: add ray binning support for single-pass if (deferredParameters.viewCount > 1 && deferredParameters.rayBinning) @@ -127,7 +127,7 @@ TextureHandle DirGenRTGI(RenderGraph renderGraph, HDCamera hdCamera, GlobalIllum passData.fullResolution = settings.fullResolution; // Grab the right kernel - passData.directionGenCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.indirectDiffuseRaytracingCS; + passData.directionGenCS = m_GlobalSettings.renderPipelineRayTracingResources.indirectDiffuseRaytracingCS; passData.dirGenKernel = settings.fullResolution ? m_RaytracingIndirectDiffuseFullResKernel : m_RaytracingIndirectDiffuseHalfResKernel; // Grab the additional parameters @@ -213,7 +213,7 @@ TextureHandle UpscaleRTGI(RenderGraph renderGraph, HDCamera hdCamera, GlobalIllu passData.upscaleRadius = settings.upscaleRadius; // Grab the right kernel - passData.upscaleCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.indirectDiffuseRaytracingCS; + passData.upscaleCS = m_GlobalSettings.renderPipelineRayTracingResources.indirectDiffuseRaytracingCS; passData.upscaleKernel = settings.fullResolution ? m_IndirectDiffuseUpscaleFullResKernel : m_IndirectDiffuseUpscaleHalfResKernel; // Grab the additional parameters @@ -287,7 +287,7 @@ TextureHandle AdjustRTGIWeight(RenderGraph renderGraph, HDCamera hdCamera, Textu passData.viewCount = hdCamera.viewCount; // Grab the right kernel - passData.adjustWeightCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.indirectDiffuseRaytracingCS; + passData.adjustWeightCS = m_GlobalSettings.renderPipelineRayTracingResources.indirectDiffuseRaytracingCS; passData.adjustWeightKernel = m_AdjustIndirectDiffuseWeightKernel; passData.depthPyramid = builder.ReadTexture(depthPyramid); @@ -405,7 +405,7 @@ TextureHandle QualityRTGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHan passData.lodBias = settings.textureLodBias.value; // Grab the additional parameters - passData.indirectDiffuseRT = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.indirectDiffuseRaytracingRT; + passData.indirectDiffuseRT = m_GlobalSettings.renderPipelineRayTracingResources.indirectDiffuseRaytracingRT; passData.accelerationStructure = RequestAccelerationStructure(); passData.lightCluster = RequestLightCluster(); passData.skyTexture = m_SkyManager.GetSkyReflection(hdCamera); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingRecursiveRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingRecursiveRenderer.cs index 5ced492a505..5e4fbe00706 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingRecursiveRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingRecursiveRenderer.cs @@ -109,7 +109,7 @@ TextureHandle RaytracingRecursiveRender(RenderGraph renderGraph, HDCamera hdCame // Other data passData.accelerationStructure = RequestAccelerationStructure(); passData.lightCluster = RequestLightCluster(); - passData.recursiveRenderingRT = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.forwardRaytracing; + passData.recursiveRenderingRT = m_GlobalSettings.renderPipelineRayTracingResources.forwardRaytracing; passData.skyTexture = m_SkyManager.GetSkyReflection(hdCamera); passData.shaderVariablesRayTracingCB = m_ShaderVariablesRayTracingCB; passData.ditheredTextureSet = GetBlueNoiseManager().DitheredTextureSet8SPP(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingReflection.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingReflection.cs index a6d79d5519f..67140fd8356 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingReflection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingReflection.cs @@ -23,8 +23,8 @@ public partial class HDRenderPipeline void InitRayTracedReflections() { - ComputeShader reflectionShaderCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.reflectionRaytracingCS; - ComputeShader reflectionBilateralFilterCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.reflectionBilateralFilterCS; + ComputeShader reflectionShaderCS = m_GlobalSettings.renderPipelineRayTracingResources.reflectionRaytracingCS; + ComputeShader reflectionBilateralFilterCS = m_GlobalSettings.renderPipelineRayTracingResources.reflectionBilateralFilterCS; // Grab all the kernels we shall be using m_RaytracingReflectionsFullResKernel = reflectionShaderCS.FindKernel("RaytracingReflectionsFullRes"); @@ -93,7 +93,7 @@ TextureHandle DirGenRTR(RenderGraph renderGraph, HDCamera hdCamera, ScreenSpaceR passData.minSmoothness = settings.minSmoothness; // Grab the right kernel - passData.directionGenCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.reflectionRaytracingCS; + passData.directionGenCS = m_GlobalSettings.renderPipelineRayTracingResources.reflectionRaytracingCS; if (settings.fullResolution) passData.dirGenKernel = transparent ? m_RaytracingReflectionsTransparentFullResKernel : m_RaytracingReflectionsFullResKernel; else @@ -187,7 +187,7 @@ TextureHandle AdjustWeightRTR(RenderGraph renderGraph, HDCamera hdCamera, Screen passData.smoothnessFadeStart = settings.smoothnessFadeStart; // Other parameters - passData.reflectionFilterCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.reflectionBilateralFilterCS; + passData.reflectionFilterCS = m_GlobalSettings.renderPipelineRayTracingResources.reflectionBilateralFilterCS; passData.adjustWeightKernel = settings.fullResolution ? m_ReflectionAdjustWeightKernel : m_ReflectionRescaleAndAdjustWeightKernel; passData.shaderVariablesRayTracingCB = m_ShaderVariablesRayTracingCB; @@ -258,7 +258,7 @@ TextureHandle UpscaleRTR(RenderGraph renderGraph, HDCamera hdCamera, TextureHand passData.texWidth = hdCamera.actualWidth; passData.texHeight = hdCamera.actualHeight; passData.viewCount = hdCamera.viewCount; - passData.reflectionFilterCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.reflectionBilateralFilterCS; + passData.reflectionFilterCS = m_GlobalSettings.renderPipelineRayTracingResources.reflectionBilateralFilterCS; passData.upscaleKernel = m_ReflectionUpscaleKernel; passData.depthStencilBuffer = builder.ReadTexture(depthPyramid); @@ -326,9 +326,9 @@ DeferredLightingRTParameters PrepareReflectionDeferredLightingRTParameters(HDCam deferredParameters.lightCluster = RequestLightCluster(); // Shaders - deferredParameters.gBufferRaytracingRT = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.gBufferRaytracingRT; - deferredParameters.deferredRaytracingCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.deferredRaytracingCS; - deferredParameters.rayBinningCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.rayBinningCS; + deferredParameters.gBufferRaytracingRT = m_GlobalSettings.renderPipelineRayTracingResources.gBufferRaytracingRT; + deferredParameters.deferredRaytracingCS = m_GlobalSettings.renderPipelineRayTracingResources.deferredRaytracingCS; + deferredParameters.rayBinningCS = m_GlobalSettings.renderPipelineRayTracingResources.rayBinningCS; // XRTODO: add ray binning support for single-pass if (deferredParameters.viewCount > 1 && deferredParameters.rayBinning) @@ -445,7 +445,7 @@ TextureHandle QualityRTR(RenderGraph renderGraph, HDCamera hdCamera, ScreenSpace passData.ditheredTextureSet = GetBlueNoiseManager().DitheredTextureSet8SPP(); passData.shaderVariablesRayTracingCB = m_ShaderVariablesRayTracingCB; passData.skyTexture = m_SkyManager.GetSkyReflection(hdCamera); - passData.reflectionShader = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.reflectionRaytracingRT; + passData.reflectionShader = m_GlobalSettings.renderPipelineRayTracingResources.reflectionRaytracingRT; passData.depthBuffer = builder.ReadTexture(depthPyramid); passData.stencilBuffer = builder.ReadTexture(stencilBuffer); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingSubsurfaceScattering.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingSubsurfaceScattering.cs index 6a1f930d6dd..fe2f5770d46 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingSubsurfaceScattering.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingSubsurfaceScattering.cs @@ -25,8 +25,8 @@ static RTHandle SubSurfaceHistoryBufferAllocatorFunction(string viewName, int fr void InitializeSubsurfaceScatteringRT() { - ComputeShader rayTracingSubSurfaceCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.subSurfaceRayTracingCS; - ComputeShader deferredRayTracingCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.deferredRaytracingCS; + ComputeShader rayTracingSubSurfaceCS = m_GlobalSettings.renderPipelineRayTracingResources.subSurfaceRayTracingCS; + ComputeShader deferredRayTracingCS = m_GlobalSettings.renderPipelineRayTracingResources.deferredRaytracingCS; m_SSSClearTextureKernel = rayTracingSubSurfaceCS.FindKernel("ClearTexture"); m_RaytracingDiffuseDeferredKernel = deferredRayTracingCS.FindKernel("RaytracingDiffuseDeferred"); @@ -99,9 +99,9 @@ TextureHandle TraceRTSSS(RenderGraph renderGraph, HDCamera hdCamera, TextureHand passData.rtDeferredLightingKernel = m_RaytracingDiffuseDeferredKernel; // other required parameters - passData.rayTracingSubSurfaceRT = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.subSurfaceRayTracingRT; - passData.rayTracingSubSurfaceCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.subSurfaceRayTracingCS; - passData.deferredRayTracingCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.deferredRaytracingCS; + passData.rayTracingSubSurfaceRT = m_GlobalSettings.renderPipelineRayTracingResources.subSurfaceRayTracingRT; + passData.rayTracingSubSurfaceCS = m_GlobalSettings.renderPipelineRayTracingResources.subSurfaceRayTracingCS; + passData.deferredRayTracingCS = m_GlobalSettings.renderPipelineRayTracingResources.deferredRaytracingCS; passData.accelerationStructure = RequestAccelerationStructure(); passData.lightCluster = RequestLightCluster(); passData.shaderVariablesRayTracingCB = m_ShaderVariablesRayTracingCB; @@ -244,7 +244,7 @@ TextureHandle CombineRTSSS(RenderGraph renderGraph, HDCamera hdCamera, TextureHa passData.combineSSSKernel = passData.validSSGI ? m_CombineSubSurfaceWithGIKernel : m_CombineSubSurfaceKernel; // Other parameters - passData.rayTracingSubSurfaceCS = HDRenderPipelineGlobalSettings.instance.renderPipelineRayTracingResources.subSurfaceRayTracingCS; + passData.rayTracingSubSurfaceCS = m_GlobalSettings.renderPipelineRayTracingResources.subSurfaceRayTracingCS; passData.combineLightingMat = m_CombineLightingPass; passData.depthStencilBuffer = builder.UseDepthBuffer(depthStencilBuffer, DepthAccess.Read); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.cs index 7d7ca2a1604..cb1ae277836 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.cs @@ -47,13 +47,13 @@ public static class CustomPassUtils internal static void Initialize() { - customPassUtilsMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipeline.defaultAsset.renderPipelineResources.shaders.customPassUtils); + customPassUtilsMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.customPassUtils); downSamplePassIndex = customPassUtilsMaterial.FindPass("Downsample"); verticalBlurPassIndex = customPassUtilsMaterial.FindPass("VerticalBlur"); horizontalBlurPassIndex = customPassUtilsMaterial.FindPass("HorizontalBlur"); copyPassIndex = customPassUtilsMaterial.FindPass("Copy"); - customPassRenderersUtilsMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipeline.defaultAsset.renderPipelineResources.shaders.customPassRenderersUtils); + customPassRenderersUtilsMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.customPassRenderersUtils); depthToColorPassIndex = customPassRenderersUtilsMaterial.FindPass("DepthToColorPass"); depthPassIndex = customPassRenderersUtilsMaterial.FindPass("DepthPass"); normalToColorPassIndex = customPassRenderersUtilsMaterial.FindPass("NormalToColorPass"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs index 3e9ab483320..f07e54d10f4 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs @@ -133,7 +133,7 @@ public enum FrameSettingsField [FrameSettingsField(0, autoName: CustomPass, customOrderInGroup: 11, tooltip: "When enabled, HDRP renders custom passes contained in CustomPassVolume components.")] CustomPass = 6, /// When enabled, HDRP can use virtual texturing. - [FrameSettingsField(0, autoName: VirtualTexturing, customOrderInGroup: 105, tooltip: "When enabled, HDRP can use virtual texturing.")] + [FrameSettingsField(0, autoName: VirtualTexturing, customOrderInGroup: 105, tooltip: "Virtual Texturing needs to be enabled first in Project Settings > Player > Other Settings > Virtual Texturing.")] VirtualTexturing = 68, /// When enabled, HDRP processes a motion vector pass for Cameras using these Frame Settings. @@ -163,7 +163,7 @@ public enum FrameSettingsField [FrameSettingsField(0, displayedName: "Post-process", customOrderInGroup: 18, tooltip: "When enabled, HDRP processes a post-processing render pass for Cameras using these Frame Settings.")] Postprocess = 15, /// When enabled, HDRP render user written post processes. - [FrameSettingsField(0, displayedName: "Custom Post-process", positiveDependencies: new[] { Postprocess }, customOrderInGroup: 19, tooltip: "When enabled, HDRP render user written post processes.")] + [FrameSettingsField(0, displayedName: "Custom Post-process", positiveDependencies: new[] { Postprocess }, customOrderInGroup: 19, tooltip: "When enabled on a Camera, HDRP render user written post processes.")] CustomPostProcess = 39, /// When enabled, HDRP replace NaN values with black pixels for Cameras using these Frame Settings. [FrameSettingsField(0, displayedName: "Stop NaN", positiveDependencies: new[] { Postprocess }, customOrderInGroup: 19, tooltip: "When enabled, HDRP replace NaN values with black pixels for Cameras using these Frame Settings.")] @@ -840,6 +840,10 @@ internal static void Sanitize(ref FrameSettings sanitizedFrameSettings, Camera c sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.SubsurfaceScattering] &= sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.OpaqueObjects]; + +#if !ENABLE_VIRTUALTEXTURES + sanitizedFrameSettings.bitDatas[(int)FrameSettingsField.VirtualTexturing] = false; +#endif } /// Aggregation is default with override of the renderer then sanitized depending on supported features of hdrpasset. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayer.cs index ec2ad78255e..93b2496cb23 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayer.cs @@ -333,9 +333,9 @@ public override int GetHashCode() /// static void Init() { - var asset = HDRenderPipelineGlobalSettings.instance; - if (asset != null) - CloudMap.s_DefaultTexture = asset.renderPipelineResources?.textures.defaultCloudMap; + var globalSettings = HDRenderPipelineGlobalSettings.instance; + if (globalSettings != null) + CloudMap.s_DefaultTexture = globalSettings.renderPipelineResources?.textures.defaultCloudMap; } } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayerRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayerRenderer.cs index f17b90ad83c..941da8cda07 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayerRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudSystem/CloudLayer/CloudLayerRenderer.cs @@ -29,13 +29,13 @@ public CloudLayerRenderer() public override void Build() { - var hdrp = HDRenderPipeline.defaultAsset; - m_CloudLayerMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.shaders.cloudLayerPS); + var globalSettings = HDRenderPipelineGlobalSettings.instance; + m_CloudLayerMaterial = CoreUtils.CreateEngineMaterial(globalSettings.renderPipelineResources.shaders.cloudLayerPS); - s_BakeCloudTextureCS = hdrp.renderPipelineResources.shaders.bakeCloudTextureCS; + s_BakeCloudTextureCS = globalSettings.renderPipelineResources.shaders.bakeCloudTextureCS; s_BakeCloudTextureKernel = s_BakeCloudTextureCS.FindKernel("BakeCloudTexture"); - s_BakeCloudShadowsCS = hdrp.renderPipelineResources.shaders.bakeCloudShadowsCS; + s_BakeCloudShadowsCS = globalSettings.renderPipelineResources.shaders.bakeCloudShadowsCS; s_BakeCloudShadowsKernel = s_BakeCloudShadowsCS.FindKernel("BakeCloudShadows"); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs index 8d224f16b01..58fca2b85fa 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs @@ -17,8 +17,7 @@ public GradientSkyRenderer() public override void Build() { - var hdrp = HDRenderPipeline.defaultAsset; - m_GradientSkyMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.shaders.gradientSkyPS); + m_GradientSkyMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.gradientSkyPS); } public override void Cleanup() diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs index be6fa2d32d6..07a85bfcde0 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs @@ -23,8 +23,7 @@ public HDRISkyRenderer() public override void Build() { - var hdrp = HDRenderPipeline.defaultAsset; - m_SkyHDRIMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.shaders.hdriSkyPS); + m_SkyHDRIMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.hdriSkyPS); } public override void Cleanup() diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs index 7dd17adf306..869e0e15db2 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs @@ -311,8 +311,7 @@ public PhysicallyBasedSkyRenderer() public override void Build() { - var hdrpAsset = HDRenderPipeline.currentAsset; - var hdrpResources = HDRenderPipeline.defaultAsset.renderPipelineResources; + var hdrpResources = HDRenderPipelineGlobalSettings.instance.renderPipelineResources; // Shaders s_GroundIrradiancePrecomputationCS = hdrpResources.shaders.groundIrradiancePrecomputationCS; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs index c84059f75e4..086c4d2116d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs @@ -304,8 +304,6 @@ internal HDRISky GetDefaultPreviewSkyInstance() public void Build(HDRenderPipelineAsset hdAsset, RenderPipelineResources defaultResources, IBLFilterBSDF[] iblFilterBSDFArray) { - var hdrp = HDRenderPipeline.defaultAsset; - m_Resolution = (int)hdAsset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyReflectionSize; m_IBLFilterArray = iblFilterBSDFArray; @@ -315,7 +313,7 @@ public void Build(HDRenderPipelineAsset hdAsset, RenderPipelineResources default m_OpaqueAtmScatteringMaterial = CoreUtils.CreateEngineMaterial(defaultResources.shaders.opaqueAtmosphericScatteringPS); m_OpaqueAtmScatteringBlock = new MaterialPropertyBlock(); - m_ComputeAmbientProbeCS = hdrp.renderPipelineResources.shaders.ambientProbeConvolutionCS; + m_ComputeAmbientProbeCS = HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.ambientProbeConvolutionCS; m_ComputeAmbientProbeKernel = m_ComputeAmbientProbeCS.FindKernel("AmbientProbeConvolution"); lightingOverrideVolumeStack = VolumeManager.instance.CreateStack(); @@ -1151,13 +1149,12 @@ public Texture2D ExportSkyToTexture(Camera camera) #if UNITY_EDITOR void OnBakeStarted() { - var hdrp = HDRenderPipeline.defaultAsset; - if (hdrp == null) + if (!HDRenderPipeline.isReady) return; // Happens sometime in the tests. if (m_StandardSkyboxMaterial == null) - m_StandardSkyboxMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.shaders.skyboxCubemapPS); + m_StandardSkyboxMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipelineGlobalSettings.instance.renderPipelineResources.shaders.skyboxCubemapPS); // It is possible that HDRP hasn't rendered any frame when clicking the bake lighting button. // This can happen when baked lighting debug are used for example and no other window with HDRP is visible.