diff --git a/data/pipelines/common.glsl b/data/pipelines/common.glsl index 7b7f2e238..2a95b82ec 100644 --- a/data/pipelines/common.glsl +++ b/data/pipelines/common.glsl @@ -592,7 +592,9 @@ float rand(vec3 seed) vec2 computeStaticObjectMotionVector(vec3 wpos) { vec4 p = Global.view_projection_no_jitter * vec4(wpos, 1); vec4 pos_projected = Global.reprojection * p; - return (pos_projected.xy / pos_projected.w * 0.5 + 0.5 - (p.xy / p.w * 0.5 + 0.5)) * 0.5 + 0.5; + vec2 r = (pos_projected.xy / pos_projected.w * 0.5 + 0.5 - (p.xy / p.w * 0.5 + 0.5)); + r = r * 0.5 + 0.5; + return r; } vec2 cameraReproject(vec2 uv, float depth) { diff --git a/data/pipelines/taa.shd b/data/pipelines/taa.shd index 736417160..d36e5fb6e 100644 --- a/data/pipelines/taa.shd +++ b/data/pipelines/taa.shd @@ -76,9 +76,11 @@ compute_shader [[ if (any(greaterThanEqual(ij, ivec2(u_size.xy)))) return; vec2 uv = (vec2(ij) + 0.5) / u_size.xy; - float depth = textureLod(u_depthbuf, uv, 0).x; vec2 motionvec = textureLod(u_motion_vectors, uv, 0).xy * 2 - 1; - + #ifndef _ORIGIN_BOTTOM_LEFT + motionvec.y *= -1; + #endif + vec2 uv_prev = uv + motionvec; vec4 current = textureLod(u_current, uv /*- Global.pixel_jitter*/, 0); diff --git a/src/renderer/pipeline.cpp b/src/renderer/pipeline.cpp index 3ba3961d9..52e0a07a4 100644 --- a/src/renderer/pipeline.cpp +++ b/src/renderer/pipeline.cpp @@ -1156,13 +1156,9 @@ struct PipelineImpl final : Pipeline static Matrix computeReprojection(const Viewport& current, const Viewport& prev) { Matrix translation = Matrix::IDENTITY; translation.setTranslation(Vec3(current.pos - prev.pos)); - if (gpu::isOriginBottomLeft()) { - return prev.getProjectionNoJitter() * prev.getViewRotation() * translation * current.getViewRotation().inverted() * current.getProjectionNoJitter().inverted(); - } + return prev.getProjectionNoJitter() * prev.getViewRotation() * translation * current.getViewRotation().inverted() * current.getProjectionNoJitter().inverted(); + } - Matrix flip = Matrix::IDENTITY; - flip.columns[1].y = -1; - return flip * prev.getProjectionNoJitter() * prev.getViewRotation() * translation * current.getViewRotation().inverted() * current.getProjectionNoJitter().inverted() * flip; } bool render(bool only_2d) override