godot/servers/rendering/renderer_rd
Arseny Kapoulkine 92f2bc70dd Relax motion vector updates to allow skipped frames for skeletons
Before this change, a skeleton that was not updated every frame would
result in a difference of 2+ between last_change and frame index every
frame, which would disable the buffer rotation and set motion vectors to
zero. This results in significant visual artifacts for FSR2 that are
especially prominent on the characters that move together with the view
such as the main character in third person mode.

This is a significant problem for high refresh rate displays: at 120 Hz,
we are effectively guaranteed to skip skeleton updates every other frame
with skeleton update happening during physics processing, and the lack
of physics interpolation for skeletons. This happens by default in TPS
demo when FSR2 is enabled.

In other places where motion vectors are disabled, such as multi-mesh
and mesh rendering (where previous transform is updated), the logic
effectively allows for a single-frame gap in updates, because it
compares the frame where the update happened (which is the current frame
if updates are consistent) with the current frame, so the latency of 0
means "update just happened", but both multi-mesh and mesh transform
updates permit a latency of 1 as well.

Here, however, last_change is updated *after* the frame processing has
concluded, so a zero-latency update has a distance of 1. Allowing a
distance of 2 (latency 1) reduces the severity of the problem and aligns
the logic with transform updates.

Note that the problem will still happen when refresh rate is noticeably
higher than physics rate times 2. For example, it still happens at 240
Hz. However, a longer latency allowance is inconsistent with other
transforms and could lead to issues, so ideally long term physical
interpolation of skeleton transforms would completely solve this.
2024-08-17 11:10:41 -07:00
..
effects Rewrite reprojection for FSR2 to work correctly with Reverse-Z. 2024-05-10 11:57:27 -03:00
environment SDFGI: fix crash if update_data is nullptr 2024-07-19 18:27:32 +02:00
forward_clustered Merge pull request #95659 from clayjohn/RD-sky-affect 2024-08-16 23:49:58 +02:00
forward_mobile Merge pull request #86516 from jsjtxietian/fix-camera-direction 2024-07-18 10:45:20 +02:00
shaders Merge pull request #95536 from jsjtxietian/rename-alpha-scissor 2024-08-16 14:35:38 +02:00
spirv-reflect Refactor SPIR-V reflection into a generic RenderingDevice feature 2022-12-12 14:14:53 +01:00
storage_rd Relax motion vector updates to allow skipped frames for skeletons 2024-08-17 11:10:41 -07:00
cluster_builder_rd.cpp Fix missed light clusters when inside clipped lights 2024-03-13 23:38:46 +01:00
cluster_builder_rd.h Replace Extents with Size in VoxelGI, ReflectionProbe, FogVolume, Decal and GPUParticles*3D 2023-01-31 20:04:11 +01:00
framebuffer_cache_rd.cpp Implement hooks into renderer 2024-02-18 21:54:21 +11:00
framebuffer_cache_rd.h Implement hooks into renderer 2024-02-18 21:54:21 +11:00
pipeline_cache_rd.cpp Add Shader compile groups to RD Shader system 2023-07-21 16:42:30 +02:00
pipeline_cache_rd.h Some more fixes for compressed meshes 2023-10-24 09:38:12 +02:00
renderer_canvas_render_rd.cpp Linearize color if HDR 2D is on 2024-07-24 09:49:50 +02:00
renderer_canvas_render_rd.h Remove unused flag and code 2024-06-20 13:50:20 +10:00
renderer_compositor_rd.cpp fix missing cleanup and null checks for various singletons 2024-06-18 01:05:30 -07:00
renderer_compositor_rd.h Fix regression around OpenGL swapchain optimisation for OpenXR 2024-07-29 12:46:58 +10:00
renderer_scene_render_rd.cpp Make RenderSceneData take projection correction into account 2024-06-27 10:44:30 +10:00
renderer_scene_render_rd.h Disable camera_effects on some debug draw mode 2024-06-19 16:45:58 +02:00
SCsub Refactor SPIR-V reflection into a generic RenderingDevice feature 2022-12-12 14:14:53 +01:00
shader_rd.cpp Reduce and prevent unnecessary random-access to List 2024-05-04 16:08:55 +02:00
shader_rd.h Namespace shader cache files by graphics API 2024-01-31 20:19:12 +01:00
uniform_set_cache_rd.cpp Implement hooks into renderer 2024-02-18 21:54:21 +11:00
uniform_set_cache_rd.h Implement hooks into renderer 2024-02-18 21:54:21 +11:00