From 93a5385cb03482d09108edef1433a9f470bf1e4a Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sun, 5 Dec 2021 04:26:50 +0500 Subject: Added SSAO blur --- src/RenderConfigs.cpp | 20 +++++++++++++++++++- src/RenderConfigs.hpp | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/RenderConfigs.cpp b/src/RenderConfigs.cpp index d185c79..88166a5 100644 --- a/src/RenderConfigs.cpp +++ b/src/RenderConfigs.cpp @@ -155,6 +155,24 @@ Gbuffer::Gbuffer(size_t geomW, size_t geomH, size_t lightW, size_t lightH) { Gal::Format::R8G8B8A8, Gal::Filtering::Bilinear); + std::vector>> ssaoBlurTextures = { + {"blurInput", ssaoPass->GetResultTexture()}, + }; + + std::vector> ssaoBlurParameters = { + {"blurScale", Gal::Type::Int32}, + }; + + ssaoBlurPass = std::make_unique(LoadPixelShader("/altcraft/shaders/frag/blur"), + ssaoBlurTextures, + ssaoBlurParameters, + lightW, + lightH, + Gal::Format::R8G8B8A8, + Gal::Filtering::Bilinear); + + ssaoBlurPass->SetShaderParameter("blurScale", 2); + std::vector> lightingParameters = { {"renderBuff", Gal::Type::Int32}, }; @@ -166,7 +184,7 @@ Gbuffer::Gbuffer(size_t geomW, size_t geomH, size_t lightW, size_t lightH) { {"worldPos", worldPos}, {"addColor", addColor}, {"light", light}, - {"ssao", ssaoPass->GetResultTexture()}, + {"ssao", ssaoBlurPass->GetResultTexture()}, }; lightingPass = std::make_unique(LoadPixelShader("/altcraft/shaders/frag/light"), diff --git a/src/RenderConfigs.hpp b/src/RenderConfigs.hpp index ef4c97d..0667bbe 100644 --- a/src/RenderConfigs.hpp +++ b/src/RenderConfigs.hpp @@ -62,6 +62,7 @@ public: class Gbuffer { std::shared_ptr ssaoNoise; std::unique_ptr ssaoPass; + std::unique_ptr ssaoBlurPass; std::unique_ptr lightingPass; std::shared_ptr depthStencil; std::shared_ptr color; //RGB - color @@ -84,12 +85,14 @@ public: void Render() { ssaoPass->Render(); + ssaoBlurPass->Render(); lightingPass->Render(); } void Clear() { geomFramebuffer->Clear(); ssaoPass->Clear(); + ssaoBlurPass->Clear(); lightingPass->Clear(); } -- cgit v1.2.3