taa dx fix
This commit is contained in:
parent
8548665883
commit
b912335525
3 changed files with 9 additions and 9 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue