Started bloom pass

This commit is contained in:
antopilo
2025-01-16 01:02:03 -05:00
parent 333ea73d3a
commit cae58d8bf5
2 changed files with 41 additions and 0 deletions

View File

@@ -94,6 +94,22 @@ SceneRenderPipeline::SceneRenderPipeline()
TonemappedOutput = CreateRef<VulkanImage>(ImageFormat::RGBA8, defaultSize);
// Setup bloom targets
BloomOutput = CreateRef<VulkanImage>(ImageFormat::RGBA16F, defaultSize);
BloomThreshold = CreateRef<VulkanImage>(ImageFormat::RGBA16F, defaultSize);
//Vector2 currentSize;
//for (int i = 0; i < BloomIteration; i++)
//{
// Ref<VulkanImage> downSample = CreateRef<VulkanImage>(ImageFormat::RGBA16F, defaultSize);
// BloomDownSample.push_back(downSample);
//
// m_DownSampleFB.push_back(downSample);
// m_UpSampleFB.push_back(upSample);
// m_HBlurFB.push_back(hBlur);
// m_VBlurFB.push_back(vBlur);
//}
// Initialize pipeline
VkShaderManager& shaderMgr = VkShaderManager::Get();

View File

@@ -48,6 +48,18 @@ namespace Nuake
int SourceTextureID;
};
struct BloomConstant
{
int Stage;
int SourceTextureID;
int HasLensDirt;
int LensDirtTextureID;
float LensDirtIntensity;
float Threshold;
float BlurAmount;
int BlurDirection;
};
// This class handles all the rendering of the scene
class SceneRenderPipeline
{
@@ -65,9 +77,22 @@ namespace Nuake
Ref<VulkanImage> TonemappedOutput;
// Bloom
const int BloomIteration = 4;
const float DownsampleScale = 0.4f;
Ref<VulkanImage> BloomThreshold;
std::vector<Ref<VulkanImage>> BloomDownSample;
std::vector<Ref<VulkanImage>> BloomUpSample;
std::vector<Ref<VulkanImage>> BloomHBlur;
std::vector<Ref<VulkanImage>> BloomVBlur;
Ref<VulkanImage> BloomOutput;
// Push constant
GBufferConstant gbufferConstant;
ShadingConstant shadingConstant;
TonemapConstant tonemapConstant;
BloomConstant bloomConstant;
static RenderPipeline GBufferPipeline;
public: