summaryrefslogtreecommitdiffstats
path: root/servers/rendering/renderer_rd/effects/debug_effects.cpp
diff options
context:
space:
mode:
authorDario <dariosamo@gmail.com>2024-05-10 11:57:27 -0300
committerDario <dariosamo@gmail.com>2024-05-10 11:57:27 -0300
commit3f64eeb393d1c2089b0e93449c01d09a62fc096e (patch)
tree58e9032cfe9fe3c1a17f9fb7936cbab46d8e470f /servers/rendering/renderer_rd/effects/debug_effects.cpp
parent2ba22d1554ded08094e3869a83bd87487266ad38 (diff)
downloadredot-engine-3f64eeb393d1c2089b0e93449c01d09a62fc096e.tar.gz
Rewrite reprojection for FSR2 to work correctly with Reverse-Z.
Diffstat (limited to 'servers/rendering/renderer_rd/effects/debug_effects.cpp')
-rw-r--r--servers/rendering/renderer_rd/effects/debug_effects.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/servers/rendering/renderer_rd/effects/debug_effects.cpp b/servers/rendering/renderer_rd/effects/debug_effects.cpp
index 017ad41fdc..04afaf63d7 100644
--- a/servers/rendering/renderer_rd/effects/debug_effects.cpp
+++ b/servers/rendering/renderer_rd/effects/debug_effects.cpp
@@ -354,7 +354,9 @@ void DebugEffects::draw_motion_vectors(RID p_velocity, RID p_depth, RID p_dest_f
RD::DrawListID draw_list = RD::get_singleton()->draw_list_begin(p_dest_fb, RD::INITIAL_ACTION_LOAD, RD::FINAL_ACTION_STORE, RD::INITIAL_ACTION_DISCARD, RD::FINAL_ACTION_DISCARD);
RD::get_singleton()->draw_list_bind_render_pipeline(draw_list, motion_vectors.pipeline.get_render_pipeline(RD::INVALID_ID, RD::get_singleton()->framebuffer_get_format(p_dest_fb), false, RD::get_singleton()->draw_list_get_current_pass()));
- Projection reprojection = p_previous_projection.flipped_y() * p_previous_transform.affine_inverse() * p_current_transform * p_current_projection.flipped_y().inverse();
+ Projection correction;
+ correction.set_depth_correction(true, true, false);
+ Projection reprojection = (correction * p_previous_projection) * p_previous_transform.affine_inverse() * p_current_transform * (correction * p_current_projection).inverse();
RendererRD::MaterialStorage::store_camera(reprojection, motion_vectors.push_constant.reprojection_matrix);
motion_vectors.push_constant.resolution[0] = p_resolution.width;