[Bf-blender-cvs] [eb23b39b7f7] blender-v2.83-release: Fix T76558: Decreasing Viewport Anti-Aliasing Samples Makes Scene Whiter

Jeroen Bakker noreply at git.blender.org
Thu May 14 12:45:19 CEST 2020


Commit: eb23b39b7f7f4e0531b9acff3769ec3fa4e236ee
Author: Jeroen Bakker
Date:   Thu May 14 12:44:26 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBeb23b39b7f7f4e0531b9acff3769ec3fa4e236ee

Fix T76558: Decreasing Viewport Anti-Aliasing Samples Makes Scene Whiter

When setting the Viewport Anti-Aliasing samples in the user preferences
to a lower sample count the anti-aliasing was not reset. This lead to
incorrect result as the accum buffer would still hold the values of the
larger sample count.

This fix resets the TAA when the sample count is changed.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7728

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

M	source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
M	source/blender/draw/engines/workbench/workbench_engine.c
M	source/blender/draw/engines/workbench/workbench_private.h

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

diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
index 5c8730ac8f9..d2bd653a656 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
@@ -176,6 +176,14 @@ void workbench_antialiasing_engine_init(WORKBENCH_Data *vedata)
     }
   }
 
+  /* Reset the TAA when we have already draw a sample, but the sample count differs from previous
+   * time. This removes render artifacts when the viewport anti-aliasing in the user preferences is
+   * set to a lower value. */
+  if (wpd->taa_sample_len != wpd->taa_sample_len_previous) {
+    wpd->taa_sample = 0;
+    wpd->taa_sample_len_previous = wpd->taa_sample_len;
+  }
+
   if (wpd->view_updated) {
     wpd->taa_sample = 0;
     wpd->view_updated = false;
diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c
index a88076d5fd7..f11a4aab668 100644
--- a/source/blender/draw/engines/workbench/workbench_engine.c
+++ b/source/blender/draw/engines/workbench/workbench_engine.c
@@ -55,6 +55,7 @@ void workbench_engine_init(void *ved)
 
   if (!stl->wpd) {
     stl->wpd = MEM_callocN(sizeof(*stl->wpd), __func__);
+    stl->wpd->taa_sample_len_previous = -1;
     stl->wpd->view_updated = true;
   }
 
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h
index 2191e09bc24..967bdf9bae0 100644
--- a/source/blender/draw/engines/workbench/workbench_private.h
+++ b/source/blender/draw/engines/workbench/workbench_private.h
@@ -261,6 +261,8 @@ typedef struct WORKBENCH_PrivateData {
   /* Temporal Antialiasing */
   /** Total number of samples to after which TAA stops accumulating samples. */
   int taa_sample_len;
+  /** Total number of samples of the previous TAA. When changed TAA will be reset. */
+  int taa_sample_len_previous;
   /** Current TAA sample index in [0..taa_sample_len[ range. */
   int taa_sample;
   /** Inverse of taa_sample to divide the accumulation buffer. */



More information about the Bf-blender-cvs mailing list