Skip to content
Snippets Groups Projects
Commit a82d4018 authored by Alexander Gauggel's avatar Alexander Gauggel
Browse files

[#106] Reduce motion blur artifacts when using mouse at high fraerate

parent 7a78a501
No related branches found
No related tags found
1 merge request!89Resolve "Indirect Dispatch"
Pipeline #26748 passed
This commit is part of merge request !89. Comments created here will be created in the context of that merge request.
...@@ -290,7 +290,14 @@ void App::run() { ...@@ -290,7 +290,14 @@ void App::run() {
const float microsecondToSecond = 0.000001; const float microsecondToSecond = 0.000001;
const float fDeltatimeSeconds = microsecondToSecond * std::chrono::duration_cast<std::chrono::microseconds>(frameEndTime - frameStartTime).count(); const float fDeltatimeSeconds = microsecondToSecond * std::chrono::duration_cast<std::chrono::microseconds>(frameEndTime - frameStartTime).count();
const float motionBlurMotionFactor = 1 / (fDeltatimeSeconds * cameraShutterSpeedInverse);
// small mouse movements are restricted to pixel level and therefore quite unprecise
// therefore extrapolating movement at high framerates results in big jerky movements
// this results in wide sudden motion blur, which looks quite bad
// as a workaround the time scale is limited to a maximum value
const float motionBlurTimeScaleMax = 1.f / 60;
const float deltaTimeMotionBlur = std::max(fDeltatimeSeconds, motionBlurTimeScaleMax);
const float motionBlurMotionFactor = 1 / (deltaTimeMotionBlur * cameraShutterSpeedInverse);
vkcv::PushConstants motionBlurPushConstants(sizeof(float) * 2); vkcv::PushConstants motionBlurPushConstants(sizeof(float) * 2);
......
...@@ -5,6 +5,6 @@ namespace AppConfig{ ...@@ -5,6 +5,6 @@ namespace AppConfig{
const int defaultWindowWidth = 1280; const int defaultWindowWidth = 1280;
const int defaultWindowHeight = 720; const int defaultWindowHeight = 720;
const vk::Format depthBufferFormat = vk::Format::eD32Sfloat; const vk::Format depthBufferFormat = vk::Format::eD32Sfloat;
const vk::Format colorBufferFormat = vk::Format::eB10G11R11UfloatPack32; const vk::Format colorBufferFormat = vk::Format::eB10G11R11UfloatPack32;
const vk::Format motionBufferFormat = vk::Format::eR16G16Sfloat; const vk::Format motionBufferFormat = vk::Format::eR16G16Sfloat;
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment