mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-24 13:09:16 +01:00
fix(render): the free camera blurs with its own movement in the OpenGL 4.6 and Vulkan renderers
This commit is contained in:
@@ -1738,13 +1738,20 @@ void opengl46_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
|
||||
if (vp.main && !vp.custom_backbuffer) // TODO: update window sizes also for extra viewports
|
||||
target_size = Global.fb_size;
|
||||
|
||||
// the motion blur only when something in the view moves: the vehicle of the camera, or a vehicle drawn in the last frame.
|
||||
// the camera with no vehicle of its own (freefly, the editor) blurs the world with its own movement, as a vehicle does with
|
||||
// its (rendering/common/freecameramotion.h)
|
||||
if (vp.main && (Global.pCamera.m_owner != nullptr))
|
||||
m_freecamera.reset();
|
||||
auto const freecameramovement{(vp.main && (Global.pCamera.m_owner == nullptr)) ? m_freecamera.next_frame(Global.pCamera.Pos) : glm::vec3{0.f}};
|
||||
// the motion blur only when something in the view moves: the vehicle of the camera, the camera with no vehicle of its own,
|
||||
// or a vehicle drawn in the last frame.
|
||||
// with nothing moving the velocity is zero everywhere, the blur takes a single sample of each pixel and gives back the
|
||||
// image it was given, so the velocity target, its resolve and the blur are left out and the picture stays the same.
|
||||
// a vehicle setting off is blurred from its second frame, when its velocity is still far below a pixel
|
||||
auto const motionblur{
|
||||
Global.gfx_postfx_motionblur_enabled
|
||||
&& (m_vehiclesmoved
|
||||
|| (freecameramovement != glm::vec3{0.f})
|
||||
|| ((Global.pCamera.m_owner != nullptr) && (Global.pCamera.m_owner->get_future_movement() != glm::dvec3{0.0})))};
|
||||
|
||||
if (!Global.gfx_skippipeline)
|
||||
@@ -1805,6 +1812,12 @@ void opengl46_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
|
||||
glm::mat4 mv = OpenGLMatrices.data(GL_MODELVIEW);
|
||||
future = glm::translate(mv, -glm::vec3(vehicle->get_future_movement())) * glm::inverse(mv);
|
||||
}
|
||||
else if (freecameramovement != glm::vec3{0.f})
|
||||
{
|
||||
// with the temporal anti-aliasing the velocities to the last frame hold the movement of the camera already
|
||||
glm::mat4 mv = OpenGLMatrices.data(GL_MODELVIEW);
|
||||
future = glm::translate(mv, -freecameramovement) * glm::inverse(mv);
|
||||
}
|
||||
|
||||
// the cluster grid and its lists of lights are kept up only while something reads them: the shading or the heatmap.
|
||||
// the lists exist for a perspective view; without them the shading goes through the first few lights, as does the pass
|
||||
|
||||
Reference in New Issue
Block a user