[Bf-blender-cvs] [8ded0dd4d5e] eevee-motionblur-object: EEVEE: Motion Blur: Split both direction accumulation

Clément Foucault noreply at git.blender.org
Fri Jun 12 15:17:30 CEST 2020


Commit: 8ded0dd4d5eda6e673f78373f6798f8b641044f7
Author: Clément Foucault
Date:   Mon Jun 8 23:38:26 2020 +0200
Branches: eevee-motionblur-object
https://developer.blender.org/rB8ded0dd4d5eda6e673f78373f6798f8b641044f7

EEVEE: Motion Blur: Split both direction accumulation

===================================================================

M	source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl

===================================================================

diff --git a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl
index 9496bdc94e9..450a1201330 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_motion_blur_frag.glsl
@@ -50,7 +50,7 @@ vec2 spread_compare(float center_motion_length, float sample_motion_length, floa
 }
 
 /* TODO expose to user */
-#define DEPTH_SCALE (1.0 / 0.01)
+#define DEPTH_SCALE 100.0
 
 vec2 depth_compare(float center_depth, float sample_depth)
 {
@@ -147,9 +147,9 @@ void gather_blur(vec2 screen_uv,
 
   float ofs = fract(wang_hash_noise(0u) + sampleOffset);
 
-  for (int i = 0; i < KERNEL; i++) {
-    float t = (float(i) + ofs) / float(KERNEL);
-
+  int i;
+  float t, inc = 1.0 / float(KERNEL);
+  for (i = 0, t = ofs * inc; i < KERNEL; i++, t += inc) {
     gather_sample(screen_uv,
                   center_depth,
                   center_motion_len,
@@ -159,7 +159,13 @@ void gather_blur(vec2 screen_uv,
                   accum,
                   accum_bg,
                   w_accum);
+  }
+
+  if (center_motion_len < 0.5) {
+    return;
+  }
 
+  for (i = 0, t = ofs * inc; i < KERNEL; i++, t += inc) {
     /* Also sample in center motion direction.
      * Allow to recover motion where there is conflicting
      * motion between foreground and background. */



More information about the Bf-blender-cvs mailing list