motion blur fix when delta time is zero

This commit is contained in:
Turánszki János
2024-10-25 07:57:34 +02:00
parent 0700c42431
commit 2cf701fe79
5 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ void main(uint3 Gid : SV_GroupID, uint3 GTid : SV_GroupThreadID)
#else
const float strength = motionblur_strength / GetFrame().delta_time;
const float strength = motionblur_strength;
const float2 neighborhood_velocity = neighborhoodmax[(pixel + (dither((float2)pixel) - 0.5f) * 16) / MOTIONBLUR_TILESIZE] * strength; // dither to reduce tile artifact
const float neighborhood_velocity_magnitude = length(neighborhood_velocity);
+1
View File
@@ -2363,6 +2363,7 @@ namespace wi
if (getMotionBlurEnabled() && getMotionBlurStrength() > 0 && motionblurResources.IsValid())
{
wi::renderer::Postprocess_MotionBlur(
scene->dt,
motionblurResources,
rt_first == nullptr ? *rt_read : *rt_first,
*rt_write,
+2 -1
View File
@@ -15601,6 +15601,7 @@ void CreateMotionBlurResources(MotionBlurResources& res, XMUINT2 resolution)
device->CreateBuffer(&bufferdesc, nullptr, &res.buffer_tiles_expensive);
}
void Postprocess_MotionBlur(
float dt,
const MotionBlurResources& res,
const Texture& input,
const Texture& output,
@@ -15661,7 +15662,7 @@ void Postprocess_MotionBlur(
postprocess.resolution.y = desc.height;
postprocess.resolution_rcp.x = 1.0f / postprocess.resolution.x;
postprocess.resolution_rcp.y = 1.0f / postprocess.resolution.y;
motionblur_strength = strength / 60.0f; // align to shutter speed
motionblur_strength = dt > 0 ? (strength / 60.0f / dt) : 0; // align to shutter speed
// Compute tile max velocities (horizontal):
{
+1
View File
@@ -741,6 +741,7 @@ namespace wi::renderer
};
void CreateMotionBlurResources(MotionBlurResources& res, XMUINT2 resolution);
void Postprocess_MotionBlur(
float dt, // delta time in seconds
const MotionBlurResources& res,
const wi::graphics::Texture& input,
const wi::graphics::Texture& output,
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wi::version
// minor features, major updates, breaking compatibility changes
const int minor = 71;
// minor bug fixes, alterations, refactors, updates
const int revision = 603;
const int revision = 604;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);