virtualx-engine/servers/rendering/renderer_rd/storage_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
..
forward_id_storage.cpp One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00
forward_id_storage.h Ensure that only visible paired lights are used 2023-10-17 13:02:46 +02:00
light_storage.cpp Properly set size of shadow atlas quadrant when subdivision is 8 or higher. 2024-05-03 17:11:05 -07:00
light_storage.h Shadow fade for omni lights actually stops the shadow from updating while faded out to improve performance. 2024-03-25 21:25:56 -04:00
material_storage.cpp Fix crash when assigning more textures than expected to texture array 2024-07-22 20:51:11 +03:00
material_storage.h Separate linear and sRGB uniform buffers in RD rendering backends 2024-05-27 13:38:49 -07:00
mesh_storage.cpp Relax motion vector updates to allow skipped frames for skeletons 2024-08-17 11:10:41 -07:00
mesh_storage.h Support custom AABB within MultiMesh resources 2024-02-15 22:37:07 -08:00
particles_storage.cpp Track compositor effects that use motion vectors so we enable required logic 2024-06-12 12:37:18 +10:00
particles_storage.h Acyclic Command Graph for RenderingDevice. 2024-01-08 14:54:56 -03:00
render_buffer_custom_data_rd.h One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00
render_data_rd.cpp Remove empty bind_methods() 2024-08-15 08:24:32 +02:00
render_data_rd.h Remove empty bind_methods() 2024-08-15 08:24:32 +02:00
render_scene_buffers_rd.compat.inc Implement hooks into renderer 2024-02-18 21:54:21 +11:00
render_scene_buffers_rd.cpp Expose more state in RenderSceneBuffersRD 2024-07-15 22:04:10 +10:00
render_scene_buffers_rd.h Implement hooks into renderer 2024-02-18 21:54:21 +11:00
render_scene_data_rd.cpp Remove empty bind_methods() 2024-08-15 08:24:32 +02:00
render_scene_data_rd.h Remove empty bind_methods() 2024-08-15 08:24:32 +02:00
SCsub Split dummy renderer classes into separate files 2022-03-16 17:43:10 +11:00
texture_storage.cpp Merge pull request #92000 from clayjohn/vram-debugger 2024-05-16 09:32:11 +02:00
texture_storage.h Improvements to VRS/Foveated rendering 2024-05-03 17:20:30 +10:00
utilities.cpp Fix unsafe uses of Callable.is_null() 2024-04-27 16:22:57 +02:00
utilities.h One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00