From d9073274a3a2b2291d83c5943eb99f96d36d2d83 Mon Sep 17 00:00:00 2001 From: Remi Chapelain Date: Thu, 26 Aug 2021 18:10:03 +0200 Subject: [PATCH 1/6] Adding check to wizard --- .../RenderPipeline/HDRenderPipelineMenuItems.cs | 2 +- .../Editor/Wizard/HDWizard.Configuration.cs | 13 ++++++++++++- .../Editor/Wizard/HDWizard.Window.cs | 12 ++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs index 386c79e5a18..f3d7c3344ce 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs @@ -471,7 +471,7 @@ public void LogException(Exception exception, UnityObject context) } [MenuItem("Edit/Rendering/Check Scene Content for HDRP Ray Tracing", priority = CoreUtils.Sections.section2 + CoreUtils.Priorities.editMenuPriority + 3)] - static void CheckSceneContentForRayTracing(MenuCommand menuCommand) + static internal void CheckSceneContentForRayTracing(MenuCommand menuCommand) { // Flag that holds bool generalErrorFlag = false; 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 f909ee55b65..90cc45440a8 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 @@ -22,7 +22,7 @@ enum InclusiveMode DXROptional = DXR | 1 << 4, } - enum QualityScope { Global, CurrentQuality } + enum QualityScope { Global, CurrentQuality, Scene } static class InclusiveScopeExtention { @@ -221,6 +221,7 @@ Entry[] BuildEntryList() new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrTransparentReflectionsFS, IsDXRTransparentReflectionsFSCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: false), new Entry(QualityScope.CurrentQuality, InclusiveMode.DXROptional, Style.dxrGI, IsDXRGICorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: true), new Entry(QualityScope.Global, InclusiveMode.DXROptional, Style.dxrGIFS, IsDXRGIFSCorrect, null, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: false), + new Entry(QualityScope.Scene, InclusiveMode.DXROptional, Style.checkForRTX, CheckForRTX, CheckSceneContentForRayTracing, forceDisplayCheck: true, skipErrorIcon: true, displayAssetName: false), }); return entryList.ToArray(); @@ -858,6 +859,11 @@ bool IsDXRGIFSCorrect() return defaultCameraFS.IsEnabled(FrameSettingsField.SSGI); } + bool CheckForRTX() + { + return false; + } + bool IsValidBuildTarget() { return (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64) @@ -894,6 +900,11 @@ void FixDXRActivation(bool fromAsyncUnused) serializedObject.ApplyModifiedPropertiesWithoutUndo(); } + void CheckSceneContentForRayTracing(bool fromAsyncUnused) + { + HDRenderPipelineMenuItems.CheckSceneContentForRayTracing(null); + } + #endregion #region Package Manager diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs index 4e87e7fbdf8..ac045f1c3f2 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs @@ -35,6 +35,7 @@ static class Style public static readonly string installConfigPackageInfoInProgress = L10n.Tr("The config package is being embedded in your project."); public static readonly string installConfigPackageInfoFinished = L10n.Tr("The config package is already embedded in your project."); + public static readonly string checkSceneRtxButton = L10n.Tr("Check Scene Content For Ray Tracing Issues"); public static readonly string migrateAllButton = L10n.Tr("Convert All Built-in Materials to HDRP"); public static readonly string migrateSelectedButton = L10n.Tr("Convert Selected Built-in Materials to HDRP"); public static readonly string migrateMaterials = L10n.Tr("Upgrade HDRP Materials to Latest Version"); @@ -47,7 +48,9 @@ static class Style //configuration debugger public static readonly string global = L10n.Tr("Global"); public static readonly string currentQuality = L10n.Tr("Current Quality"); + public static readonly string currentScene = L10n.Tr("Current Scene"); + public static readonly string check = L10n.Tr("Check"); public static readonly string resolve = L10n.Tr("Fix"); public static readonly string resolveAll = L10n.Tr("Fix All"); public static readonly string resolveAllQuality = L10n.Tr("Fix All Qualities"); @@ -199,6 +202,11 @@ public ConfigStyle(string label, string error, string button = null, MessageType public static readonly ConfigStyle dxrResources = new ConfigStyle( label: L10n.Tr("DXR resources"), error: L10n.Tr("There is an issue with the DXR resources! Alternatively, Direct3D is not set as API (can be fixed with option above) or your hardware and/or OS cannot be used for DXR! (unfixable)")); + public static readonly ConfigStyle checkForRTX = new ConfigStyle( + label: L10n.Tr("Check Scene Content For Ray Tracing Issues"), + error: L10n.Tr("This checks if any of the meshes in the current scene has null material, null mesh or mesh filters, more than 32 sub-meshes, both transparent and opaque sub-meshes, both double sided and single sided sub-meshes or missing renderer on LODs."), + button: Style.check, + messageType: MessageType.Info); public static readonly string hdrpAssetDisplayDialogTitle = L10n.Tr("Create or Load HDRenderPipelineAsset"); public static readonly string hdrpAssetDisplayDialogContent = L10n.Tr("Do you want to create a fresh HDRenderPipelineAsset in the default resource folder and automatically assign it?"); @@ -406,9 +414,11 @@ private void CreateGUI() ScopeBox globalScope = new ScopeBox(Style.global); ScopeBox currentQualityScope = new ScopeBox(Style.currentQuality); + ScopeBox currentSceneScope = new ScopeBox(Style.currentScene); m_BaseUpdatable.Add(globalScope); m_BaseUpdatable.Add(currentQualityScope); + m_BaseUpdatable.Add(currentSceneScope); AddHDRPConfigInfo(globalScope, QualityScope.Global); @@ -438,6 +448,8 @@ private void CreateGUI() dxrScopeCurrentQuality.Init(); currentQualityScope.Add(dxrScopeCurrentQuality); + AddDXRConfigInfo(currentSceneScope, QualityScope.Scene); + container.Add(CreateTitle(Style.migrationTitle)); container.Add(CreateLargeButton(Style.migrateAllButton, UpgradeStandardShaderMaterials.UpgradeMaterialsProject)); container.Add(CreateLargeButton(Style.migrateSelectedButton, UpgradeStandardShaderMaterials.UpgradeMaterialsSelection)); From 8dc796250e449c4bc9869b3518bbe3296d0476f1 Mon Sep 17 00:00:00 2001 From: Remi Chapelain Date: Fri, 27 Aug 2021 11:51:56 +0200 Subject: [PATCH 2/6] Show current scene only in DXR tab --- .../Editor/Wizard/HDWizard.Window.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs index ac045f1c3f2..802976e21be 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs @@ -203,8 +203,8 @@ public ConfigStyle(string label, string error, string button = null, MessageType label: L10n.Tr("DXR resources"), error: L10n.Tr("There is an issue with the DXR resources! Alternatively, Direct3D is not set as API (can be fixed with option above) or your hardware and/or OS cannot be used for DXR! (unfixable)")); public static readonly ConfigStyle checkForRTX = new ConfigStyle( - label: L10n.Tr("Check Scene Content For Ray Tracing Issues"), - error: L10n.Tr("This checks if any of the meshes in the current scene has null material, null mesh or mesh filters, more than 32 sub-meshes, both transparent and opaque sub-meshes, both double sided and single sided sub-meshes or missing renderer on LODs."), + label: L10n.Tr("Check Scene Content for HDRP Ray Tracing"), + error: L10n.Tr("Checks scene content for Ray Tracing issues. This includes checking if any Renderer has null Materials, null Meshes or Mesh Filters, more than 32 sub-Meshes in a Mesh, both Transparent and Opaque Materials in sub-Meshes, both Double-Sided and Single-Sided sub-Meshes or missing Renderers on LODs.\nResults will show in Console.\nThis check is also available in Edit > Rendering menu."), button: Style.check, messageType: MessageType.Info); @@ -418,7 +418,13 @@ private void CreateGUI() m_BaseUpdatable.Add(globalScope); m_BaseUpdatable.Add(currentQualityScope); - m_BaseUpdatable.Add(currentSceneScope); + + var addCurrentScene = new HiddableUpdatableContainer(() => m_Configuration == Configuration.HDRP_DXR); + addCurrentScene.Add(currentSceneScope); + addCurrentScene.Init(); + m_BaseUpdatable.Add(addCurrentScene); + + //m_BaseUpdatable.Add( ? currentSceneScope : null); AddHDRPConfigInfo(globalScope, QualityScope.Global); @@ -448,7 +454,11 @@ private void CreateGUI() dxrScopeCurrentQuality.Init(); currentQualityScope.Add(dxrScopeCurrentQuality); - AddDXRConfigInfo(currentSceneScope, QualityScope.Scene); + var dxrScopeCurrentScene = new HiddableUpdatableContainer(() + => m_Configuration == Configuration.HDRP_DXR); + AddDXRConfigInfo(dxrScopeCurrentScene, QualityScope.Scene); + dxrScopeCurrentScene.Init(); + currentSceneScope.Add(dxrScopeCurrentScene); container.Add(CreateTitle(Style.migrationTitle)); container.Add(CreateLargeButton(Style.migrateAllButton, UpgradeStandardShaderMaterials.UpgradeMaterialsProject)); From 073cce70152988bc79243b6864ce6333e13d6fa2 Mon Sep 17 00:00:00 2001 From: Remi Chapelain Date: Fri, 27 Aug 2021 13:49:04 +0200 Subject: [PATCH 3/6] Removing unused variable --- .../Editor/Wizard/HDWizard.Window.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs index 802976e21be..24535fb1300 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs @@ -35,7 +35,6 @@ static class Style public static readonly string installConfigPackageInfoInProgress = L10n.Tr("The config package is being embedded in your project."); public static readonly string installConfigPackageInfoFinished = L10n.Tr("The config package is already embedded in your project."); - public static readonly string checkSceneRtxButton = L10n.Tr("Check Scene Content For Ray Tracing Issues"); public static readonly string migrateAllButton = L10n.Tr("Convert All Built-in Materials to HDRP"); public static readonly string migrateSelectedButton = L10n.Tr("Convert Selected Built-in Materials to HDRP"); public static readonly string migrateMaterials = L10n.Tr("Upgrade HDRP Materials to Latest Version"); From da9178ea9d7d89771d719f5fe0b87e781ed1a46d Mon Sep 17 00:00:00 2001 From: Remi Chapelain Date: Fri, 27 Aug 2021 13:53:25 +0200 Subject: [PATCH 4/6] Changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 2f068d416b8..611d95a2257 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -85,6 +85,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added a parameter to control the vertical shape offset of the volumetric clouds (case 1358528). - Added an option to render screen space global illumination in half resolution to achieve real-time compatible performance in high resolutions (case 1353727). - Added a built-in custom pass to draw object IDs. +- Added a button in the HDRP+DXR Wizard to check scene content for Ray Tracing setup issues. ### Fixed - Fixed Intensity Multiplier not affecting realtime global illumination. From e51c64c790f1885f5e5a84fef4c26b1cc9a31784 Mon Sep 17 00:00:00 2001 From: Remi Chapelain Date: Fri, 27 Aug 2021 13:54:57 +0200 Subject: [PATCH 5/6] Remove commented line --- .../Editor/Wizard/HDWizard.Window.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs index 24535fb1300..7ed774114da 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs @@ -423,8 +423,6 @@ private void CreateGUI() addCurrentScene.Init(); m_BaseUpdatable.Add(addCurrentScene); - //m_BaseUpdatable.Add( ? currentSceneScope : null); - AddHDRPConfigInfo(globalScope, QualityScope.Global); var vrScopeGlobal = new HiddableUpdatableContainer(() From 3e7e75b93a9a8c01faad2c325fce5c15da27882f Mon Sep 17 00:00:00 2001 From: Remi Chapelain Date: Fri, 27 Aug 2021 13:56:21 +0200 Subject: [PATCH 6/6] Formatting --- .../Editor/Wizard/HDWizard.Window.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs index 7ed774114da..8bc4af77d38 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Window.cs @@ -418,7 +418,8 @@ private void CreateGUI() m_BaseUpdatable.Add(globalScope); m_BaseUpdatable.Add(currentQualityScope); - var addCurrentScene = new HiddableUpdatableContainer(() => m_Configuration == Configuration.HDRP_DXR); + var addCurrentScene = new HiddableUpdatableContainer( + () => m_Configuration == Configuration.HDRP_DXR); addCurrentScene.Add(currentSceneScope); addCurrentScene.Init(); m_BaseUpdatable.Add(addCurrentScene);