From eb1c93ed5ac03d9e378de96b8efd1e94ee8fa54d Mon Sep 17 00:00:00 2001 From: Mateusz Antkiewicz Date: Thu, 20 Jul 2023 22:01:51 +0200 Subject: [PATCH] SSAO optimisations and depth prepass fix. --- Shaders/Depth.spv | Bin 3192 -> 3272 bytes Shaders/Depth.vert | 3 ++- Shaders/SSAO.frag | 13 +++++++----- Shaders/SSAO.spv | Bin 12776 -> 12700 bytes Source/Core/Eruption.cpp | 15 ++++---------- Source/Editor/UIPanels/SettingsPanel.cpp | 2 -- Source/Renderer/Renderer.cpp | 14 ++++++------- Source/Renderer/Renderer.hpp | 8 ++++---- Source/Renderer/Swapchain.cpp | 4 ++-- imgui.ini | 24 +++++++++++------------ 10 files changed, 39 insertions(+), 44 deletions(-) diff --git a/Shaders/Depth.spv b/Shaders/Depth.spv index 630e3abf9fd98325a22680269b610a07249aa7d8..c6aff9361a8eb6a0581d05f9c2501d06c25bbae9 100644 GIT binary patch literal 3272 zcmZve-EtH~6vvxvb`ydKC|@dsO#-5VQ4|nGU?G^rsz9Pk;pNsa+fYNz?rhC|xNwyR z@B*v6@WKl&d;lMT@=1IQZ>;kF>zUrPTQ+sJ&-tIvK7FP`Wo~W3n0@AeIcOTDSVzp9 z5F@PS_U2Y=Yke^6tY5zJDHd;zj7m@3#lT=c#R{Nzb-BNp9m|GPc+)26jm=PDh>4pelw;ro`@J>SWJ>`NNzUbmFir1_RhBkkgq;?}4^>iBI6?&#M(9=#vLi+vAe+hjwh@*~e_0weN z8&}NDlCwFmXS10r)u>CD?;~Av8LQ|kvscENP9Jwl9}c1`>TJbPTHa~V3uds?-AST> zYAf#Iknk4|Y?N#F*kQ0u2Tidf!X}&9Slbk1mY#RS~o2Lh5T3H?=J{Y^lhyg||9)kyCp2*uAXm z+3^j4{Ssij31Ghl7;^{qTY&Kt{JwTUN^7(g?v&|Cs#HOrPn`4ejK_AN!ly(Sc)+%)EnLRaETgC5yO!3n3S_%r$Qcxo!((W{!)PBj)gi zY`BXPBJkV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v;1=tm_S6jyHjDMK_Sk+=EMk8mX-dH1 zP@78<>hirf-0$-e(^6qylo)q2-sKYGo?EIKb-NK`?KO=yDH&)INXhTUz70O Rk@q*M5<0wpRmE$P{{X9^0=WPH diff --git a/Shaders/Depth.vert b/Shaders/Depth.vert index 534dc1b..3f1cd19 100644 --- a/Shaders/Depth.vert +++ b/Shaders/Depth.vert @@ -20,5 +20,6 @@ layout(push_constant) uniform ModelMatrixID { void main() { - gl_Position = camera.projView * modelMatrix[modelMatrixID] * vec4(vPosition, 1.0); + vec4 vWorldSpace = modelMatrix[modelMatrixID] * vec4(vPosition, 1.0); + gl_Position = camera.projView * vWorldSpace; } \ No newline at end of file diff --git a/Shaders/SSAO.frag b/Shaders/SSAO.frag index 9695e31..dea53b7 100644 --- a/Shaders/SSAO.frag +++ b/Shaders/SSAO.frag @@ -72,7 +72,7 @@ float LinearDepth(float d) } void main() { - vec2 noiseScale = vec2(params.screenWidth/params.noiseScale, params.screenHeight/params.noiseScale); + vec2 noiseScale = vec2(params.screenWidth, params.screenHeight) / params.noiseScale; vec3 viewPos = GetViewPosition(fTexcoord); vec3 viewNormal = normalize(cross(dFdx(viewPos.xyz), dFdy(viewPos.xyz))); @@ -92,12 +92,15 @@ void main() vec3 samplePos = TBN * kernels[i]; samplePos = viewPos + samplePos * params.radius; - vec4 offset = vec4(samplePos, 1.0); - offset = camera.proj * offset; - offset.xy /= offset.w; + // Faster and shorter form of: + //vec4 offset = camera.proj * vec4(samplePos, 1.0); + //offset.xyz /= offset.w; - float sampleDepth = GetViewZ(offset.xy * 0.5 + 0.5); + vec2 offsetXY = vec2(camera.proj[0][0] * samplePos.x, camera.proj[1][1] * samplePos.y); + offsetXY /= camera.proj[2][3] * samplePos.z; + float sampleDepth = GetViewZ(offsetXY * 0.5 + 0.5); + float rangeCheck = smoothstep(0.0, 1.0, params.radius / abs(viewPos.z - sampleDepth)); occlusion += (sampleDepth >= samplePos.z + params.bias ? 1.0 : 0.0) * rangeCheck * params.multi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5qoz24|D98D*ylh diff --git a/Source/Core/Eruption.cpp b/Source/Core/Eruption.cpp index 1fea129..1a9bb8a 100644 --- a/Source/Core/Eruption.cpp +++ b/Source/Core/Eruption.cpp @@ -51,12 +51,6 @@ void Eruption::Update() if (m_Input->IsKey(en::Key::LShift) && m_Input->IsKey(en::Key::R, en::InputState::Pressed)) m_Renderer->ReloadBackend(); - else if (m_Input->IsKey(en::Key::Y, en::InputState::Pressed)) - { - m_Renderer->SetVSyncEnabled(false); - //m_Renderer->m_PostProcessParams.antialiasingMode = en::Renderer::AntialiasingMode::None; - } - double deltaTime = m_Renderer->GetFrameTime(); static float targetYaw = m_Camera->m_Yaw; @@ -103,9 +97,9 @@ void Eruption::Render() m_Renderer->Render(); } - void Eruption::CreateExampleScene() { + /* m_AssetManager->LoadMesh("SkullModel", "Models/Skull/Skull.gltf"); m_AssetManager->LoadTexture("SkullAlbedo", "Models/Skull/SkullAlbedo.jpg"); @@ -117,9 +111,9 @@ void Eruption::CreateExampleScene() m_AssetManager->GetMesh("SkullModel")->m_SubMeshes[0].SetMaterial(m_AssetManager->GetMaterial("SkullMaterial")); m_AssetManager->LoadMesh("Sponza", "Models/Sponza/Sponza.gltf"); - + */ m_ExampleScene = en::MakeHandle(); - + /* auto m_Sponza = m_ExampleScene->CreateSceneObject("Sponza", m_AssetManager->GetMesh("Sponza")); m_Sponza->SetScale(glm::vec3(1.2f)); @@ -130,7 +124,7 @@ void Eruption::CreateExampleScene() auto m_Skull = m_ExampleScene->CreateSceneObject("SkullModel", m_AssetManager->GetMesh("SkullModel")); m_Skull->SetPosition(glm::vec3(0, 0.5f, -0.3)); m_Skull->SetRotation(glm::vec3(45.0f, 90.0f, 0.0f)); - + */ @@ -160,7 +154,6 @@ void Eruption::CreateExampleScene() m_Renderer->BindScene(m_ExampleScene); } - void Eruption::Run() { Init(); diff --git a/Source/Editor/UIPanels/SettingsPanel.cpp b/Source/Editor/UIPanels/SettingsPanel.cpp index 227aedd..2046db1 100644 --- a/Source/Editor/UIPanels/SettingsPanel.cpp +++ b/Source/Editor/UIPanels/SettingsPanel.cpp @@ -89,8 +89,6 @@ namespace en ImGui::DragFloat("SSAO Bias", &ssao.bias, 0.05f, 0.0f, 1.0f), "%.2f", ImGuiSliderFlags_AlwaysClamp; ImGui::DragFloat("SSAO Radius", &ssao.radius, 0.1f, 0.0f, 5.0f, "%.1f", ImGuiSliderFlags_AlwaysClamp); ImGui::DragFloat("SSAO Multiplier", &ssao.multiplier, 0.1f, 0.0f, 5.0f, "%.1f", ImGuiSliderFlags_AlwaysClamp); - ImGui::DragFloat("ssao_noise_scale", &ssao._noiseScale, 0.1f, 1.0f, 8.0f, "%.1f", ImGuiSliderFlags_AlwaysClamp); - ImGui::DragInt("ssao_samples", &s, 1.0f, 1.0f, 64.0f, "%.1f", ImGuiSliderFlags_AlwaysClamp); break; diff --git a/Source/Renderer/Renderer.cpp b/Source/Renderer/Renderer.cpp index c2a4226..2022882 100644 --- a/Source/Renderer/Renderer.cpp +++ b/Source/Renderer/Renderer.cpp @@ -436,16 +436,16 @@ namespace en switch (m_Settings.ambientOcclusionQuality) { case QualityLevel::Low: - m_Settings.ambientOcclusion._samples = 16U; - m_Settings.ambientOcclusion._noiseScale = 4.0f; + m_Settings.ambientOcclusion._samples = 8U; + m_Settings.ambientOcclusion._noiseScale = 2.0f; break; case QualityLevel::Medium: - m_Settings.ambientOcclusion._samples = 32U; - m_Settings.ambientOcclusion._noiseScale = 4.0f; + m_Settings.ambientOcclusion._samples = 16U; + m_Settings.ambientOcclusion._noiseScale = 2.0f; break; case QualityLevel::High: - m_Settings.ambientOcclusion._samples = 32U; - m_Settings.ambientOcclusion._noiseScale = 2.0f; + m_Settings.ambientOcclusion._samples = 16U; + m_Settings.ambientOcclusion._noiseScale = 1.0f; break; case QualityLevel::Ultra: m_Settings.ambientOcclusion._samples = 32U; @@ -1239,7 +1239,7 @@ namespace en .enableDepthWrite = !m_Settings.depthPrePass, .blendEnable = false, - .compareOp = m_Settings.depthPrePass ? VK_COMPARE_OP_LESS_OR_EQUAL : VK_COMPARE_OP_LESS, + .compareOp = m_Settings.depthPrePass ? VK_COMPARE_OP_EQUAL : VK_COMPARE_OP_LESS, .polygonMode = VK_POLYGON_MODE_FILL, }; diff --git a/Source/Renderer/Renderer.hpp b/Source/Renderer/Renderer.hpp index 4555743..8cfa729 100644 --- a/Source/Renderer/Renderer.hpp +++ b/Source/Renderer/Renderer.hpp @@ -80,12 +80,12 @@ namespace en float screenWidth = 1920.0f; float screenHeight = 1080.0f; - float radius = 0.85f; + float radius = 0.75f; float bias = 0.025f; - float multiplier = 1.2f; + float multiplier = 1.0f; - uint32_t _samples = 64U; - float _noiseScale = 4.0f; + uint32_t _samples = 16U; + float _noiseScale = 2.0f; }; void SetVSyncEnabled(const bool enabled); diff --git a/Source/Renderer/Swapchain.cpp b/Source/Renderer/Swapchain.cpp index 1bb5131..68235c5 100644 --- a/Source/Renderer/Swapchain.cpp +++ b/Source/Renderer/Swapchain.cpp @@ -27,7 +27,7 @@ namespace en .imageColorSpace = surfaceFormat.colorSpace, .imageExtent = extent, .imageArrayLayers = 1U, - .imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, + .imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, .preTransform = swapChainSupport.capabilities.currentTransform, .compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, .presentMode = presentMode, @@ -80,7 +80,7 @@ namespace en { UseContext(); - for (auto& imageView : m_ImageViews) + for (const auto& imageView : m_ImageViews) vkDestroyImageView(ctx.m_LogicalDevice, imageView, nullptr); vkDestroySwapchainKHR(ctx.m_LogicalDevice, m_Swapchain, nullptr); diff --git a/imgui.ini b/imgui.ini index 4bdc090..45d530c 100644 --- a/imgui.ini +++ b/imgui.ini @@ -1,6 +1,6 @@ [Window][DockSpace Demo] Pos=0,33 -Size=2560,1336 +Size=1920,1047 Collapsed=0 [Window][Debug##Default] @@ -9,14 +9,14 @@ Size=400,400 Collapsed=0 [Window][Asset Manager] -Pos=273,732 -Size=1400,348 +Pos=273,1021 +Size=2287,348 Collapsed=0 DockId=0x00000008,0 [Window][Camera Properties] -Pos=0,909 -Size=271,460 +Pos=0,720 +Size=271,360 Collapsed=0 DockId=0x00000004,0 @@ -26,19 +26,19 @@ Size=405,428 Collapsed=0 [Window][Debug Menu] -Pos=1683,398 +Pos=1387,230 Size=322,194 Collapsed=0 [Window][Scene Hierarchy] Pos=0,33 -Size=271,874 +Size=271,685 Collapsed=0 DockId=0x00000003,0 [Window][Inspector] -Pos=2315,33 -Size=245,1336 +Pos=1675,33 +Size=245,1047 Collapsed=0 DockId=0x00000006,0 @@ -58,12 +58,12 @@ Size=409,172 Collapsed=0 [Window][Settings] -Pos=1621,648 -Size=500,449 +Pos=1441,546 +Size=500,504 Collapsed=0 [Docking][Data] -DockSpace ID=0x1315676B Window=0x4647B76E Pos=0,33 Size=2560,1336 Split=X +DockSpace ID=0x1315676B Window=0x4647B76E Pos=0,33 Size=1920,1047 Split=X DockNode ID=0x00000005 Parent=0x1315676B SizeRef=1673,1047 Split=X DockNode ID=0x00000001 Parent=0x00000005 SizeRef=271,1047 Split=Y Selected=0x2E9237F7 DockNode ID=0x00000003 Parent=0x00000001 SizeRef=499,496 Selected=0x2E9237F7