EEVEE-Next: Fix background velocity

This commit is contained in:
Clément Foucault
2022-07-24 09:18:56 +02:00
parent 0fcc04e7bf
commit 364babab65

View File

@@ -41,8 +41,16 @@ vec4 velocity_background(vec3 vV)
{
/* Only transform direction to avoid loosing precision. */
vec3 V = transform_direction(camera_curr.viewinv, vV);
/* NOTE: We don't use the drw_view.winmat to avoid adding the TAA jitter to the velocity. */
vec2 prev_uv = project_point(camera_prev.winmat, V).xy;
vec2 curr_uv = project_point(camera_curr.winmat, V).xy;
vec2 next_uv = project_point(camera_next.winmat, V).xy;
return velocity_surface(V, V, V);
vec4 motion = vec4(prev_uv - curr_uv, curr_uv - next_uv);
/* Convert NDC velocity to UV velocity */
motion *= 0.5;
return motion;
}
/**