diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-07-24 10:18:56 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-07-24 20:24:50 +0300 |
commit | 364babab652bf80d6beea419a74242611a4e2393 (patch) | |
tree | cd6669887015c3b0bfcaf327079a173370e113dd /source | |
parent | 0fcc04e7bfe1edf390bec06f488aa9a4ee220983 (diff) |
EEVEE-Next: Fix background velocity
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/engines/eevee_next/shaders/eevee_velocity_lib.glsl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_velocity_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_velocity_lib.glsl index fb9c9faaca2..c21456b7a5c 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_velocity_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_velocity_lib.glsl @@ -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; } /** |