motion blur fix when delta time is zero
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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):
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user