Commit 32a354e7 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

Merge branch 'shadows' into 'master'

ENH: shadows, bloom, shader options

See merge request iMSTK/iMSTK!235
parents 3b4edf56 09c9504d
1bb1fc2e26993f1528b23b7aff5ca36b45ebfa9dbbaac906704fb446327f506eeb8208dbd165891c949e68fc2ee0519da2a20bd2f182413db7d5e3bee0c8c23f
45b101fee95153ce5f74d019b45f13639c1d4983c7d9972e16e3cceda9e2cefa505cd0a7572642bcbe66533d7a3bd984b01bd0918b403770980fe98372c8b84e
f67966d950f179347629b215213f0301ae5ca7fec72ce295b92c89f24938e2668343a2fb1de2ca30522779cf12f4bc10ef8755bdd1424c78282d4698dd2bb530
......@@ -47,6 +47,7 @@ list(APPEND FILE_LIST
decals/,REGEX:.*
head/,REGEX:.*
human/,REGEX:.*
IBL/,REGEX:.*
laptool/,REGEX:.*
liver/,REGEX:.*
nidus/,REGEX:.*
......@@ -83,6 +84,9 @@ if( iMSTK_USE_Vulkan )
compileShaders(Mesh/mesh_frag.frag Mesh/mesh_frag.spv)
compileShaders(Mesh/decal_vert.vert Mesh/decal_vert.spv)
compileShaders(Mesh/decal_frag.frag Mesh/decal_frag.spv)
compileShaders(Mesh/shadow_vert.vert Mesh/shadow_vert.spv)
compileShaders(Mesh/shadow_frag.frag Mesh/shadow_frag.spv)
compileShaders(Mesh/depth_frag.frag Mesh/depth_frag.spv)
# Post processing shaders
compileShaders(PostProcessing/HDR_tonemap_frag.frag PostProcessing/HDR_tonemap_frag.spv)
......@@ -94,6 +98,10 @@ if( iMSTK_USE_Vulkan )
compileShaders(PostProcessing/blur_horizontal_frag.frag PostProcessing/blur_horizontal_frag.spv)
compileShaders(PostProcessing/blur_vertical_frag.frag PostProcessing/blur_vertical_frag.spv)
compileShaders(PostProcessing/bloom_threshold_frag.frag PostProcessing/bloom_threshold_frag.spv)
compileShaders(PostProcessing/ao_frag.frag PostProcessing/ao_frag.spv)
compileShaders(PostProcessing/bilateral_blur_horizontal_frag.frag PostProcessing/bilateral_blur_horizontal_frag.spv)
compileShaders(PostProcessing/bilateral_blur_vertical_frag.frag PostProcessing/bilateral_blur_vertical_frag.spv)
compileShaders(PostProcessing/depth_downscale_frag.frag PostProcessing/depth_downscale_frag.spv)
file(COPY ${PROJECT_BINARY_DIR}/Shaders/VulkanShaders
DESTINATION ${CMAKE_PROGRAM_PATH}/Shaders)
......
......@@ -891,6 +891,7 @@ void testDecals()
auto light = std::make_shared<DirectionalLight>("Light");
light->setIntensity(7);
light->setColor(Color(1.0, 0.95, 0.8));
light->setFocalPoint(Vec3d(-1, -1, 0));
scene->addLight(light);
// Run
......@@ -921,6 +922,8 @@ void testRendering()
headMaterial->addTexture(headNormalTexture);
headMaterial->addTexture(headRoughnessTexture);
headMaterial->addTexture(headSSSTexture);
headMaterial->setReceivesShadows(true);
headMaterial->setCastsShadows(true);
headMesh->setRenderMaterial(headMaterial);
// Position camera
......@@ -928,15 +931,83 @@ void testRendering()
cam->setPosition(0, 0.25, 2);
cam->setFocalPoint(0, 0.25, 0);
// Light
auto light = std::make_shared<DirectionalLight>("Light");
light->setIntensity(7);
light->setColor(Color(1.0, 0.95, 0.8));
scene->addLight(light);
// Lights
auto directionalLight = std::make_shared<DirectionalLight>("DirectionalLight");
directionalLight->setIntensity(7);
directionalLight->setColor(Color(1.0, 0.95, 0.8));
directionalLight->setCastsShadow(true);
directionalLight->setShadowRange(1.5);
scene->addLight(directionalLight);
auto pointLight = std::make_shared<PointLight>("PointLight");
pointLight->setIntensity(0.1);
pointLight->setPosition(0.1, 0.2, 0.5);
scene->addLight(pointLight);
// Sphere
auto sphereObj = apiutils::createVisualAnalyticalSceneObject(Geometry::Type::Sphere, scene, "VisualSphere", 0.025);
auto sphereMaterial = std::make_shared<RenderMaterial>();
auto sphereMesh = sphereObj->getVisualGeometry();
sphereMesh->translate(0.1, 0.2, 0.5);
sphereMaterial->setEmissivity(10);
sphereMaterial->setCastsShadows(false);
sphereObj->getVisualGeometry()->setRenderMaterial(sphereMaterial);
// Plane
auto planeObj = apiutils::createVisualAnalyticalSceneObject(Geometry::Type::Plane, scene, "VisualPlane", 10);
auto planeMaterial = std::make_shared<RenderMaterial>();
planeMaterial->setDiffuseColor(Color::DarkGray);
planeObj->getVisualGeometry()->setRenderMaterial(planeMaterial);
// Run
sdk->setActiveScene(scene);
sdk->getViewer()->setBackgroundColors(Vec3d(0, 0, 0));
#ifdef iMSTK_USE_Vulkan
auto viewer = std::dynamic_pointer_cast<VulkanViewer>(sdk->getViewer());
viewer->setResolution(1920, 1080);
viewer->disableVSync();
viewer->enableFullscreen();
#endif
sdk->startSimulation(true);
}
void testRenderMaterials()
{
// SDK and Scene
auto sdk = std::make_shared<SimulationManager>();
auto scene = sdk->createNewScene("RenderMaterials");
// Position camera
auto cam = scene->getCamera();
cam->setPosition(0.2, 0.2, 2.5);
cam->setFocalPoint(0.2, 0.2, 0);
// IBL probe
auto probe = std::make_shared<IBLProbe>(
iMSTK_DATA_ROOT "/IBL/roomIrradiance.dds",
iMSTK_DATA_ROOT "/IBL/roomRadiance.dds",
iMSTK_DATA_ROOT "/IBL/roomBRDF.png");
scene->setGlobalIBLProbe(probe);
// Sphere
for (int i = 0; i < 25; i++)
{
auto sphereObj = apiutils::createVisualAnalyticalSceneObject(Geometry::Type::Sphere,
scene,
"VisualSphere" + std::to_string(i),
0.05);
auto sphereMaterial = std::make_shared<RenderMaterial>();
auto sphereMesh = sphereObj->getVisualGeometry();
sphereMesh->translate((i / 5) * 0.1, (i % 5) * 0.1, 0.5);
sphereMaterial->setCastsShadows(false);
sphereMaterial->setRoughness((i / 5) / 4.0);
sphereMaterial->setMetalness((i % 5) / 4.0);
sphereObj->getVisualGeometry()->setRenderMaterial(sphereMaterial);
}
// Run
sdk->setActiveScene(scene);
sdk->startSimulation(true);
}
......@@ -3618,8 +3689,9 @@ int main()
------------------*/
//testMultiObjectWithTextures();
//testViewer();
testDecals();
//testDecals();
//testRendering();
testRenderMaterials();
//testScreenShotUtility();
//testCapsule();
......@@ -3647,11 +3719,11 @@ int main()
Test physics
------------------*/
//testPbdVolume();
//testPbdCloth();
testPbdCloth();
//testPbdCollision();
//testPbdFluidBenchmarking();
//testPbdFluid();
testDeformableBody();
//testDeformableBody();
//testDeformableBodyCollision();
//liverToolInteraction();
//testPicking();
......@@ -3684,7 +3756,7 @@ int main()
//testBoneDrilling();
//testVirtualCouplingCylinder();
//testRigidBody();
testGraph();
//testGraph();
return 0;
}
......@@ -32,8 +32,8 @@ bool isColorRangeCorrect( double c )
Color Color::White(1.0, 1.0, 1.0, 1.0);
Color Color::Black(0.0, 0.0, 0.0, 1.0);
Color Color::DarkGray(0.8, 0.8, 0.8, 1.0);
Color Color::LightGray(0.3, 0.3, 0.3, 1.0);
Color Color::DarkGray(0.3, 0.3, 0.3, 1.0);
Color Color::LightGray(0.8, 0.8, 0.8, 1.0);
Color Color::Blue(0.0, 0.0, 1.0, 1.0);
Color Color::Green(0.0, 1.0, 0.0, 1.0);
Color Color::Red(1.0, 0.0, 0.0, 1.0);
......
......@@ -184,6 +184,18 @@ RenderMaterial::setRoughness(const float roughness)
m_roughness = roughness;
}
const float&
RenderMaterial::getEmissivity() const
{
return m_emissivity;
}
void
RenderMaterial::setEmissivity(const float emissivity)
{
m_emissivity = emissivity;
}
const double&
RenderMaterial::getSphereGlyphSize() const
{
......@@ -250,6 +262,29 @@ RenderMaterial::getVisibility() const
return m_isVisible;
}
void
RenderMaterial::setReceivesShadows(const bool receivesShadows)
{
m_receivesShadows = receivesShadows;
}
bool
RenderMaterial::getReceivesShadows() const
{
return m_receivesShadows;
}
void
RenderMaterial::setCastsShadows(const bool castsShadows)
{
m_castsShadows = castsShadows;
}
bool RenderMaterial::getCastsShadows() const
{
return m_castsShadows;
}
bool
RenderMaterial::isDecal()
{
......
......@@ -105,6 +105,12 @@ public:
const float& getRoughness() const;
void setRoughness(const float roughness);
///
/// \brief Get/Set emissivity
///
const float& getEmissivity() const;
void setEmissivity(const float emissivity);
///
/// \brief Get/Set the roughness
///
......@@ -130,6 +136,21 @@ public:
void setVisibilityOn();
bool getVisibility() const;
///
/// \brief Get/Set shadow receiving ability
///
void setReceivesShadows(const bool receivesShadows);
bool getReceivesShadows() const;
///
/// \brief Get/Set shadow cast status
///
void setCastsShadows(const bool castsShadows);
bool getCastsShadows() const;
///
/// \brief Checks if the material belongs to a decal
///
bool isDecal();
protected:
......@@ -154,11 +175,16 @@ protected:
// Classical values
float m_metalness = 0.0; ///< Value for metalness with range: [0.0, 1.0]
float m_roughness = 0.0; ///< Value for roughness with range: [0.0, 1.0]
float m_roughness = 1.0; ///< Value for roughness with range: [0.0, 1.0]
float m_emissivity = 0.0;
// Textures
std::vector<std::shared_ptr<Texture>> m_textures; ///< Ordered by Texture::Type
// Shadows
bool m_receivesShadows = true;
bool m_castsShadows = true;
// Visibility
bool m_isVisible = true;
......
......@@ -40,7 +40,6 @@ public:
{
DIFFUSE = 0, // Also used for albedo
NORMAL,
SPECULAR,
ROUGHNESS,
METALNESS,
SUBSURFACE_SCATTERING,
......@@ -49,6 +48,7 @@ public:
CUBEMAP,
IRRADIANCE_CUBEMAP,
RADIANCE_CUBEMAP,
BRDF_LUT,
NONE
};
......
......@@ -26,6 +26,7 @@ uniform vec3 debugColor = vec3(0);
#endif
// Material properties
uniform float emissivity = 1.0;
uniform float metalness = 0;
uniform float roughness = 1.0;
......@@ -51,7 +52,7 @@ void main()
cameraDirection = normalize(vertex.position - cameraPosition);
#ifdef DIFFUSE_TEXTURE
diffuseColor = pow(texture(diffuseTexture, vertex.uv).rgb, vec3(2.2));
diffuseColor = pow(texture(diffuseTexture, vertex.uv).rgb, vec3(2.2)) * diffuseColorUniform;
#else
diffuseColor = diffuseColorUniform;
#endif
......@@ -91,7 +92,7 @@ void main()
}
// Sum components and apply gamma correction
finalColor = mix(0.5, 1.0, roughness) * finalDiffuse + mix(0.5, 0.0, roughness) * finalSpecular;
finalColor = mix(0.5, 1.0, roughness) * finalDiffuse + mix(0.5, 0.0, roughness) * finalSpecular + emissivity * diffuseColor;
// Apply tone mapping
finalColor = toneMap(finalColor);
......
......@@ -197,6 +197,7 @@ VTKCustomPolyDataMapper::SetMapperShaderParameters(
helper.AttributeUpdateTime.Modified();
helper.Program->SetUniformf("emissivity", material->getEmissivity());
helper.Program->SetUniformf("metalness", material->getMetalness());
helper.Program->SetUniformf("roughness", material->getRoughness());
......
......@@ -265,6 +265,15 @@ VulkanPostProcess::createPipeline(VulkanRenderer * renderer, std::string fragmen
vkCreatePipelineLayout(renderer->m_renderDevice, &layoutInfo, nullptr, &m_pipelineLayout);
m_pipelineComponents.dynamicStates.push_back(VK_DYNAMIC_STATE_VIEWPORT);
m_pipelineComponents.dynamicStates.push_back(VK_DYNAMIC_STATE_SCISSOR);
m_pipelineComponents.dynamicStateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
m_pipelineComponents.dynamicStateInfo.pNext = nullptr;
m_pipelineComponents.dynamicStateInfo.flags = 0;
m_pipelineComponents.dynamicStateInfo.dynamicStateCount = (uint32_t)m_pipelineComponents.dynamicStates.size();
m_pipelineComponents.dynamicStateInfo.pDynamicStates = &m_pipelineComponents.dynamicStates[0];
m_graphicsPipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
m_graphicsPipelineInfo.pNext = nullptr;
m_graphicsPipelineInfo.flags = VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT;
......@@ -278,7 +287,7 @@ VulkanPostProcess::createPipeline(VulkanRenderer * renderer, std::string fragmen
m_graphicsPipelineInfo.pMultisampleState = &m_pipelineComponents.multisampleInfo;
m_graphicsPipelineInfo.pDepthStencilState = &m_pipelineComponents.depthStencilInfo;
m_graphicsPipelineInfo.pColorBlendState = &m_pipelineComponents.colorBlendInfo;
m_graphicsPipelineInfo.pDynamicState = nullptr;
m_graphicsPipelineInfo.pDynamicState = &m_pipelineComponents.dynamicStateInfo;
m_graphicsPipelineInfo.layout = m_pipelineLayout;
m_graphicsPipelineInfo.renderPass = m_renderPass;
m_graphicsPipelineInfo.subpass = 0;
......@@ -289,10 +298,11 @@ VulkanPostProcess::createPipeline(VulkanRenderer * renderer, std::string fragmen
void
VulkanPostProcess::createFullscreenQuad(VulkanRenderer * renderer)
{
m_vertexBuffer = std::make_shared<VulkanVertexBuffer>(renderer->m_memoryManager, 4, 4 * 5, 2);
m_vertexBuffer = std::make_shared<VulkanVertexBuffer>
(renderer->m_memoryManager, 4, (unsigned int)(sizeof(float) * 5), 2);
{
auto data = (float*)m_vertexBuffer->mapVertices();
auto data = (float*)m_vertexBuffer->getVertexMemory();
data[0] = -1;
data[1] = -1;
data[2] = 0;
......@@ -316,19 +326,16 @@ VulkanPostProcess::createFullscreenQuad(VulkanRenderer * renderer)
data[17] = 0;
data[18] = 1;
data[19] = 1;
m_vertexBuffer->unmapVertices();
}
{
auto data = (uint32_t*)m_vertexBuffer->mapTriangles();
auto data = (uint32_t*)m_vertexBuffer->getIndexMemory();
data[0] = 0;
data[1] = 1;
data[2] = 2;
data[3] = 1;
data[4] = 2;
data[5] = 3;
m_vertexBuffer->unmapTriangles();
}
m_vertexBuffer->initializeBuffers(renderer->m_memoryManager);
......@@ -417,7 +424,7 @@ VulkanPostProcess::createDescriptorSets(VulkanRenderer * renderer)
VkDescriptorImageInfo textureInfo;
textureInfo.sampler = *m_samplers[i];
textureInfo.imageView = *m_imageViews[i];
textureInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
textureInfo.imageLayout = m_layouts[i];
fragmentTextureInfo.push_back(textureInfo);
}
......@@ -563,9 +570,28 @@ VulkanPostProcess::createFramebuffer(VulkanRenderer * renderer,
void
VulkanPostProcess::addInputImage(
VkSampler * sampler,
VkImageView * imageView)
VkImageView * imageView,
VkImageLayout layout)
{
m_samplers.push_back(sampler);
m_imageViews.push_back(imageView);
m_layouts.push_back(layout);
}
void
VulkanPostProcess::clear(VkDevice * device)
{
vkDestroyShaderModule(*device, m_pipelineComponents.vertexShader, nullptr);
vkDestroyShaderModule(*device, m_pipelineComponents.fragmentShader, nullptr);
vkDestroyPipelineLayout(*device, m_pipelineLayout, nullptr);
vkDestroyPipeline(*device, m_pipeline, nullptr);
vkDestroyRenderPass(*device, m_renderPass, nullptr);
for (auto layout : m_descriptorSetLayouts)
{
vkDestroyDescriptorSetLayout(*device, layout, nullptr);
}
vkDestroyDescriptorPool(*device, m_descriptorPool, nullptr);
}
}
\ No newline at end of file
......@@ -47,12 +47,12 @@ public:
void addInputImage(
VkSampler * sampler,
VkImageView * imageView);
VkImageView * imageView,
VkImageLayout layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
void generateMipmaps(VkCommandBuffer& commandBuffer,
unsigned int levels,
VkImage& image);
protected:
friend class VulkanRenderer;
friend class VulkanPostProcessingChain;
......@@ -78,6 +78,8 @@ protected:
void createDescriptorPool(VulkanRenderer * renderer);
void createDescriptorSets(VulkanRenderer * renderer);
void clear(VkDevice * device);
VkPipeline m_pipeline;
VkGraphicsPipelineCreateInfo m_graphicsPipelineInfo;
VkPipelineLayout m_pipelineLayout;
......@@ -95,6 +97,8 @@ protected:
// Resources
std::vector<VkSampler *> m_samplers;
std::vector<VkImageView *> m_imageViews;
std::vector<VkImageLayout> m_layouts;
unsigned int m_downsampleLevels = 0;
unsigned int m_outputIndex = 0;
bool m_lastPass = false;
......
......@@ -27,18 +27,16 @@ namespace imstk
{
VulkanPostProcessingChain::VulkanPostProcessingChain(VulkanRenderer * renderer)
{
bool bloom = false;
bool sss = true;
// Subsurface scattering pass
// The buffer indices are hardcoded because it's before the accumulation composition pass
if (sss)
if (m_sss)
{
int sssSamples = 5;
auto sssHorizontalBlurPass = std::make_shared<VulkanPostProcess>(renderer, 0);
sssHorizontalBlurPass->addInputImage(&renderer->m_HDRImageSampler, &renderer->m_HDRImageView[0][0]);
sssHorizontalBlurPass->addInputImage(&renderer->m_HDRImageSampler, &renderer->m_depthImageView[0]);
sssHorizontalBlurPass->addInputImage(&renderer->m_HDRImageSampler, &renderer->m_depthImageView[0],
VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL);
sssHorizontalBlurPass->addInputImage(&renderer->m_HDRImageSampler, &renderer->m_normalImageView);
sssHorizontalBlurPass->m_framebuffer->setColor(&renderer->m_HDRImageView[2][0], VK_FORMAT_R16G16B16A16_SFLOAT);
sssHorizontalBlurPass->initialize(renderer, "./Shaders/VulkanShaders/PostProcessing/sss_frag.spv");
......@@ -49,17 +47,18 @@ VulkanPostProcessingChain::VulkanPostProcessingChain(VulkanRenderer * renderer)
sssHorizontalBlurPass->m_pushConstantData[4] = renderer->m_nearPlane;
sssHorizontalBlurPass->m_pushConstantData[5] = renderer->m_farPlane;
sssHorizontalBlurPass->m_pushConstantData[6] = sssSamples;
this->calculateBlurValues(sssSamples,
VulkanPostProcessingChain::calculateBlurValues(sssSamples,
&sssHorizontalBlurPass->m_pushConstantData[7],
renderer->m_nearPlane);
this->calculateBlurValues(sssSamples,
VulkanPostProcessingChain::calculateBlurValues(sssSamples,
&sssHorizontalBlurPass->m_pushConstantData[17],
renderer->m_farPlane);
m_postProcesses.push_back(sssHorizontalBlurPass);
auto sssVerticalBlurPass = std::make_shared<VulkanPostProcess>(renderer, 0);
sssVerticalBlurPass->addInputImage(&renderer->m_HDRImageSampler, &renderer->m_HDRImageView[2][0]);
sssVerticalBlurPass->addInputImage(&renderer->m_HDRImageSampler, &renderer->m_depthImageView[0]);
sssVerticalBlurPass->addInputImage(&renderer->m_HDRImageSampler, &renderer->m_depthImageView[0],
VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL);
sssVerticalBlurPass->addInputImage(&renderer->m_HDRImageSampler, &renderer->m_normalImageView);
sssVerticalBlurPass->m_framebuffer->setColor(&renderer->m_HDRImageView[0][0], VK_FORMAT_R16G16B16A16_SFLOAT);
sssVerticalBlurPass->initialize(renderer, "./Shaders/VulkanShaders/PostProcessing/sss_frag.spv");
......@@ -70,10 +69,10 @@ VulkanPostProcessingChain::VulkanPostProcessingChain(VulkanRenderer * renderer)
sssVerticalBlurPass->m_pushConstantData[4] = renderer->m_nearPlane;
sssVerticalBlurPass->m_pushConstantData[5] = renderer->m_farPlane;
sssVerticalBlurPass->m_pushConstantData[6] = sssSamples;
this->calculateBlurValues(sssSamples,
VulkanPostProcessingChain::calculateBlurValues(sssSamples,
&sssVerticalBlurPass->m_pushConstantData[7],
renderer->m_nearPlane);
this->calculateBlurValues(sssSamples,
VulkanPostProcessingChain::calculateBlurValues(sssSamples,
&sssVerticalBlurPass->m_pushConstantData[17],
renderer->m_farPlane);
m_postProcesses.push_back(sssVerticalBlurPass);
......@@ -88,7 +87,7 @@ VulkanPostProcessingChain::VulkanPostProcessingChain(VulkanRenderer * renderer)
m_postProcesses.push_back(accumulationCompositePass);
// Bloom pass
if (bloom)
if (m_bloom)
{
int level = 1;
int bloomSamples = 5;
......@@ -106,7 +105,7 @@ VulkanPostProcessingChain::VulkanPostProcessingChain(VulkanRenderer * renderer)
bloomHorizontalBlurPass->m_pushConstantData[0] = std::max(renderer->m_width >> level, 1u);
bloomHorizontalBlurPass->m_pushConstantData[1] = std::max(renderer->m_height >> level, 1u);
bloomHorizontalBlurPass->m_pushConstantData[2] = bloomSamples;
this->calculateBlurValuesLinear(bloomSamples,
VulkanPostProcessingChain::calculateBlurValuesLinear(bloomSamples,
&bloomHorizontalBlurPass->m_pushConstantData[3],
&bloomHorizontalBlurPass->m_pushConstantData[13]);
m_postProcesses.push_back(bloomHorizontalBlurPass);
......@@ -118,7 +117,7 @@ VulkanPostProcessingChain::VulkanPostProcessingChain(VulkanRenderer * renderer)
bloomVerticalBlurPass->m_pushConstantData[0] = std::max(renderer->m_width >> level, 1u);
bloomVerticalBlurPass->m_pushConstantData[1] = std::max(renderer->m_height >> level, 1u);
bloomVerticalBlurPass->m_pushConstantData[2] = bloomSamples;
this->calculateBlurValuesLinear(bloomSamples,
VulkanPostProcessingChain::calculateBlurValuesLinear(bloomSamples,
&bloomVerticalBlurPass->m_pushConstantData[3],
&bloomVerticalBlurPass->m_pushConstantData[13]);
m_postProcesses.push_back(bloomVerticalBlurPass);
......
......@@ -47,10 +47,13 @@ public:
protected:
friend class VulkanRenderer;
bool m_bloom = true;
bool m_sss = true;
std::vector<std::shared_ptr<VulkanPostProcess>> m_postProcesses;
void incrementBufferNumbers();
void calculateBlurValuesLinear(int samples, float * values, float * offsets);
void calculateBlurValues(int samples, float * values, float stdDev = 0.0);
static void calculateBlurValuesLinear(int samples, float * values, float * offsets);
static void calculateBlurValues(int samples, float * values, float stdDev = 0.0);
unsigned int m_lastOutput = 2; ///< 2 by default because of accumulation composition
unsigned int m_lastInput = 0; ///< 0 by default because of accumulation composition
......
......@@ -93,13 +93,13 @@ VulkanCapsuleRenderDelegate::VulkanCapsuleRenderDelegate(std::shared_ptr<Capsule
m_vertexBuffer->updateVertexBuffer(&m_capsuleVertices, &m_capsuleTriangles);
this->update();
this->update(0);
}
void
VulkanCapsuleRenderDelegate::update()
VulkanCapsuleRenderDelegate::update(uint32_t frameIndex)
{
this->updateUniforms();
this->updateUniforms(frameIndex);
}
std::shared_ptr<Geometry>
......
......@@ -49,7 +49,7 @@ public:
///
/// \brief Update render geometry
///
void update() override;
void update(uint32_t frameIndex) override;