diff --git a/projects/indirect_dispatch/src/App.cpp b/projects/indirect_dispatch/src/App.cpp index 5aa01616aa1ec3e6f0b208226bdf7c08bd622e24..16f27932521cdb725a1356def171e988d466acce 100644 --- a/projects/indirect_dispatch/src/App.cpp +++ b/projects/indirect_dispatch/src/App.cpp @@ -290,7 +290,14 @@ void App::run() { const float microsecondToSecond = 0.000001; 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); diff --git a/projects/indirect_dispatch/src/AppConfig.hpp b/projects/indirect_dispatch/src/AppConfig.hpp index e727efa62579a0e48972b2803dbf687a567cd2c9..c89c34ea8e3c0c45708ca998a642faffb31403d3 100644 --- a/projects/indirect_dispatch/src/AppConfig.hpp +++ b/projects/indirect_dispatch/src/AppConfig.hpp @@ -5,6 +5,6 @@ namespace AppConfig{ const int defaultWindowWidth = 1280; const int defaultWindowHeight = 720; const vk::Format depthBufferFormat = vk::Format::eD32Sfloat; - const vk::Format colorBufferFormat = vk::Format::eB10G11R11UfloatPack32; - const vk::Format motionBufferFormat = vk::Format::eR16G16Sfloat; + const vk::Format colorBufferFormat = vk::Format::eB10G11R11UfloatPack32; + const vk::Format motionBufferFormat = vk::Format::eR16G16Sfloat; } \ No newline at end of file