Merge pull request #95705 from zeux/fsr-skin-relax

Relax motion vector updates to allow skipped frames for skeletons
This commit is contained in:
Rémi Verschelde 2024-08-19 12:09:34 +02:00
commit 10b91ee950
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 3 additions and 2 deletions

View File

@ -1056,8 +1056,9 @@ void MeshStorage::update_mesh_instances() {
mi->surfaces[i].previous_buffer = mi->surfaces[i].current_buffer; mi->surfaces[i].previous_buffer = mi->surfaces[i].current_buffer;
if (uses_motion_vectors && (frame - mi->surfaces[i].last_change) == 1) { if (uses_motion_vectors && mi->surfaces[i].last_change && (frame - mi->surfaces[i].last_change) <= 2) {
// Previous buffer's data can only be one frame old to be able to use motion vectors. // Use a 2-frame tolerance so that stepped skeletal animations have correct motion vectors
// (stepped animation is common for distant NPCs).
uint32_t new_buffer_index = mi->surfaces[i].current_buffer ^ 1; uint32_t new_buffer_index = mi->surfaces[i].current_buffer ^ 1;
if (mi->surfaces[i].uniform_set[new_buffer_index].is_null()) { if (mi->surfaces[i].uniform_set[new_buffer_index].is_null()) {